1   /**
2    * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.editor.fckeditor.command;
24  
25  import com.liferay.portal.kernel.util.StringPool;
26  import com.liferay.portal.theme.ThemeDisplay;
27  
28  import java.util.StringTokenizer;
29  
30  import javax.servlet.http.HttpServletRequest;
31  
32  /**
33   * <a href="CommandArgument.java.html"><b><i>View Source</i></b></a>
34   *
35   * @author Ivica Cardic
36   * @author Brian Wing Shun Chan
37   *
38   */
39  public class CommandArgument {
40  
41      public CommandArgument(String command, String type, String currentFolder,
42                             String newFolder, ThemeDisplay themeDisplay,
43                             HttpServletRequest req) {
44  
45          _command = command;
46          _type = type;
47          _currentFolder = currentFolder;
48          _newFolder = newFolder;
49          _themeDisplay = themeDisplay;
50          _req = req;
51      }
52  
53      public String getCommand() {
54          return _command;
55      }
56  
57      public String getType() {
58          return _type;
59      }
60  
61      public String getCurrentFolder() {
62          return _currentFolder;
63      }
64  
65      public String getNewFolder() {
66          return _newFolder;
67      }
68  
69      public ThemeDisplay getThemeDisplay() {
70          return _themeDisplay;
71      }
72  
73      public HttpServletRequest getHttpServletRequest() {
74          return _req;
75      }
76  
77      public long getCompanyId() {
78          return _themeDisplay.getCompanyId();
79      }
80  
81      public String getCurrentGroupName() {
82          if (_currentFolder.equals("/")) {
83              return StringPool.BLANK;
84          }
85          else {
86              StringTokenizer st = new StringTokenizer(_currentFolder, "/");
87  
88              return st.nextToken();
89          }
90      }
91  
92      public long getUserId() {
93          return _themeDisplay.getUserId();
94      }
95  
96      public long getPlid() {
97          return _themeDisplay.getPlid();
98      }
99  
100     private String _command;
101     private String _type;
102     private String _currentFolder;
103     private String _newFolder;
104     private ThemeDisplay _themeDisplay;
105     private HttpServletRequest _req;
106 
107 }