001
014
015 package com.liferay.portal.kernel.service;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.json.JSON;
019 import com.liferay.portal.kernel.language.LanguageUtil;
020 import com.liferay.portal.kernel.model.AuditedModel;
021 import com.liferay.portal.kernel.model.Group;
022 import com.liferay.portal.kernel.model.PortletConstants;
023 import com.liferay.portal.kernel.model.PortletPreferencesIds;
024 import com.liferay.portal.kernel.model.Role;
025 import com.liferay.portal.kernel.model.RoleConstants;
026 import com.liferay.portal.kernel.portlet.LiferayPortletRequest;
027 import com.liferay.portal.kernel.portlet.LiferayPortletResponse;
028 import com.liferay.portal.kernel.security.permission.ResourceActionsUtil;
029 import com.liferay.portal.kernel.service.permission.ModelPermissions;
030 import com.liferay.portal.kernel.servlet.HttpHeaders;
031 import com.liferay.portal.kernel.theme.ThemeDisplay;
032 import com.liferay.portal.kernel.util.Constants;
033 import com.liferay.portal.kernel.util.DateUtil;
034 import com.liferay.portal.kernel.util.JavaConstants;
035 import com.liferay.portal.kernel.util.LocaleUtil;
036 import com.liferay.portal.kernel.util.PortalUtil;
037 import com.liferay.portal.kernel.util.Validator;
038 import com.liferay.portal.kernel.util.WebKeys;
039 import com.liferay.portal.kernel.workflow.WorkflowConstants;
040
041 import java.io.Serializable;
042
043 import java.util.ArrayList;
044 import java.util.Date;
045 import java.util.LinkedHashMap;
046 import java.util.List;
047 import java.util.Locale;
048 import java.util.Map;
049 import java.util.Objects;
050 import java.util.TimeZone;
051
052 import javax.servlet.http.HttpServletRequest;
053 import javax.servlet.http.HttpServletResponse;
054
055
070 @JSON
071 public class ServiceContext implements Cloneable, Serializable {
072
073
079 public ServiceContext() {
080 _attributes = new LinkedHashMap<>();
081 _expandoBridgeAttributes = new LinkedHashMap<>();
082 }
083
084
090 @Override
091 public Object clone() {
092 ServiceContext serviceContext = new ServiceContext();
093
094 serviceContext.setAddGroupPermissions(isAddGroupPermissions());
095 serviceContext.setAddGuestPermissions(isAddGuestPermissions());
096 serviceContext.setAssetCategoryIds(getAssetCategoryIds());
097 serviceContext.setAssetEntryVisible(isAssetEntryVisible());
098 serviceContext.setAssetLinkEntryIds(getAssetLinkEntryIds());
099 serviceContext.setAssetPriority(getAssetPriority());
100 serviceContext.setAssetTagNames(getAssetTagNames());
101 serviceContext.setAttributes(getAttributes());
102 serviceContext.setCommand(getCommand());
103 serviceContext.setCompanyId(getCompanyId());
104 serviceContext.setCreateDate(getCreateDate());
105 serviceContext.setCurrentURL(getCurrentURL());
106 serviceContext.setExpandoBridgeAttributes(getExpandoBridgeAttributes());
107 serviceContext.setFailOnPortalException(isFailOnPortalException());
108 serviceContext.setGroupPermissions(getGroupPermissions());
109 serviceContext.setGuestPermissions(getGuestPermissions());
110 serviceContext.setHeaders(getHeaders());
111 serviceContext.setIndexingEnabled(isIndexingEnabled());
112 serviceContext.setLanguageId(getLanguageId());
113 serviceContext.setLayoutFullURL(getLayoutFullURL());
114 serviceContext.setLayoutURL(getLayoutURL());
115 serviceContext.setModelPermissions(
116 (ModelPermissions)_modelPermissions.clone());
117 serviceContext.setModifiedDate(getModifiedDate());
118 serviceContext.setPathFriendlyURLPrivateGroup(
119 getPathFriendlyURLPrivateGroup());
120 serviceContext.setPathFriendlyURLPrivateUser(
121 getPathFriendlyURLPrivateUser());
122 serviceContext.setPathFriendlyURLPublic(getPathFriendlyURLPublic());
123 serviceContext.setPathMain(getPathMain());
124 serviceContext.setPlid(getPlid());
125 serviceContext.setPortalURL(getPortalURL());
126 serviceContext.setPortletPreferencesIds(getPortletPreferencesIds());
127 serviceContext.setRemoteAddr(getRemoteAddr());
128 serviceContext.setRemoteHost(getRemoteHost());
129 serviceContext.setRequest(getRequest());
130 serviceContext.setScopeGroupId(getScopeGroupId());
131 serviceContext.setSignedIn(isSignedIn());
132 serviceContext.setUserDisplayURL(getUserDisplayURL());
133 serviceContext.setUserId(getUserId());
134 serviceContext.setUuid(getUuid());
135 serviceContext.setWorkflowAction(getWorkflowAction());
136
137 return serviceContext;
138 }
139
140
145 public void deriveDefaultPermissions(long repositoryId, String modelName)
146 throws PortalException {
147
148 long siteGroupId = PortalUtil.getSiteGroupId(repositoryId);
149
150 Group siteGroup = GroupLocalServiceUtil.getGroup(siteGroupId);
151
152 Role defaultGroupRole = RoleLocalServiceUtil.getDefaultGroupRole(
153 siteGroupId);
154
155 List<String> groupPermissionsList = new ArrayList<>();
156 List<String> guestPermissionsList = new ArrayList<>();
157
158 String[] roleNames = {RoleConstants.GUEST, defaultGroupRole.getName()};
159
160 List<String> supportedActions =
161 ResourceActionsUtil.getModelResourceActions(modelName);
162 List<String> groupDefaultActions =
163 ResourceActionsUtil.getModelResourceGroupDefaultActions(modelName);
164 List<String> guestDefaultActions =
165 ResourceActionsUtil.getModelResourceGuestDefaultActions(modelName);
166 List<String> guestUnsupportedActions =
167 ResourceActionsUtil.getModelResourceGuestUnsupportedActions(
168 modelName);
169
170 for (String roleName : roleNames) {
171 for (String action : supportedActions) {
172 if (roleName.equals(RoleConstants.GUEST) &&
173 !guestUnsupportedActions.contains(action) &&
174 guestDefaultActions.contains(action) &&
175 siteGroup.hasPublicLayouts()) {
176
177 guestPermissionsList.add(action);
178 }
179 else if (roleName.equals(defaultGroupRole.getName()) &&
180 groupDefaultActions.contains(action)) {
181
182 groupPermissionsList.add(action);
183 }
184 }
185 }
186
187 String[] groupPermissions = groupPermissionsList.toArray(
188 new String[groupPermissionsList.size()]);
189
190 setGroupPermissions(groupPermissions);
191
192 String[] guestPermissions = guestPermissionsList.toArray(
193 new String[guestPermissionsList.size()]);
194
195 setGuestPermissions(guestPermissions);
196 }
197
198
205 public long[] getAssetCategoryIds() {
206 return _assetCategoryIds;
207 }
208
209
216 public long[] getAssetLinkEntryIds() {
217 return _assetLinkEntryIds;
218 }
219
220
226 public double getAssetPriority() {
227 return _assetPriority;
228 }
229
230
237 public String[] getAssetTagNames() {
238 return _assetTagNames;
239 }
240
241
248 public Serializable getAttribute(String name) {
249 return _attributes.get(name);
250 }
251
252
258 public Map<String, Serializable> getAttributes() {
259 return _attributes;
260 }
261
262
268 public String getCommand() {
269 return _command;
270 }
271
272
277 public long getCompanyId() {
278 return _companyId;
279 }
280
281
287 public Date getCreateDate() {
288 return _createDate;
289 }
290
291
300 public Date getCreateDate(Date defaultCreateDate) {
301 if (_createDate != null) {
302 return _createDate;
303 }
304 else if (defaultCreateDate != null) {
305 return defaultCreateDate;
306 }
307 else {
308 return new Date();
309 }
310 }
311
312
317 public String getCurrentURL() {
318 return _currentURL;
319 }
320
321
331 public Map<String, Serializable> getExpandoBridgeAttributes() {
332 return _expandoBridgeAttributes;
333 }
334
335
356 public Date getFormDate() {
357 return _formDate;
358 }
359
360
367 public String[] getGroupPermissions() {
368 return _modelPermissions.getActionIds(
369 RoleConstants.PLACEHOLDER_DEFAULT_GROUP_ROLE);
370 }
371
372
380 public long getGuestOrUserId() throws PortalException {
381 long userId = getUserId();
382
383 if (userId > 0) {
384 return userId;
385 }
386
387 long companyId = getCompanyId();
388
389 if (companyId > 0) {
390 return UserLocalServiceUtil.getDefaultUserId(getCompanyId());
391 }
392
393 return 0;
394 }
395
396
403 public String[] getGuestPermissions() {
404 return _modelPermissions.getActionIds(RoleConstants.GUEST);
405 }
406
407
414 @JSON(include = false)
415 public Map<String, String> getHeaders() {
416 return _headers;
417 }
418
419
425 public String getLanguageId() {
426 if (_languageId != null) {
427 return _languageId;
428 }
429
430 return LocaleUtil.toLanguageId(LocaleUtil.getMostRelevantLocale());
431 }
432
433
439 public String getLayoutFullURL() {
440 return _layoutFullURL;
441 }
442
443
449 public String getLayoutURL() {
450 return _layoutURL;
451 }
452
453 @JSON(include = false)
454 public LiferayPortletRequest getLiferayPortletRequest() {
455 if (_request == null) {
456 return null;
457 }
458
459 LiferayPortletRequest liferayPortletRequest =
460 (LiferayPortletRequest)_request.getAttribute(
461 JavaConstants.JAVAX_PORTLET_REQUEST);
462
463 return liferayPortletRequest;
464 }
465
466 @JSON(include = false)
467 public LiferayPortletResponse getLiferayPortletResponse() {
468 if (_request == null) {
469 return null;
470 }
471
472 LiferayPortletResponse liferayPortletResponse =
473 (LiferayPortletResponse)_request.getAttribute(
474 JavaConstants.JAVAX_PORTLET_RESPONSE);
475
476 return liferayPortletResponse;
477 }
478
479 public Locale getLocale() {
480 return LocaleUtil.fromLanguageId(_languageId);
481 }
482
483 public ModelPermissions getModelPermissions() {
484 return _modelPermissions;
485 }
486
487
494 public Date getModifiedDate() {
495 return _modifiedDate;
496 }
497
498
506 public Date getModifiedDate(Date defaultModifiedDate) {
507 if (_modifiedDate != null) {
508 return _modifiedDate;
509 }
510 else if (defaultModifiedDate != null) {
511 return defaultModifiedDate;
512 }
513 else {
514 return new Date();
515 }
516 }
517
518 public String getPathFriendlyURLPrivateGroup() {
519 return _pathFriendlyURLPrivateGroup;
520 }
521
522 public String getPathFriendlyURLPrivateUser() {
523 return _pathFriendlyURLPrivateUser;
524 }
525
526 public String getPathFriendlyURLPublic() {
527 return _pathFriendlyURLPublic;
528 }
529
530
536 public String getPathMain() {
537 return _pathMain;
538 }
539
540
545 public long getPlid() {
546 return _plid;
547 }
548
549
562 public String getPortalURL() {
563 return _portalURL;
564 }
565
566
573 public String getPortletId() {
574 if (_portletPreferencesIds == null) {
575 return null;
576 }
577
578 return _portletPreferencesIds.getPortletId();
579 }
580
581
593 public PortletPreferencesIds getPortletPreferencesIds() {
594 return _portletPreferencesIds;
595 }
596
597
603 public String getRemoteAddr() {
604 return _remoteAddr;
605 }
606
607
613 public String getRemoteHost() {
614 return _remoteHost;
615 }
616
617 @JSON(include = false)
618 public HttpServletRequest getRequest() {
619 return _request;
620 }
621
622 @JSON(include = false)
623 public HttpServletResponse getResponse() {
624 LiferayPortletResponse liferayPortletResponse =
625 getLiferayPortletResponse();
626
627 if (liferayPortletResponse == null) {
628 return null;
629 }
630
631 return PortalUtil.getHttpServletResponse(liferayPortletResponse);
632 }
633
634 public String getRootPortletId() {
635 String portletId = getPortletId();
636
637 if (portletId == null) {
638 return null;
639 }
640
641 return PortletConstants.getRootPortletId(portletId);
642 }
643
644 public Group getScopeGroup() throws PortalException {
645 return GroupLocalServiceUtil.getGroup(_scopeGroupId);
646 }
647
648
655 public long getScopeGroupId() {
656 return _scopeGroupId;
657 }
658
659 public ThemeDisplay getThemeDisplay() {
660 if (_request == null) {
661 return null;
662 }
663
664 return (ThemeDisplay)_request.getAttribute(WebKeys.THEME_DISPLAY);
665 }
666
667 public TimeZone getTimeZone() {
668 return _timeZone;
669 }
670
671
677 public String getUserAgent() {
678 if (_request == null) {
679 return null;
680 }
681
682 return _request.getHeader(HttpHeaders.USER_AGENT);
683 }
684
685
692 public String getUserDisplayURL() {
693 return _userDisplayURL;
694 }
695
696
701 public long getUserId() {
702 return _userId;
703 }
704
705
715 public String getUuid() {
716 String uuid = _uuid;
717
718 _uuid = null;
719
720 return uuid;
721 }
722
723 public String getUuidWithoutReset() {
724 return _uuid;
725 }
726
727
733 public int getWorkflowAction() {
734 return _workflowAction;
735 }
736
737
746 public boolean isAddGroupPermissions() {
747 return _addGroupPermissions;
748 }
749
750
759 public boolean isAddGuestPermissions() {
760 return _addGuestPermissions;
761 }
762
763 public boolean isAssetEntryVisible() {
764 return _assetEntryVisible;
765 }
766
767
774 public boolean isCommandAdd() {
775 if (Objects.equals(_command, Constants.ADD) ||
776 Objects.equals(_command, Constants.ADD_DYNAMIC) ||
777 Objects.equals(_command, Constants.ADD_MULTIPLE) ||
778 Objects.equals(_command, Constants.ADD_WEBDAV)) {
779
780 return true;
781 }
782 else {
783 return false;
784 }
785 }
786
787
794 public boolean isCommandUpdate() {
795 if (Objects.equals(_command, Constants.UPDATE) ||
796 Objects.equals(_command, Constants.UPDATE_AND_CHECKIN) ||
797 Objects.equals(_command, Constants.UPDATE_WEBDAV)) {
798
799 return true;
800 }
801 else {
802 return false;
803 }
804 }
805
806 public boolean isDeriveDefaultPermissions() {
807 return _deriveDefaultPermissions;
808 }
809
810
839 public boolean isFailOnPortalException() {
840 return _failOnPortalException;
841 }
842
843
850 public boolean isIndexingEnabled() {
851 return _indexingEnabled;
852 }
853
854
861 public boolean isSignedIn() {
862 return _signedIn;
863 }
864
865
872 public void merge(ServiceContext serviceContext) {
873 setAddGroupPermissions(serviceContext.isAddGroupPermissions());
874 setAddGuestPermissions(serviceContext.isAddGuestPermissions());
875
876 if (serviceContext.getAssetCategoryIds() != null) {
877 setAssetCategoryIds(serviceContext.getAssetCategoryIds());
878 }
879
880 setAssetEntryVisible(serviceContext.isAssetEntryVisible());
881
882 if (serviceContext.getAssetLinkEntryIds() != null) {
883 setAssetLinkEntryIds(serviceContext.getAssetLinkEntryIds());
884 }
885
886 if (serviceContext.getAssetPriority() > 0) {
887 setAssetPriority(serviceContext.getAssetPriority());
888 }
889
890 if (serviceContext.getAssetTagNames() != null) {
891 setAssetTagNames(serviceContext.getAssetTagNames());
892 }
893
894 if (serviceContext.getAttributes() != null) {
895 setAttributes(serviceContext.getAttributes());
896 }
897
898 if (Validator.isNotNull(serviceContext.getCommand())) {
899 setCommand(serviceContext.getCommand());
900 }
901
902 if (serviceContext.getCompanyId() > 0) {
903 setCompanyId(serviceContext.getCompanyId());
904 }
905
906 if (serviceContext.getCreateDate() != null) {
907 setCreateDate(serviceContext.getCreateDate());
908 }
909
910 if (Validator.isNotNull(serviceContext.getCurrentURL())) {
911 setCurrentURL(serviceContext.getCurrentURL());
912 }
913
914 setDeriveDefaultPermissions(
915 serviceContext.isDeriveDefaultPermissions());
916
917 if (serviceContext.getExpandoBridgeAttributes() != null) {
918 setExpandoBridgeAttributes(
919 serviceContext.getExpandoBridgeAttributes());
920 }
921
922 setFailOnPortalException(serviceContext.isFailOnPortalException());
923
924 if (serviceContext.getGroupPermissions() != null) {
925 setGroupPermissions(serviceContext.getGroupPermissions());
926 }
927
928 if (serviceContext.getGuestPermissions() != null) {
929 setGuestPermissions(serviceContext.getGuestPermissions());
930 }
931
932 if (serviceContext.getHeaders() != null) {
933 setHeaders(serviceContext.getHeaders());
934 }
935
936 setIndexingEnabled(serviceContext.isIndexingEnabled());
937 setLanguageId(serviceContext.getLanguageId());
938
939 if (Validator.isNotNull(serviceContext.getLayoutFullURL())) {
940 setLayoutFullURL(serviceContext.getLayoutFullURL());
941 }
942
943 if (Validator.isNotNull(serviceContext.getLayoutURL())) {
944 setLayoutURL(serviceContext.getLayoutURL());
945 }
946
947 if (serviceContext.getModifiedDate() != null) {
948 setModifiedDate(serviceContext.getModifiedDate());
949 }
950
951 if (Validator.isNotNull(
952 serviceContext.getPathFriendlyURLPrivateGroup())) {
953
954 setPathFriendlyURLPrivateGroup(
955 serviceContext.getPathFriendlyURLPrivateGroup());
956 }
957
958 if (Validator.isNotNull(
959 serviceContext.getPathFriendlyURLPrivateUser())) {
960
961 setPathFriendlyURLPrivateUser(
962 serviceContext.getPathFriendlyURLPrivateUser());
963 }
964
965 if (Validator.isNotNull(serviceContext.getPathFriendlyURLPublic())) {
966 setPathFriendlyURLPublic(serviceContext.getPathFriendlyURLPublic());
967 }
968
969 if (Validator.isNotNull(serviceContext.getPathMain())) {
970 setPathMain(serviceContext.getPathMain());
971 }
972
973 if (serviceContext.getPlid() > 0) {
974 setPlid(serviceContext.getPlid());
975 }
976
977 if (Validator.isNotNull(serviceContext.getPortalURL())) {
978 setPortalURL(serviceContext.getPortalURL());
979 }
980
981 if (serviceContext.getPortletPreferencesIds() != null) {
982 setPortletPreferencesIds(serviceContext.getPortletPreferencesIds());
983 }
984
985 if (Validator.isNotNull(serviceContext.getRemoteAddr())) {
986 setRemoteAddr(serviceContext.getRemoteAddr());
987 }
988
989 if (Validator.isNotNull(serviceContext.getRemoteHost())) {
990 setRemoteHost(serviceContext.getRemoteHost());
991 }
992
993 if (serviceContext.getScopeGroupId() > 0) {
994 setScopeGroupId(serviceContext.getScopeGroupId());
995 }
996
997 setSignedIn(serviceContext.isSignedIn());
998
999 if (serviceContext.getTimeZone() != null) {
1000 setTimeZone(serviceContext.getTimeZone());
1001 }
1002
1003 if (Validator.isNotNull(serviceContext.getUserDisplayURL())) {
1004 setUserDisplayURL(serviceContext.getUserDisplayURL());
1005 }
1006
1007 if (serviceContext.getUserId() > 0) {
1008 setUserId(serviceContext.getUserId());
1009 }
1010
1011
1012
1013
1014 if (Validator.isNotNull(serviceContext._uuid)) {
1015 setUuid(serviceContext._uuid);
1016 }
1017
1018 if (serviceContext.getWorkflowAction() > 0) {
1019 setWorkflowAction(serviceContext.getWorkflowAction());
1020 }
1021 }
1022
1023
1030 public Serializable removeAttribute(String name) {
1031 return _attributes.remove(name);
1032 }
1033
1034
1042 public void setAddGroupPermissions(boolean addGroupPermissions) {
1043 _addGroupPermissions = addGroupPermissions;
1044 }
1045
1046
1054 public void setAddGuestPermissions(boolean addGuestPermissions) {
1055 _addGuestPermissions = addGuestPermissions;
1056 }
1057
1058
1065 public void setAssetCategoryIds(long[] assetCategoryIds) {
1066 _assetCategoryIds = assetCategoryIds;
1067 }
1068
1069 public void setAssetEntryVisible(boolean assetEntryVisible) {
1070 _assetEntryVisible = assetEntryVisible;
1071 }
1072
1073
1081 public void setAssetLinkEntryIds(long[] assetLinkEntryIds) {
1082 _assetLinkEntryIds = assetLinkEntryIds;
1083 }
1084
1085
1091 public void setAssetPriority(double assetPriority) {
1092 _assetPriority = assetPriority;
1093 }
1094
1095
1102 public void setAssetTagNames(String[] assetTagNames) {
1103 _assetTagNames = assetTagNames;
1104 }
1105
1106
1112 public void setAttribute(String name, Serializable value) {
1113 _attributes.put(name, value);
1114 }
1115
1116
1123 public void setAttributes(Map<String, Serializable> attributes) {
1124 _attributes = attributes;
1125 }
1126
1127
1133 public void setCommand(String command) {
1134 _command = command;
1135 }
1136
1137
1143 public void setCompanyId(long companyId) {
1144 _companyId = companyId;
1145 }
1146
1147
1153 public void setCreateDate(Date createDate) {
1154 _createDate = createDate;
1155 }
1156
1157
1162 public void setCurrentURL(String currentURL) {
1163 _currentURL = currentURL;
1164 }
1165
1166 public void setDeriveDefaultPermissions(boolean deriveDefaultPermissions) {
1167 _deriveDefaultPermissions = deriveDefaultPermissions;
1168 }
1169
1170
1181 public void setExpandoBridgeAttributes(
1182 Map<String, Serializable> expandoBridgeAttributes) {
1183
1184 _expandoBridgeAttributes = expandoBridgeAttributes;
1185 }
1186
1187
1198 public void setFailOnPortalException(boolean failOnPortalException) {
1199 _failOnPortalException = failOnPortalException;
1200 }
1201
1202
1225 public void setFormDate(Date formDate) {
1226 _formDate = formDate;
1227 }
1228
1229
1236 public void setGroupPermissions(String[] groupPermissions) {
1237 _modelPermissions.addRolePermissions(
1238 RoleConstants.PLACEHOLDER_DEFAULT_GROUP_ROLE, groupPermissions);
1239 }
1240
1241
1249 public void setGuestPermissions(String[] guestPermissions) {
1250 _modelPermissions.addRolePermissions(
1251 RoleConstants.GUEST, guestPermissions);
1252 }
1253
1254
1261 public void setHeaders(Map<String, String> headers) {
1262 _headers = headers;
1263 }
1264
1265
1277 public void setIndexingEnabled(boolean indexingEnabled) {
1278 _indexingEnabled = indexingEnabled;
1279 }
1280
1281
1287 public void setLanguageId(String languageId) {
1288 _languageId = languageId;
1289 }
1290
1291
1297 public void setLayoutFullURL(String layoutFullURL) {
1298 _layoutFullURL = layoutFullURL;
1299 }
1300
1301
1307 public void setLayoutURL(String layoutURL) {
1308 _layoutURL = layoutURL;
1309 }
1310
1311 public void setModelPermissions(ModelPermissions modelPermissions) {
1312 _modelPermissions = modelPermissions;
1313 }
1314
1315
1321 public void setModifiedDate(Date modifiedDate) {
1322 _modifiedDate = modifiedDate;
1323 }
1324
1325 public void setPathFriendlyURLPrivateGroup(
1326 String pathFriendlyURLPrivateGroup) {
1327
1328 _pathFriendlyURLPrivateGroup = pathFriendlyURLPrivateGroup;
1329 }
1330
1331 public void setPathFriendlyURLPrivateUser(
1332 String pathFriendlyURLPrivateUser) {
1333
1334 _pathFriendlyURLPrivateUser = pathFriendlyURLPrivateUser;
1335 }
1336
1337 public void setPathFriendlyURLPublic(String pathFriendlyURLPublic) {
1338 _pathFriendlyURLPublic = pathFriendlyURLPublic;
1339 }
1340
1341
1347 public void setPathMain(String pathMain) {
1348 _pathMain = pathMain;
1349 }
1350
1351
1356 public void setPlid(long plid) {
1357 _plid = plid;
1358 }
1359
1360
1371 public void setPortalURL(String portalURL) {
1372 _portalURL = portalURL;
1373 }
1374
1375
1387 public void setPortletPreferencesIds(
1388 PortletPreferencesIds portletPreferencesIds) {
1389
1390 _portletPreferencesIds = portletPreferencesIds;
1391 }
1392
1393
1400 public void setRemoteAddr(String remoteAddr) {
1401 _remoteAddr = remoteAddr;
1402 }
1403
1404
1411 public void setRemoteHost(String remoteHost) {
1412 _remoteHost = remoteHost;
1413 }
1414
1415
1421 public void setRequest(HttpServletRequest request) {
1422 _request = request;
1423 }
1424
1425
1433 public void setScopeGroupId(long scopeGroupId) {
1434 _scopeGroupId = scopeGroupId;
1435 }
1436
1437
1443 public void setSignedIn(boolean signedIn) {
1444 _signedIn = signedIn;
1445 }
1446
1447 public void setTimeZone(TimeZone timeZone) {
1448 _timeZone = timeZone;
1449 }
1450
1451
1457 public void setUserDisplayURL(String userDisplayURL) {
1458 _userDisplayURL = userDisplayURL;
1459 }
1460
1461
1466 public void setUserId(long userId) {
1467 _userId = userId;
1468 }
1469
1470
1475 public void setUuid(String uuid) {
1476 _uuid = uuid;
1477 }
1478
1479
1486 public void setWorkflowAction(int workflowAction) {
1487 _workflowAction = workflowAction;
1488 }
1489
1490 public String translate(String pattern, Object... arguments) {
1491 Locale locale = getLocale();
1492
1493 return LanguageUtil.format(locale, pattern, arguments);
1494 }
1495
1496 public void validateModifiedDate(
1497 AuditedModel auditedModel, Class<? extends PortalException> clazz)
1498 throws PortalException {
1499
1500 int value = DateUtil.compareTo(
1501 auditedModel.getModifiedDate(), _formDate);
1502
1503 if (value > 0) {
1504 try {
1505 throw clazz.newInstance();
1506 }
1507 catch (IllegalAccessException iae) {
1508 throw new RuntimeException(iae);
1509 }
1510 catch (InstantiationException ie) {
1511 throw new RuntimeException(ie);
1512 }
1513 }
1514 }
1515
1516 private boolean _addGroupPermissions;
1517 private boolean _addGuestPermissions;
1518 private long[] _assetCategoryIds;
1519 private boolean _assetEntryVisible = true;
1520 private long[] _assetLinkEntryIds;
1521 private double _assetPriority;
1522 private String[] _assetTagNames;
1523 private Map<String, Serializable> _attributes;
1524 private String _command;
1525 private long _companyId;
1526 private Date _createDate;
1527 private String _currentURL;
1528 private boolean _deriveDefaultPermissions;
1529 private Map<String, Serializable> _expandoBridgeAttributes;
1530 private boolean _failOnPortalException = true;
1531 private Date _formDate;
1532 private transient Map<String, String> _headers;
1533 private boolean _indexingEnabled = true;
1534 private String _languageId;
1535 private String _layoutFullURL;
1536 private String _layoutURL;
1537 private ModelPermissions _modelPermissions = new ModelPermissions();
1538 private Date _modifiedDate;
1539 private String _pathFriendlyURLPrivateGroup;
1540 private String _pathFriendlyURLPrivateUser;
1541 private String _pathFriendlyURLPublic;
1542 private String _pathMain;
1543 private long _plid;
1544 private String _portalURL;
1545 private PortletPreferencesIds _portletPreferencesIds;
1546 private String _remoteAddr;
1547 private String _remoteHost;
1548 private transient HttpServletRequest _request;
1549 private long _scopeGroupId;
1550 private boolean _signedIn;
1551 private TimeZone _timeZone;
1552 private String _userDisplayURL;
1553 private long _userId;
1554 private String _uuid;
1555 private int _workflowAction = WorkflowConstants.ACTION_PUBLISH;
1556
1557 }