1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.sharepoint.methods;
16  
17  import com.liferay.portal.kernel.util.StringPool;
18  import com.liferay.portal.sharepoint.Property;
19  import com.liferay.portal.sharepoint.ResponseElement;
20  import com.liferay.portal.sharepoint.SharepointRequest;
21  import com.liferay.portal.sharepoint.SharepointStorage;
22  
23  import java.util.ArrayList;
24  import java.util.List;
25  
26  /**
27   * <a href="CreateURLDirectoriesMethodImpl.java.html"><b><i>View Source</i></b>
28   * </a>
29   *
30   * @author Bruno Farache
31   */
32  public class CreateURLDirectoriesMethodImpl extends BaseMethodImpl {
33  
34      public String getMethodName() {
35          return _METHOD_NAME;
36      }
37  
38      public String getRootPath(SharepointRequest sharepointRequest) {
39          String urlDirs = sharepointRequest.getParameterValue("urldirs");
40  
41          urlDirs = urlDirs.substring(2, urlDirs.length() - 2);
42  
43          String urls[] = urlDirs.split(StringPool.SEMICOLON);
44  
45          return urls[0].substring(4);
46      }
47  
48      protected List<ResponseElement> getElements(
49              SharepointRequest sharepointRequest)
50          throws Exception {
51  
52          List<ResponseElement> elements = new ArrayList<ResponseElement>();
53  
54          SharepointStorage storage = sharepointRequest.getSharepointStorage();
55  
56          storage.createFolder(sharepointRequest);
57  
58          elements.add(new Property("message", StringPool.BLANK));
59  
60          return elements;
61      }
62  
63      private static final String _METHOD_NAME = "create url-directories";
64  
65  }