1   /**
2    * Copyright (c) 2000-2009 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.service;
24  
25  import com.liferay.portal.kernel.util.Constants;
26  import com.liferay.portal.kernel.util.Validator;
27  import com.liferay.portal.model.PortletPreferencesIds;
28  
29  import java.io.Serializable;
30  
31  import java.util.LinkedHashMap;
32  import java.util.Map;
33  
34  /**
35   * <a href="ServiceContext.java.html"><b><i>View Source</i></b></a>
36   *
37   * @author Raymond Augé
38   * @author Brian Wing Shun Chan
39   * @author Jorge Ferrer
40   */
41  public class ServiceContext implements Serializable {
42  
43      public ServiceContext() {
44          _attributes = new LinkedHashMap<String, Serializable>();
45          _expandoBridgeAttributes = new LinkedHashMap<String, Serializable>();
46      }
47  
48      public boolean getAddCommunityPermissions() {
49          return _addCommunityPermissions;
50      }
51  
52      public boolean getAddGuestPermissions() {
53          return _addGuestPermissions;
54      }
55  
56      public Serializable getAttribute(String name) {
57          return _attributes.get(name);
58      }
59  
60      public Map<String, Serializable> getAttributes() {
61          return _attributes;
62      }
63  
64      public String getCommand() {
65          return _command;
66      }
67  
68      public String[] getCommunityPermissions() {
69          return _communityPermissions;
70      }
71  
72      public long getCompanyId() {
73          return _companyId;
74      }
75  
76      public Map<String, Serializable> getExpandoBridgeAttributes() {
77          return _expandoBridgeAttributes;
78      }
79  
80      public String[] getGuestPermissions() {
81          return _guestPermissions;
82      }
83  
84      public String getLanguageId() {
85          return _languageId;
86      }
87  
88      public String getLayoutFullURL() {
89          return _layoutFullURL;
90      }
91  
92      public String getLayoutURL() {
93          return _layoutURL;
94      }
95  
96      public String getPathMain() {
97          return _pathMain;
98      }
99  
100     public long getPlid() {
101         return _plid;
102     }
103 
104     public String getPortalURL() {
105         return _portalURL;
106     }
107 
108     public PortletPreferencesIds getPortletPreferencesIds() {
109         return _portletPreferencesIds;
110     }
111 
112     public long getScopeGroupId() {
113         return _scopeGroupId;
114     }
115 
116     public String[] getTagsCategories() {
117         return _tagsCategories;
118     }
119 
120     public String[] getTagsEntries() {
121         return _tagsEntries;
122     }
123 
124     public String getUserDisplayURL() {
125         return _userDisplayURL;
126     }
127 
128     public long getUserId() {
129         return _userId;
130     }
131 
132     public boolean isCommandAdd() {
133         if (Validator.equals(_command, Constants.ADD)) {
134             return true;
135         }
136         else {
137             return false;
138         }
139     }
140 
141     public boolean isCommandUpdate() {
142         if (Validator.equals(_command, Constants.UPDATE)) {
143             return true;
144         }
145         else {
146             return false;
147         }
148     }
149 
150     public void setAddCommunityPermissions(boolean addCommunityPermissions) {
151         _addCommunityPermissions = addCommunityPermissions;
152     }
153 
154     public void setAddGuestPermissions(boolean addGuestPermissions) {
155         _addGuestPermissions = addGuestPermissions;
156     }
157 
158     public void setAttribute(String name, Serializable value) {
159         _attributes.put(name, value);
160     }
161 
162     public void setAttributes(Map<String, Serializable> attributes) {
163         _attributes = attributes;
164     }
165 
166     public void setCommand(String command) {
167         _command = command;
168     }
169 
170     public void setCommunityPermissions(String[] communityPermissions) {
171         _communityPermissions = communityPermissions;
172     }
173 
174     public void setCompanyId(long companyId) {
175         _companyId = companyId;
176     }
177 
178     public void setExpandoBridgeAttributes(
179         Map<String, Serializable> expandoBridgeAttributes) {
180 
181         _expandoBridgeAttributes = expandoBridgeAttributes;
182     }
183 
184     public void setGuestPermissions(String[] guestPermissions) {
185         _guestPermissions = guestPermissions;
186     }
187 
188     public void setLanguageId(String languageId) {
189         _languageId = languageId;
190     }
191 
192     public void setLayoutFullURL(String layoutFullURL) {
193         _layoutFullURL = layoutFullURL;
194     }
195 
196     public void setLayoutURL(String layoutURL) {
197         _layoutURL = layoutURL;
198     }
199 
200     public void setPathMain(String pathMain) {
201         _pathMain = pathMain;
202     }
203 
204     public void setPlid(long plid) {
205         _plid = plid;
206     }
207 
208     public void setPortalURL(String portalURL) {
209         _portalURL = portalURL;
210     }
211 
212     public void setPortletPreferencesIds(
213         PortletPreferencesIds portletPreferencesIds) {
214 
215         _portletPreferencesIds = portletPreferencesIds;
216     }
217 
218     public void setScopeGroupId(long scopeGroupId) {
219         _scopeGroupId = scopeGroupId;
220     }
221 
222     public void setTagsCategories(String[] tagsCategories) {
223         _tagsCategories = tagsCategories;
224     }
225 
226     public void setTagsEntries(String[] tagsEntries) {
227         _tagsEntries = tagsEntries;
228     }
229 
230     public void setUserDisplayURL(String userDisplayURL) {
231         _userDisplayURL = userDisplayURL;
232     }
233 
234     public void setUserId(long userId) {
235         _userId = userId;
236     }
237 
238     private boolean _addCommunityPermissions;
239     private boolean _addGuestPermissions;
240     private Map<String, Serializable> _attributes;
241     private String _command;
242     private String[] _communityPermissions;
243     private long _companyId;
244     private Map<String, Serializable> _expandoBridgeAttributes;
245     private String[] _guestPermissions;
246     private String _languageId;
247     private String _layoutFullURL;
248     private String _layoutURL;
249     private String _pathMain;
250     private String _portalURL;
251     private PortletPreferencesIds _portletPreferencesIds;
252     private long _scopeGroupId;
253     private String[] _tagsCategories;
254     private String[] _tagsEntries;
255     private String _userDisplayURL;
256     private long _plid;
257     private long _userId;
258 
259 }