1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.service;
16  
17  import com.liferay.portal.kernel.util.Constants;
18  import com.liferay.portal.kernel.util.Validator;
19  import com.liferay.portal.kernel.workflow.StatusConstants;
20  import com.liferay.portal.model.PortletPreferencesIds;
21  
22  import java.io.Serializable;
23  
24  import java.util.LinkedHashMap;
25  import java.util.Map;
26  
27  /**
28   * <a href="ServiceContext.java.html"><b><i>View Source</i></b></a>
29   *
30   * @author Raymond Augé
31   * @author Brian Wing Shun Chan
32   * @author Jorge Ferrer
33   */
34  public class ServiceContext implements Serializable {
35  
36      public ServiceContext() {
37          _attributes = new LinkedHashMap<String, Serializable>();
38          _expandoBridgeAttributes = new LinkedHashMap<String, Serializable>();
39      }
40  
41      public boolean getAddCommunityPermissions() {
42          return _addCommunityPermissions;
43      }
44  
45      public boolean getAddGuestPermissions() {
46          return _addGuestPermissions;
47      }
48  
49      public long[] getAssetCategoryIds() {
50          return _assetCategoryIds;
51      }
52  
53      public String[] getAssetTagNames() {
54          return _assetTagNames;
55      }
56  
57      public Serializable getAttribute(String name) {
58          return _attributes.get(name);
59      }
60  
61      public Map<String, Serializable> getAttributes() {
62          return _attributes;
63      }
64  
65      public String getCommand() {
66          return _command;
67      }
68  
69      public String[] getCommunityPermissions() {
70          return _communityPermissions;
71      }
72  
73      public long getCompanyId() {
74          return _companyId;
75      }
76  
77      public Map<String, Serializable> getExpandoBridgeAttributes() {
78          return _expandoBridgeAttributes;
79      }
80  
81      public String[] getGuestPermissions() {
82          return _guestPermissions;
83      }
84  
85      public String getLanguageId() {
86          return _languageId;
87      }
88  
89      public String getLayoutFullURL() {
90          return _layoutFullURL;
91      }
92  
93      public String getLayoutURL() {
94          return _layoutURL;
95      }
96  
97      public String getPathMain() {
98          return _pathMain;
99      }
100 
101     public long getPlid() {
102         return _plid;
103     }
104 
105     public String getPortalURL() {
106         return _portalURL;
107     }
108 
109     public PortletPreferencesIds getPortletPreferencesIds() {
110         return _portletPreferencesIds;
111     }
112 
113     public long getScopeGroupId() {
114         return _scopeGroupId;
115     }
116 
117     public int getStatus() {
118         return _status;
119     }
120 
121     public String getUserDisplayURL() {
122         return _userDisplayURL;
123     }
124 
125     public long getUserId() {
126         return _userId;
127     }
128 
129     public boolean isCommandAdd() {
130         if (Validator.equals(_command, Constants.ADD)) {
131             return true;
132         }
133         else {
134             return false;
135         }
136     }
137 
138     public boolean isCommandUpdate() {
139         if (Validator.equals(_command, Constants.UPDATE)) {
140             return true;
141         }
142         else {
143             return false;
144         }
145     }
146 
147     public boolean isStartWorkflow() {
148         return _startWorkflow;
149     }
150 
151     public void setAddCommunityPermissions(boolean addCommunityPermissions) {
152         _addCommunityPermissions = addCommunityPermissions;
153     }
154 
155     public void setAddGuestPermissions(boolean addGuestPermissions) {
156         _addGuestPermissions = addGuestPermissions;
157     }
158 
159     public void setAssetCategoryIds(long[] assetCategoryIds) {
160         _assetCategoryIds = assetCategoryIds;
161     }
162 
163     public void setAssetTagNames(String[] assetTagNames) {
164         _assetTagNames = assetTagNames;
165     }
166 
167     public void setAttribute(String name, Serializable value) {
168         _attributes.put(name, value);
169     }
170 
171     public void setAttributes(Map<String, Serializable> attributes) {
172         _attributes = attributes;
173     }
174 
175     public void setCommand(String command) {
176         _command = command;
177     }
178 
179     public void setCommunityPermissions(String[] communityPermissions) {
180         _communityPermissions = communityPermissions;
181     }
182 
183     public void setCompanyId(long companyId) {
184         _companyId = companyId;
185     }
186 
187     public void setExpandoBridgeAttributes(
188         Map<String, Serializable> expandoBridgeAttributes) {
189 
190         _expandoBridgeAttributes = expandoBridgeAttributes;
191     }
192 
193     public void setGuestPermissions(String[] guestPermissions) {
194         _guestPermissions = guestPermissions;
195     }
196 
197     public void setLanguageId(String languageId) {
198         _languageId = languageId;
199     }
200 
201     public void setLayoutFullURL(String layoutFullURL) {
202         _layoutFullURL = layoutFullURL;
203     }
204 
205     public void setLayoutURL(String layoutURL) {
206         _layoutURL = layoutURL;
207     }
208 
209     public void setPathMain(String pathMain) {
210         _pathMain = pathMain;
211     }
212 
213     public void setPlid(long plid) {
214         _plid = plid;
215     }
216 
217     public void setPortalURL(String portalURL) {
218         _portalURL = portalURL;
219     }
220 
221     public void setPortletPreferencesIds(
222         PortletPreferencesIds portletPreferencesIds) {
223 
224         _portletPreferencesIds = portletPreferencesIds;
225     }
226 
227     public void setScopeGroupId(long scopeGroupId) {
228         _scopeGroupId = scopeGroupId;
229     }
230 
231     public void setStartWorkflow(boolean startWorkflow) {
232         _startWorkflow = startWorkflow;
233     }
234 
235     public void setStatus(int status) {
236         _status = status;
237     }
238 
239     public void setUserDisplayURL(String userDisplayURL) {
240         _userDisplayURL = userDisplayURL;
241     }
242 
243     public void setUserId(long userId) {
244         _userId = userId;
245     }
246 
247     private boolean _addCommunityPermissions;
248     private boolean _addGuestPermissions;
249     private long[] _assetCategoryIds;
250     private String[] _assetTagNames;
251     private Map<String, Serializable> _attributes;
252     private String _command;
253     private String[] _communityPermissions;
254     private long _companyId;
255     private Map<String, Serializable> _expandoBridgeAttributes;
256     private String[] _guestPermissions;
257     private String _languageId;
258     private String _layoutFullURL;
259     private String _layoutURL;
260     private String _pathMain;
261     private String _portalURL;
262     private PortletPreferencesIds _portletPreferencesIds;
263     private long _scopeGroupId;
264     private String _userDisplayURL;
265     private long _plid;
266     private boolean _startWorkflow;
267     private int _status = StatusConstants.APPROVED;
268     private long _userId;
269 
270 }