001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.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.portlet.LiferayPortletRequest;
021    import com.liferay.portal.kernel.portlet.LiferayPortletResponse;
022    import com.liferay.portal.kernel.servlet.HttpHeaders;
023    import com.liferay.portal.kernel.util.Constants;
024    import com.liferay.portal.kernel.util.DateUtil;
025    import com.liferay.portal.kernel.util.JavaConstants;
026    import com.liferay.portal.kernel.util.LocaleUtil;
027    import com.liferay.portal.kernel.util.Validator;
028    import com.liferay.portal.kernel.util.WebKeys;
029    import com.liferay.portal.kernel.workflow.WorkflowConstants;
030    import com.liferay.portal.model.AuditedModel;
031    import com.liferay.portal.model.Group;
032    import com.liferay.portal.model.PortletConstants;
033    import com.liferay.portal.model.PortletPreferencesIds;
034    import com.liferay.portal.model.Role;
035    import com.liferay.portal.model.RoleConstants;
036    import com.liferay.portal.security.permission.ResourceActionsUtil;
037    import com.liferay.portal.theme.ThemeDisplay;
038    import com.liferay.portal.util.PortalUtil;
039    
040    import java.io.Serializable;
041    
042    import java.util.ArrayList;
043    import java.util.Date;
044    import java.util.LinkedHashMap;
045    import java.util.List;
046    import java.util.Locale;
047    import java.util.Map;
048    import java.util.TimeZone;
049    
050    import javax.servlet.http.HttpServletRequest;
051    import javax.servlet.http.HttpServletResponse;
052    
053    /**
054     * Contains context information about a given API call.
055     *
056     * <p>
057     * The <code>ServiceContext</code> object simplifies method signatures and
058     * provides a way to consolidate many different methods with different sets of
059     * optional parameters into a single, easier to use method. It also aggregates
060     * information necessary for transversal features such as permissioning,
061     * tagging, categorization, etc.
062     * </p>
063     *
064     * @author Raymond Aug??
065     * @author Brian Wing Shun Chan
066     * @author Jorge Ferrer
067     */
068    @JSON
069    public class ServiceContext implements Cloneable, Serializable {
070    
071            /**
072             * Creates a new service context object with an attributes map and an
073             * expando bridge attributes map. The attributes map contains standard
074             * service context parameters and the expando bridge attributes map contains
075             * optional service context parameters.
076             */
077            public ServiceContext() {
078                    _attributes = new LinkedHashMap<>();
079                    _expandoBridgeAttributes = new LinkedHashMap<>();
080            }
081    
082            /**
083             * Returns a new service context object identical to this service context
084             * object.
085             *
086             * @return a new service context object
087             */
088            @Override
089            public Object clone() {
090                    ServiceContext serviceContext = new ServiceContext();
091    
092                    serviceContext.setAddGroupPermissions(isAddGroupPermissions());
093                    serviceContext.setAddGuestPermissions(isAddGuestPermissions());
094                    serviceContext.setAssetCategoryIds(getAssetCategoryIds());
095                    serviceContext.setAssetEntryVisible(isAssetEntryVisible());
096                    serviceContext.setAssetLinkEntryIds(getAssetLinkEntryIds());
097                    serviceContext.setAssetTagNames(getAssetTagNames());
098                    serviceContext.setAttributes(getAttributes());
099                    serviceContext.setCommand(getCommand());
100                    serviceContext.setCompanyId(getCompanyId());
101                    serviceContext.setCreateDate(getCreateDate());
102                    serviceContext.setCurrentURL(getCurrentURL());
103                    serviceContext.setExpandoBridgeAttributes(getExpandoBridgeAttributes());
104                    serviceContext.setFailOnPortalException(isFailOnPortalException());
105                    serviceContext.setGroupPermissions(getGroupPermissions());
106                    serviceContext.setGuestPermissions(getGuestPermissions());
107                    serviceContext.setHeaders(getHeaders());
108                    serviceContext.setIndexingEnabled(isIndexingEnabled());
109                    serviceContext.setLanguageId(getLanguageId());
110                    serviceContext.setLayoutFullURL(getLayoutFullURL());
111                    serviceContext.setLayoutURL(getLayoutURL());
112                    serviceContext.setModifiedDate(getModifiedDate());
113                    serviceContext.setPathFriendlyURLPrivateGroup(
114                            getPathFriendlyURLPrivateGroup());
115                    serviceContext.setPathFriendlyURLPrivateUser(
116                            getPathFriendlyURLPrivateUser());
117                    serviceContext.setPathFriendlyURLPublic(getPathFriendlyURLPublic());
118                    serviceContext.setPathMain(getPathMain());
119                    serviceContext.setPlid(getPlid());
120                    serviceContext.setPortalURL(getPortalURL());
121                    serviceContext.setPortletPreferencesIds(getPortletPreferencesIds());
122                    serviceContext.setRemoteAddr(getRemoteAddr());
123                    serviceContext.setRemoteHost(getRemoteHost());
124                    serviceContext.setRequest(getRequest());
125                    serviceContext.setScopeGroupId(getScopeGroupId());
126                    serviceContext.setSignedIn(isSignedIn());
127                    serviceContext.setUserDisplayURL(getUserDisplayURL());
128                    serviceContext.setUserId(getUserId());
129                    serviceContext.setUuid(getUuid());
130                    serviceContext.setWorkflowAction(getWorkflowAction());
131    
132                    return serviceContext;
133            }
134    
135            /**
136             * Derive default permissions based on the logic found in
137             * portal-web/docroot/html/taglib/ui/input_permissions/page.jsp. Do not
138             * update this logic updating the logic in the JSP.
139             */
140            public void deriveDefaultPermissions(long repositoryId, String modelName)
141                    throws PortalException {
142    
143                    long siteGroupId = PortalUtil.getSiteGroupId(repositoryId);
144    
145                    Group siteGroup = GroupLocalServiceUtil.getGroup(siteGroupId);
146    
147                    Role defaultGroupRole = RoleLocalServiceUtil.getDefaultGroupRole(
148                            siteGroupId);
149    
150                    List<String> groupPermissions = new ArrayList<>();
151                    List<String> guestPermissions = new ArrayList<>();
152    
153                    String[] roleNames = {RoleConstants.GUEST, defaultGroupRole.getName()};
154    
155                    List<String> supportedActions =
156                            ResourceActionsUtil.getModelResourceActions(modelName);
157                    List<String> groupDefaultActions =
158                            ResourceActionsUtil.getModelResourceGroupDefaultActions(modelName);
159                    List<String> guestDefaultActions =
160                            ResourceActionsUtil.getModelResourceGuestDefaultActions(modelName);
161                    List<String> guestUnsupportedActions =
162                            ResourceActionsUtil.getModelResourceGuestUnsupportedActions(
163                                    modelName);
164    
165                    for (String roleName : roleNames) {
166                            for (String action : supportedActions) {
167                                    if (roleName.equals(RoleConstants.GUEST) &&
168                                            !guestUnsupportedActions.contains(action) &&
169                                            guestDefaultActions.contains(action) &&
170                                            siteGroup.hasPublicLayouts()) {
171    
172                                            guestPermissions.add(action);
173                                    }
174                                    else if (roleName.equals(defaultGroupRole.getName()) &&
175                                                     groupDefaultActions.contains(action)) {
176    
177                                            groupPermissions.add(action);
178                                    }
179                            }
180                    }
181    
182                    setGroupPermissions(
183                            groupPermissions.toArray(new String[groupPermissions.size()]));
184                    setGuestPermissions(
185                            guestPermissions.toArray(new String[guestPermissions.size()]));
186            }
187    
188            /**
189             * Returns <code>true</code> if this service context is being passed as a
190             * parameter to a method which manipulates a resource to which default group
191             * permissions apply.
192             *
193             * @return     <code>true</code> if this service context is being passed as
194             *             a parameter to a method which manipulates a resource to which
195             *             default community permissions apply; <code>false</code>
196             *             otherwise
197             * @deprecated As of 6.1.0, renamed to {@link #isAddGroupPermissions()}
198             */
199            @Deprecated
200            public boolean getAddCommunityPermissions() {
201                    return isAddGroupPermissions();
202            }
203    
204            /**
205             * Returns the asset category IDs to be applied to an asset entry if the
206             * service context is being passed as a parameter to a method which
207             * manipulates the asset entry.
208             *
209             * @return the asset category IDs
210             */
211            public long[] getAssetCategoryIds() {
212                    return _assetCategoryIds;
213            }
214    
215            /**
216             * Returns the primary keys of the asset entries linked to an asset entry if
217             * the service context is being passed as a parameter to a method which
218             * manipulates the asset entry.
219             *
220             * @return the primary keys of the asset entries
221             */
222            public long[] getAssetLinkEntryIds() {
223                    return _assetLinkEntryIds;
224            }
225    
226            /**
227             * Returns the asset tag names to be applied to an asset entry if the
228             * service context is being passed as a parameter to a method which
229             * manipulates the asset entry.
230             *
231             * @return the asset tag names
232             */
233            public String[] getAssetTagNames() {
234                    return _assetTagNames;
235            }
236    
237            /**
238             * Returns the serializable object associated with the name of the standard
239             * parameter of this service context.
240             *
241             * @param  name the name of the standard parameter
242             * @return the serializable object associated with the name
243             */
244            public Serializable getAttribute(String name) {
245                    return _attributes.get(name);
246            }
247    
248            /**
249             * Returns the map of name/value pairs that are the standard parameters of
250             * this service context. Each value is serializable.
251             *
252             * @return the map of name/value pairs
253             */
254            public Map<String, Serializable> getAttributes() {
255                    return _attributes;
256            }
257    
258            /**
259             * Returns the value of the {@link
260             * com.liferay.portal.kernel.util.Constants#CMD} parameter used in most
261             * Liferay forms for internal portlets.
262             *
263             * @return the value of the command parameter
264             */
265            public String getCommand() {
266                    return _command;
267            }
268    
269            /**
270             * Returns the specific community permissions for a resource if the service
271             * context is being passed as a parameter to a method which manipulates the
272             * resource.
273             *
274             * @return     the community permissions
275             * @deprecated As of 6.1.0, renamed to {@link #getGroupPermissions()}
276             */
277            @Deprecated
278            public String[] getCommunityPermissions() {
279                    return getGroupPermissions();
280            }
281    
282            /**
283             * Returns the company ID of this service context's current portal instance.
284             *
285             * @return the company ID
286             */
287            public long getCompanyId() {
288                    return _companyId;
289            }
290    
291            /**
292             * Returns the date when an entity was created if this service context is
293             * being passed as a parameter to a method which creates an entity.
294             *
295             * @return the creation date
296             */
297            public Date getCreateDate() {
298                    return _createDate;
299            }
300    
301            /**
302             * Returns the date when an entity was created (or a default date) if this
303             * service context is being passed as a parameter to a method which creates
304             * an entity.
305             *
306             * @param  defaultCreateDate an optional default create date to use if the
307             *         service context does not have a create date
308             * @return the creation date if available; the default date otherwise
309             */
310            public Date getCreateDate(Date defaultCreateDate) {
311                    if (_createDate != null) {
312                            return _createDate;
313                    }
314                    else if (defaultCreateDate != null) {
315                            return defaultCreateDate;
316                    }
317                    else {
318                            return new Date();
319                    }
320            }
321    
322            /**
323             * Returns the current URL of this service context
324             *
325             * @return the current URL
326             */
327            public String getCurrentURL() {
328                    return _currentURL;
329            }
330    
331            /**
332             * Returns an arbitrary number of attributes of an entity to be persisted.
333             *
334             * <p>
335             * These attributes only include fields that this service context does not
336             * possess by default.
337             * </p>
338             *
339             * @return the expando bridge attributes
340             */
341            public Map<String, Serializable> getExpandoBridgeAttributes() {
342                    return _expandoBridgeAttributes;
343            }
344    
345            /**
346             * Returns the date when an <code>aui:form</code> was generated in this
347             * service context. The form date can be used in detecting situations in
348             * which an entity has been modified while another client was editing that
349             * entity. </p>
350             *
351             * <p>
352             * Example:
353             * </p>
354             *
355             * <p>
356             * Person1 and person2 start editing the same version of a Web Content
357             * article. Person1 publishes changes to the article first. When person2
358             * attempts to publish changes to that article, the service implementation
359             * finds that a modification to that article has already been published some
360             * time after person2 started editing the article. Since the the article
361             * modification date was found to be later than the form date for person2,
362             * person2 could be alerted to the modification and make a backup copy of
363             * his edits before synchronizing with the published changes by person1.
364             * </p>
365             */
366            public Date getFormDate() {
367                    return _formDate;
368            }
369    
370            /**
371             * Returns the specific group permissions for a resource if this service
372             * context is being passed as a parameter to a method which manipulates the
373             * resource.
374             *
375             * @return the specific group permissions
376             */
377            public String[] getGroupPermissions() {
378                    return _groupPermissions;
379            }
380    
381            /**
382             * Returns this service context's user ID or guest ID if no user ID is
383             * available.
384             *
385             * @return the user ID, or guest ID if there is no user in this service
386             *         context, or <code>0</code> if there is no company in this service
387             *         context
388             * @throws PortalException if a default user for the company could not be
389             *         found
390             */
391            public long getGuestOrUserId() throws PortalException {
392                    long userId = getUserId();
393    
394                    if (userId > 0) {
395                            return userId;
396                    }
397    
398                    long companyId = getCompanyId();
399    
400                    if (companyId > 0) {
401                            return UserLocalServiceUtil.getDefaultUserId(getCompanyId());
402                    }
403    
404                    return 0;
405            }
406    
407            /**
408             * Returns the specific guest permissions for a resource if this service
409             * context is being passed as a parameter to a method which manipulates the
410             * resource.
411             *
412             * @return the specific guest permissions
413             */
414            public String[] getGuestPermissions() {
415                    return _guestPermissions;
416            }
417    
418            /**
419             * Returns the the map of request header name/value pairs of this service
420             * context.
421             *
422             * @return the the map of request header name/value pairs
423             * @see    com.liferay.portal.kernel.servlet.HttpHeaders
424             */
425            @JSON(include = false)
426            public Map<String, String> getHeaders() {
427                    return _headers;
428            }
429    
430            /**
431             * Returns the language ID of the locale of this service context's current
432             * user.
433             *
434             * @return the language ID
435             */
436            public String getLanguageId() {
437                    if (_languageId != null) {
438                            return _languageId;
439                    }
440    
441                    return LocaleUtil.toLanguageId(LocaleUtil.getMostRelevantLocale());
442            }
443    
444            /**
445             * Returns the complete URL of the current page if a page context can be
446             * determined for this service context.
447             *
448             * @return the complete URL of the current page
449             */
450            public String getLayoutFullURL() {
451                    return _layoutFullURL;
452            }
453    
454            /**
455             * Returns the relative URL of the current page if a page context can be
456             * determined for this service context.
457             *
458             * @return the relative URL of the current page
459             */
460            public String getLayoutURL() {
461                    return _layoutURL;
462            }
463    
464            @JSON(include = false)
465            public LiferayPortletRequest getLiferayPortletRequest() {
466                    if (_request == null) {
467                            return null;
468                    }
469    
470                    LiferayPortletRequest liferayPortletRequest =
471                            (LiferayPortletRequest)_request.getAttribute(
472                                    JavaConstants.JAVAX_PORTLET_REQUEST);
473    
474                    return liferayPortletRequest;
475            }
476    
477            @JSON(include = false)
478            public LiferayPortletResponse getLiferayPortletResponse() {
479                    if (_request == null) {
480                            return null;
481                    }
482    
483                    LiferayPortletResponse liferayPortletResponse =
484                            (LiferayPortletResponse)_request.getAttribute(
485                                    JavaConstants.JAVAX_PORTLET_RESPONSE);
486    
487                    return liferayPortletResponse;
488            }
489    
490            public Locale getLocale() {
491                    return LocaleUtil.fromLanguageId(_languageId);
492            }
493    
494            /**
495             * Returns the date when an entity was modified if this service context is
496             * being passed as a parameter to a method which updates an entity.
497             *
498             * @return the date when an entity was modified if this service context is
499             *         being passed as a parameter to a method which updates an entity
500             */
501            public Date getModifiedDate() {
502                    return _modifiedDate;
503            }
504    
505            /**
506             * Returns the date when an entity was modified if this service context is
507             * being passed as a parameter to a method which modifies an entity.
508             *
509             * @param  defaultModifiedDate an optional default modified date to use if
510             *         this service context does not have a modified date
511             * @return the modified date if available; the default date otherwise
512             */
513            public Date getModifiedDate(Date defaultModifiedDate) {
514                    if (_modifiedDate != null) {
515                            return _modifiedDate;
516                    }
517                    else if (defaultModifiedDate != null) {
518                            return defaultModifiedDate;
519                    }
520                    else {
521                            return new Date();
522                    }
523            }
524    
525            public String getPathFriendlyURLPrivateGroup() {
526                    return _pathFriendlyURLPrivateGroup;
527            }
528    
529            public String getPathFriendlyURLPrivateUser() {
530                    return _pathFriendlyURLPrivateUser;
531            }
532    
533            public String getPathFriendlyURLPublic() {
534                    return _pathFriendlyURLPublic;
535            }
536    
537            /**
538             * Returns the main context path of the portal, concatenated with
539             * <code>/c</code>.
540             *
541             * @return the main context path of the portal
542             */
543            public String getPathMain() {
544                    return _pathMain;
545            }
546    
547            /**
548             * Returns the portal layout ID of the current page of this service context.
549             *
550             * @return the portal layout ID of the current page
551             */
552            public long getPlid() {
553                    return _plid;
554            }
555    
556            /**
557             * Returns the URL of this service context's portal, including the protocol,
558             * domain, and non-default port relative to the company instance and any
559             * virtual host.
560             *
561             * <p>
562             * The URL returned does not include the port if a default port is used.
563             * </p>
564             *
565             * @return the URL of this service context's portal, including the protocol,
566             *         domain, and non-default port relative to company instance and any
567             *         virtual host
568             */
569            public String getPortalURL() {
570                    return _portalURL;
571            }
572    
573            /**
574             * Returns the ID of the current portlet if this service context is being
575             * passed as a parameter to a portlet.
576             *
577             * @return the ID of the current portlet
578             * @see    com.liferay.portal.model.PortletPreferencesIds
579             */
580            public String getPortletId() {
581                    if (_portletPreferencesIds == null) {
582                            return null;
583                    }
584    
585                    return _portletPreferencesIds.getPortletId();
586            }
587    
588            /**
589             * Returns the portlet preferences IDs of the current portlet if the service
590             * context is being passed as a parameter to a portlet.
591             *
592             * <p>
593             * The {@link com.liferay.portal.model.PortletPreferencesIds} can be used to
594             * look up portlet preferences of the current portlet.
595             * </p>
596             *
597             * @return the portlet preferences IDs of the current portlet
598             * @see    com.liferay.portal.model.PortletPreferencesIds
599             */
600            public PortletPreferencesIds getPortletPreferencesIds() {
601                    return _portletPreferencesIds;
602            }
603    
604            /**
605             * Returns the remote address of the user making the request in this service
606             * context.
607             *
608             * @return the remote address of the user making the request
609             */
610            public String getRemoteAddr() {
611                    return _remoteAddr;
612            }
613    
614            /**
615             * Returns the remote host name of the user making the request in this
616             * service context.
617             *
618             * @return the remote host name of the user making the request
619             */
620            public String getRemoteHost() {
621                    return _remoteHost;
622            }
623    
624            @JSON(include = false)
625            public HttpServletRequest getRequest() {
626                    return _request;
627            }
628    
629            @JSON(include = false)
630            public HttpServletResponse getResponse() {
631                    LiferayPortletResponse liferayPortletResponse =
632                            getLiferayPortletResponse();
633    
634                    if (liferayPortletResponse == null) {
635                            return null;
636                    }
637    
638                    return PortalUtil.getHttpServletResponse(liferayPortletResponse);
639            }
640    
641            public String getRootPortletId() {
642                    String portletId = getPortletId();
643    
644                    if (portletId == null) {
645                            return null;
646                    }
647    
648                    return PortletConstants.getRootPortletId(portletId);
649            }
650    
651            public Group getScopeGroup() throws PortalException {
652                    return GroupLocalServiceUtil.getGroup(_scopeGroupId);
653            }
654    
655            /**
656             * Returns the ID of the group corresponding to the current data scope of
657             * this service context.
658             *
659             * @return the ID of the group corresponding to the current data scope
660             * @see    com.liferay.portal.model.Group
661             */
662            public long getScopeGroupId() {
663                    return _scopeGroupId;
664            }
665    
666            public ThemeDisplay getThemeDisplay() {
667                    if (_request == null) {
668                            return null;
669                    }
670    
671                    return (ThemeDisplay)_request.getAttribute(WebKeys.THEME_DISPLAY);
672            }
673    
674            public TimeZone getTimeZone() {
675                    return _timeZone;
676            }
677    
678            /**
679             * Returns the user-agent request header of this service context.
680             *
681             * @return the user-agent request header
682             * @see    com.liferay.portal.kernel.servlet.HttpHeaders
683             */
684            public String getUserAgent() {
685                    if (_request == null) {
686                            return null;
687                    }
688    
689                    return _request.getHeader(HttpHeaders.USER_AGENT);
690            }
691    
692            /**
693             * Returns the complete URL of this service context's current user's profile
694             * page.
695             *
696             * @return the complete URL of this service context's current user's profile
697             *         page
698             */
699            public String getUserDisplayURL() {
700                    return _userDisplayURL;
701            }
702    
703            /**
704             * Returns the ID of this service context's current user.
705             *
706             * @return the ID of this service context's current user
707             */
708            public long getUserId() {
709                    return _userId;
710            }
711    
712            /**
713             * Returns the UUID of this service context's current entity.
714             *
715             * @return the UUID of this service context's current entity
716             */
717            public String getUuid() {
718                    String uuid = _uuid;
719    
720                    _uuid = null;
721    
722                    return uuid;
723            }
724    
725            public String getUuidWithoutReset() {
726                    return _uuid;
727            }
728    
729            /**
730             * Returns the workflow action to take if this service context is being
731             * passed as a parameter to a method that processes a workflow action.
732             *
733             * @return the workflow action to take
734             */
735            public int getWorkflowAction() {
736                    return _workflowAction;
737            }
738    
739            /**
740             * Returns <code>true</code> if this service context is being passed as a
741             * parameter to a method which manipulates a resource to which default group
742             * permissions apply.
743             *
744             * @return <code>true</code> if this service context is being passed as a
745             *         parameter to a method which manipulates a resource to which
746             *         default group permissions apply; <code>false</code> otherwise
747             */
748            public boolean isAddGroupPermissions() {
749                    return _addGroupPermissions;
750            }
751    
752            /**
753             * Returns <code>true</code> if this service context is being passed as a
754             * parameter to a method which manipulates a resource to which default guest
755             * permissions apply.
756             *
757             * @return <code>true</code> if this service context is being passed as a
758             *         parameter to a method which manipulates a resource to which
759             *         default guest permissions apply; <code>false</code> otherwise
760             */
761            public boolean isAddGuestPermissions() {
762                    return _addGuestPermissions;
763            }
764    
765            public boolean isAssetEntryVisible() {
766                    return _assetEntryVisible;
767            }
768    
769            /**
770             * Returns <code>true</code> if this service context contains an add command
771             * (i.e. has command value {@link
772             * com.liferay.portal.kernel.util.Constants#ADD})
773             *
774             * @return <code>true</code> if this service context contains an add
775             *         command; <code>false</code> otherwise
776             */
777            public boolean isCommandAdd() {
778                    if (Validator.equals(_command, Constants.ADD) ||
779                            Validator.equals(_command, Constants.ADD_DYNAMIC) ||
780                            Validator.equals(_command, Constants.ADD_MULTIPLE) ||
781                            Validator.equals(_command, Constants.ADD_WEBDAV)) {
782    
783                            return true;
784                    }
785                    else {
786                            return false;
787                    }
788            }
789    
790            /**
791             * Returns <code>true</code> if this service context contains an update
792             * command (i.e. has command value {@link
793             * com.liferay.portal.kernel.util.Constants#UPDATE})
794             *
795             * @return <code>true</code> if this service context contains an update
796             *         command; <code>false</code> otherwise
797             */
798            public boolean isCommandUpdate() {
799                    if (Validator.equals(_command, Constants.UPDATE) ||
800                            Validator.equals(_command, Constants.UPDATE_WEBDAV)) {
801    
802                            return true;
803                    }
804                    else {
805                            return false;
806                    }
807            }
808    
809            public boolean isDeriveDefaultPermissions() {
810                    return _deriveDefaultPermissions;
811            }
812    
813            /**
814             * Returns <code>true</code> if portal exceptions should be handled as
815             * failures, possibly halting processing, or <code>false</code> if the
816             * exceptions should be handled differently, possibly allowing processing to
817             * continue in some manner. Services may check this flag to execute desired
818             * behavior.
819             *
820             * <p>
821             * Batch invocation of such services (exposed as a JSON web services) can
822             * result in execution of all service invocations, in spite of portal
823             * exceptions.
824             * </p>
825             *
826             * <p>
827             * If this flag is set to <code>false</code>, services can implement logic
828             * that allows processing to continue, while collecting information
829             * regarding the exceptions for returning to the caller. For example, the
830             * {@link
831             * com.liferay.portlet.asset.service.impl.AssetVocabularyServiceImpl#deleteVocabularies(
832             * long[], ServiceContext)} method uses the list it returns to give
833             * information on vocabularies it fails to delete; it returns an empty list
834             * if all deletions are successful.
835             * </p>
836             *
837             * @return <code>true</code> if portal exceptions are to be handled as
838             *         failures; <code>false</code> if portal exceptions can be handled
839             *         differently, possibly allowing processing to continue in some
840             *         manner
841             */
842            public boolean isFailOnPortalException() {
843                    return _failOnPortalException;
844            }
845    
846            /**
847             * Returns whether the primary entity of this service context is to be
848             * indexed/re-indexed.
849             *
850             * @return <code>true</code> the primary entity of this service context is
851             *         to be indexed/re-indexed; <code>false</code> otherwise
852             */
853            public boolean isIndexingEnabled() {
854                    return _indexingEnabled;
855            }
856    
857            /**
858             * Returns <code>true</code> if the sender of this service context's request
859             * is signed in.
860             *
861             * @return <code>true</code> if the sender of this service context's request
862             *         is signed in; <code>false</code> otherwise
863             */
864            public boolean isSignedIn() {
865                    return _signedIn;
866            }
867    
868            public void merge(ServiceContext serviceContext) {
869                    setAddGroupPermissions(serviceContext.isAddGroupPermissions());
870                    setAddGuestPermissions(serviceContext.isAddGuestPermissions());
871    
872                    if (serviceContext.getAssetCategoryIds() != null) {
873                            setAssetCategoryIds(serviceContext.getAssetCategoryIds());
874                    }
875    
876                    setAssetEntryVisible(serviceContext.isAssetEntryVisible());
877    
878                    if (serviceContext.getAssetLinkEntryIds() != null) {
879                            setAssetLinkEntryIds(serviceContext.getAssetLinkEntryIds());
880                    }
881    
882                    if (serviceContext.getAssetTagNames() != null) {
883                            setAssetTagNames(serviceContext.getAssetTagNames());
884                    }
885    
886                    if (serviceContext.getAttributes() != null) {
887                            setAttributes(serviceContext.getAttributes());
888                    }
889    
890                    if (Validator.isNotNull(serviceContext.getCommand())) {
891                            setCommand(serviceContext.getCommand());
892                    }
893    
894                    if (serviceContext.getCompanyId() > 0) {
895                            setCompanyId(serviceContext.getCompanyId());
896                    }
897    
898                    if (serviceContext.getCreateDate() != null) {
899                            setCreateDate(serviceContext.getCreateDate());
900                    }
901    
902                    if (Validator.isNotNull(serviceContext.getCurrentURL())) {
903                            setCurrentURL(serviceContext.getCurrentURL());
904                    }
905    
906                    setDeriveDefaultPermissions(
907                            serviceContext.isDeriveDefaultPermissions());
908    
909                    if (serviceContext.getExpandoBridgeAttributes() != null) {
910                            setExpandoBridgeAttributes(
911                                    serviceContext.getExpandoBridgeAttributes());
912                    }
913    
914                    setFailOnPortalException(serviceContext.isFailOnPortalException());
915    
916                    if (serviceContext.getGroupPermissions() != null) {
917                            setGroupPermissions(serviceContext.getGroupPermissions());
918                    }
919    
920                    if (serviceContext.getGuestPermissions() != null) {
921                            setGuestPermissions(serviceContext.getGuestPermissions());
922                    }
923    
924                    if (serviceContext.getHeaders() != null) {
925                            setHeaders(serviceContext.getHeaders());
926                    }
927    
928                    setIndexingEnabled(serviceContext.isIndexingEnabled());
929                    setLanguageId(serviceContext.getLanguageId());
930    
931                    if (Validator.isNotNull(serviceContext.getLayoutFullURL())) {
932                            setLayoutFullURL(serviceContext.getLayoutFullURL());
933                    }
934    
935                    if (Validator.isNotNull(serviceContext.getLayoutURL())) {
936                            setLayoutURL(serviceContext.getLayoutURL());
937                    }
938    
939                    if (serviceContext.getModifiedDate() != null) {
940                            setModifiedDate(serviceContext.getModifiedDate());
941                    }
942    
943                    if (Validator.isNotNull(
944                                    serviceContext.getPathFriendlyURLPrivateGroup())) {
945    
946                            setPathFriendlyURLPrivateGroup(
947                                    serviceContext.getPathFriendlyURLPrivateGroup());
948                    }
949    
950                    if (Validator.isNotNull(
951                                    serviceContext.getPathFriendlyURLPrivateUser())) {
952    
953                            setPathFriendlyURLPrivateUser(
954                                    serviceContext.getPathFriendlyURLPrivateUser());
955                    }
956    
957                    if (Validator.isNotNull(serviceContext.getPathFriendlyURLPublic())) {
958                            setPathFriendlyURLPublic(serviceContext.getPathFriendlyURLPublic());
959                    }
960    
961                    if (Validator.isNotNull(serviceContext.getPathMain())) {
962                            setPathMain(serviceContext.getPathMain());
963                    }
964    
965                    if (serviceContext.getPlid() > 0) {
966                            setPlid(serviceContext.getPlid());
967                    }
968    
969                    if (Validator.isNotNull(serviceContext.getPortalURL())) {
970                            setPortalURL(serviceContext.getPortalURL());
971                    }
972    
973                    if (serviceContext.getPortletPreferencesIds() != null) {
974                            setPortletPreferencesIds(serviceContext.getPortletPreferencesIds());
975                    }
976    
977                    if (Validator.isNotNull(serviceContext.getRemoteAddr())) {
978                            setRemoteAddr(serviceContext.getRemoteAddr());
979                    }
980    
981                    if (Validator.isNotNull(serviceContext.getRemoteHost())) {
982                            setRemoteHost(serviceContext.getRemoteHost());
983                    }
984    
985                    if (serviceContext.getScopeGroupId() > 0) {
986                            setScopeGroupId(serviceContext.getScopeGroupId());
987                    }
988    
989                    setSignedIn(serviceContext.isSignedIn());
990    
991                    if (serviceContext.getTimeZone() != null) {
992                            setTimeZone(serviceContext.getTimeZone());
993                    }
994    
995                    if (Validator.isNotNull(serviceContext.getUserDisplayURL())) {
996                            setUserDisplayURL(serviceContext.getUserDisplayURL());
997                    }
998    
999                    if (serviceContext.getUserId() > 0) {
1000                            setUserId(serviceContext.getUserId());
1001                    }
1002    
1003                    // Refrence serviceContext#_uuid directly because calling
1004                    // serviceContext#getUuid() would set it to null
1005    
1006                    if (Validator.isNotNull(serviceContext._uuid)) {
1007                            setUuid(serviceContext._uuid);
1008                    }
1009    
1010                    if (serviceContext.getWorkflowAction() > 0) {
1011                            setWorkflowAction(serviceContext.getWorkflowAction());
1012                    }
1013            }
1014    
1015            /**
1016             * Removes the mapping of the serializable object to the name of the
1017             * standard parameter of this service context.
1018             *
1019             * @param  name the name of the standard parameter
1020             * @return the serializable object associated to the name
1021             */
1022            public Serializable removeAttribute(String name) {
1023                    return _attributes.remove(name);
1024            }
1025    
1026            /**
1027             * Sets whether or not default community permissions should apply to a
1028             * resource being manipulated by a method to which this service context is
1029             * passed as a parameter.
1030             *
1031             * @param      addCommunityPermissions indicates whether or not to apply
1032             *             default community permissions
1033             * @deprecated As of 6.1.0, renamed to {@link
1034             *             #setAddGroupPermissions(boolean)}
1035             */
1036            @Deprecated
1037            public void setAddCommunityPermissions(boolean addCommunityPermissions) {
1038                    setAddGroupPermissions(addCommunityPermissions);
1039            }
1040    
1041            /**
1042             * Sets whether or not default group permissions should apply to a resource
1043             * being manipulated by a method to which this service context is passed as
1044             * a parameter.
1045             *
1046             * @param addGroupPermissions indicates whether or not to apply default
1047             *        group permissions
1048             */
1049            public void setAddGroupPermissions(boolean addGroupPermissions) {
1050                    _addGroupPermissions = addGroupPermissions;
1051            }
1052    
1053            /**
1054             * Sets whether or not default guest permissions should apply to a resource
1055             * being manipulated by a method to which this service context is passed as
1056             * a parameter.
1057             *
1058             * @param addGuestPermissions indicates whether or not to apply default
1059             *        guest permissions
1060             */
1061            public void setAddGuestPermissions(boolean addGuestPermissions) {
1062                    _addGuestPermissions = addGuestPermissions;
1063            }
1064    
1065            /**
1066             * Sets an array of asset category IDs to be applied to an asset entry if
1067             * this service context is being passed as a parameter to a method which
1068             * manipulates the asset entry.
1069             *
1070             * @param assetCategoryIds the primary keys of the asset categories
1071             */
1072            public void setAssetCategoryIds(long[] assetCategoryIds) {
1073                    _assetCategoryIds = assetCategoryIds;
1074            }
1075    
1076            public void setAssetEntryVisible(boolean assetEntryVisible) {
1077                    _assetEntryVisible = assetEntryVisible;
1078            }
1079    
1080            /**
1081             * Sets an array of the primary keys of asset entries to be linked to an
1082             * asset entry if this service context is being passed as a parameter to a
1083             * method which manipulates the asset entry.
1084             *
1085             * @param assetLinkEntryIds the primary keys of the asset entries to be
1086             *        linked to an asset entry
1087             */
1088            public void setAssetLinkEntryIds(long[] assetLinkEntryIds) {
1089                    _assetLinkEntryIds = assetLinkEntryIds;
1090            }
1091    
1092            /**
1093             * Sets an array of asset tag names to be applied to an asset entry if this
1094             * service context is being passed as a parameter to a method which
1095             * manipulates the asset entry.
1096             *
1097             * @param assetTagNames the tag names to be applied to an asset entry
1098             */
1099            public void setAssetTagNames(String[] assetTagNames) {
1100                    _assetTagNames = assetTagNames;
1101            }
1102    
1103            /**
1104             * Sets a mapping of a standard parameter's name to its serializable object.
1105             *
1106             * @param name the standard parameter name to associate with the value
1107             * @param value the serializable object to be associated with the name
1108             */
1109            public void setAttribute(String name, Serializable value) {
1110                    _attributes.put(name, value);
1111            }
1112    
1113            /**
1114             * Sets the map of the name/value pairs that are the standard parameters of
1115             * this service context. Each value must be serializable.
1116             *
1117             * @param attributes the map of the name/value pairs that are the standard
1118             *        parameters of this service context
1119             */
1120            public void setAttributes(Map<String, Serializable> attributes) {
1121                    _attributes = attributes;
1122            }
1123    
1124            /**
1125             * Sets the value of the {@link
1126             * com.liferay.portal.kernel.util.Constants#CMD} parameter used in most
1127             * Liferay forms for internal portlets.
1128             *
1129             * @param command the value of the {@link
1130             *        com.liferay.portal.kernel.util.Constants#CMD} parameter
1131             */
1132            public void setCommand(String command) {
1133                    _command = command;
1134            }
1135    
1136            /**
1137             * Sets an array containing specific community permissions for a resource if
1138             * this service context is being passed as a parameter to a method which
1139             * manipulates the resource.
1140             *
1141             * @param      communityPermissions the community permissions (optionally
1142             *             <code>null</code>)
1143             * @deprecated As of 6.1.0, renamed to {@link
1144             *             #setGroupPermissions(String[])}
1145             */
1146            @Deprecated
1147            public void setCommunityPermissions(String[] communityPermissions) {
1148                    setGroupPermissions(communityPermissions);
1149            }
1150    
1151            /**
1152             * Sets the company ID of this service context's current portal instance.
1153             *
1154             * @param companyId the primary key of this service context's current portal
1155             *        instance
1156             */
1157            public void setCompanyId(long companyId) {
1158                    _companyId = companyId;
1159            }
1160    
1161            /**
1162             * Sets the date when an entity was created if this service context is being
1163             * passed as a parameter to a method which creates an entity.
1164             *
1165             * @param createDate the date the entity was created
1166             */
1167            public void setCreateDate(Date createDate) {
1168                    _createDate = createDate;
1169            }
1170    
1171            /**
1172             * Sets the current URL of this service context
1173             *
1174             * @param currentURL the current URL of this service context
1175             */
1176            public void setCurrentURL(String currentURL) {
1177                    _currentURL = currentURL;
1178            }
1179    
1180            public void setDeriveDefaultPermissions(boolean deriveDefaultPermissions) {
1181                    _deriveDefaultPermissions = deriveDefaultPermissions;
1182            }
1183    
1184            /**
1185             * Sets an arbitrary number of attributes of an entity to be persisted.
1186             *
1187             * <p>
1188             * These attributes should only include fields that {@link
1189             * com.liferay.portal.service.ServiceContext} does not possess by default.
1190             * </p>
1191             *
1192             * @param expandoBridgeAttributes the expando bridge attributes (optionally
1193             *        <code>null</code>)
1194             */
1195            public void setExpandoBridgeAttributes(
1196                    Map<String, Serializable> expandoBridgeAttributes) {
1197    
1198                    _expandoBridgeAttributes = expandoBridgeAttributes;
1199            }
1200    
1201            /**
1202             * Sets whether portal exceptions should be handled as failures, possibly
1203             * halting processing, or if exceptions should be handled differently,
1204             * possibly allowing processing to continue in some manner.
1205             *
1206             * @param failOnPortalException whether portal exceptions should be handled
1207             *        as failures, or if portal exceptions should be handled
1208             *        differently, possibly allowing processing to continue in some
1209             *        manner
1210             * @see   #isFailOnPortalException()
1211             */
1212            public void setFailOnPortalException(boolean failOnPortalException) {
1213                    _failOnPortalException = failOnPortalException;
1214            }
1215    
1216            /**
1217             * Sets the date when an <code>aui:form</code> was generated in this service
1218             * context. The form date can be used in detecting situations in which an
1219             * entity has been modified while another client was editing that entity.
1220             *
1221             * <p>
1222             * Example:
1223             * </p>
1224             *
1225             * <p>
1226             * Person1 and person2 start editing the same version of a Web Content
1227             * article. Person1 publishes changes to the article first. When person2
1228             * attempts to publish changes to that article, the service implementation
1229             * finds that a modification to that article has already been published some
1230             * time after person2 started editing the article. Since the article
1231             * modification date was found to be later than the form date for person2,
1232             * person2 could be alerted to the modification and make a backup copy of
1233             * his edits before synchronizing with the published changes by person1.
1234             * </p>
1235             *
1236             * @param formDate the date that an <code>aui:form</code> was generated for
1237             *        this service context (optionally <code>null</code>)
1238             */
1239            public void setFormDate(Date formDate) {
1240                    _formDate = formDate;
1241            }
1242    
1243            /**
1244             * Sets an array containing specific group permissions for a resource if
1245             * this service context is being passed as a parameter to a method which
1246             * manipulates the resource.
1247             *
1248             * @param groupPermissions the permissions (optionally <code>null</code>)
1249             */
1250            public void setGroupPermissions(String[] groupPermissions) {
1251                    _groupPermissions = groupPermissions;
1252            }
1253    
1254            /**
1255             * Sets an array containing specific guest permissions for a resource if
1256             * this service context is being passed as a parameter to a method which
1257             * manipulates the resource.
1258             *
1259             * @param guestPermissions the guest permissions (optionally
1260             *        <code>null</code>)
1261             */
1262            public void setGuestPermissions(String[] guestPermissions) {
1263                    _guestPermissions = guestPermissions;
1264            }
1265    
1266            /**
1267             * Sets the map of request header name/value pairs of this service context.
1268             *
1269             * @param headers map of request header name/value pairs of this service
1270             *        context
1271             * @see   com.liferay.portal.kernel.servlet.HttpHeaders
1272             */
1273            public void setHeaders(Map<String, String> headers) {
1274                    _headers = headers;
1275            }
1276    
1277            /**
1278             * Sets whether the primary entity of this service context is to be
1279             * indexed/re-indexed.
1280             *
1281             * <p>
1282             * The entity is only indexed/re-indexed if the method receiving this
1283             * service context as a parameter does indexing.
1284             * </p>
1285             *
1286             * @param indexingEnabled whether the primary entity of this service context
1287             *        is to be indexed/re-indexed (default is <code>true</code>)
1288             */
1289            public void setIndexingEnabled(boolean indexingEnabled) {
1290                    _indexingEnabled = indexingEnabled;
1291            }
1292    
1293            /**
1294             * Sets the language ID of the locale of this service context.
1295             *
1296             * @param languageId the language ID of the locale of this service context's
1297             *        current user
1298             */
1299            public void setLanguageId(String languageId) {
1300                    _languageId = languageId;
1301            }
1302    
1303            /**
1304             * Sets the complete URL of the current page for this service context.
1305             *
1306             * @param layoutFullURL the complete URL of the current page if a page
1307             *        context can be determined for this service context
1308             */
1309            public void setLayoutFullURL(String layoutFullURL) {
1310                    _layoutFullURL = layoutFullURL;
1311            }
1312    
1313            /**
1314             * Sets the relative URL of the current page for this service context.
1315             *
1316             * @param layoutURL the relative URL of the current page if a page context
1317             *        can be determined for this service context
1318             */
1319            public void setLayoutURL(String layoutURL) {
1320                    _layoutURL = layoutURL;
1321            }
1322    
1323            /**
1324             * Sets the date when an entity was modified in this service context.
1325             *
1326             * @param modifiedDate the date when an entity was modified in this service
1327             *        context
1328             */
1329            public void setModifiedDate(Date modifiedDate) {
1330                    _modifiedDate = modifiedDate;
1331            }
1332    
1333            public void setPathFriendlyURLPrivateGroup(
1334                    String pathFriendlyURLPrivateGroup) {
1335    
1336                    _pathFriendlyURLPrivateGroup = pathFriendlyURLPrivateGroup;
1337            }
1338    
1339            public void setPathFriendlyURLPrivateUser(
1340                    String pathFriendlyURLPrivateUser) {
1341    
1342                    _pathFriendlyURLPrivateUser = pathFriendlyURLPrivateUser;
1343            }
1344    
1345            public void setPathFriendlyURLPublic(String pathFriendlyURLPublic) {
1346                    _pathFriendlyURLPublic = pathFriendlyURLPublic;
1347            }
1348    
1349            /**
1350             * Sets the main context path of the portal, concatenated with
1351             * <code>/c</code>.
1352             *
1353             * @param pathMain the main context path of the portal
1354             */
1355            public void setPathMain(String pathMain) {
1356                    _pathMain = pathMain;
1357            }
1358    
1359            /**
1360             * Sets the portal layout ID of the current page in this service context.
1361             *
1362             * @param plid the portal layout ID of the current page
1363             */
1364            public void setPlid(long plid) {
1365                    _plid = plid;
1366            }
1367    
1368            /**
1369             * Sets the URL of this service context's portal, including the protocol,
1370             * domain, and non-default port relative to the company instance and any
1371             * virtual host.
1372             *
1373             * <p>
1374             * The URL should not include the port if a default port is used.
1375             * </p>
1376             *
1377             * @param portalURL the portal URL
1378             */
1379            public void setPortalURL(String portalURL) {
1380                    _portalURL = portalURL;
1381            }
1382    
1383            /**
1384             * Sets the portlet preferences IDs of the current portlet if this service
1385             * context is being passed as a parameter to a portlet.
1386             *
1387             * <p>
1388             * The {@link com.liferay.portal.model.PortletPreferencesIds} can be used to
1389             * look up portlet preferences of the current portlet.
1390             * </p>
1391             *
1392             * @param portletPreferencesIds the portlet preferences
1393             * @see   com.liferay.portal.model.PortletPreferencesIds
1394             */
1395            public void setPortletPreferencesIds(
1396                    PortletPreferencesIds portletPreferencesIds) {
1397    
1398                    _portletPreferencesIds = portletPreferencesIds;
1399            }
1400    
1401            /**
1402             * Sets the remote address of the user making the request in this service
1403             * context.
1404             *
1405             * @param remoteAddr the remote address of the user making the request in
1406             *        this service context
1407             */
1408            public void setRemoteAddr(String remoteAddr) {
1409                    _remoteAddr = remoteAddr;
1410            }
1411    
1412            /**
1413             * Sets the remote host name of the user making the request in this service
1414             * context.
1415             *
1416             * @param remoteHost the remote host name of the user making the request in
1417             *        this service context
1418             */
1419            public void setRemoteHost(String remoteHost) {
1420                    _remoteHost = remoteHost;
1421            }
1422    
1423            /**
1424             * Sets the optional request used when instantiating this service context.
1425             * The field is volatile and so will be discarded on serialization.
1426             *
1427             * @param request the request
1428             */
1429            public void setRequest(HttpServletRequest request) {
1430                    _request = request;
1431            }
1432    
1433            /**
1434             * Sets the ID of the group corresponding to the current data scope of this
1435             * service context.
1436             *
1437             * @param scopeGroupId the ID of the group corresponding to the current data
1438             *        scope of this service context
1439             * @see   com.liferay.portal.model.Group
1440             */
1441            public void setScopeGroupId(long scopeGroupId) {
1442                    _scopeGroupId = scopeGroupId;
1443            }
1444    
1445            /**
1446             * Sets whether the sender of this service context's request is signed in.
1447             *
1448             * @param signedIn whether the sender of this service context's request is
1449             *        signed in
1450             */
1451            public void setSignedIn(boolean signedIn) {
1452                    _signedIn = signedIn;
1453            }
1454    
1455            public void setTimeZone(TimeZone timeZone) {
1456                    _timeZone = timeZone;
1457            }
1458    
1459            /**
1460             * Sets the complete URL of this service context's current user's profile
1461             * page.
1462             *
1463             * @param userDisplayURL the complete URL of the current user's profile page
1464             */
1465            public void setUserDisplayURL(String userDisplayURL) {
1466                    _userDisplayURL = userDisplayURL;
1467            }
1468    
1469            /**
1470             * Sets the ID of this service context's current user.
1471             *
1472             * @param userId the ID of the current user
1473             */
1474            public void setUserId(long userId) {
1475                    _userId = userId;
1476            }
1477    
1478            /**
1479             * Sets the UUID of this service context's current entity.
1480             *
1481             * @param uuid the UUID of the current entity
1482             */
1483            public void setUuid(String uuid) {
1484                    _uuid = uuid;
1485            }
1486    
1487            /**
1488             * Sets the workflow action to take if this service context is being passed
1489             * as parameter to a method that processes a workflow action.
1490             *
1491             * @param workflowAction workflow action to take (default is {@link
1492             *        com.liferay.portal.kernel.workflow.WorkflowConstants#ACTION_PUBLISH})
1493             */
1494            public void setWorkflowAction(int workflowAction) {
1495                    _workflowAction = workflowAction;
1496            }
1497    
1498            public String translate(String pattern, Object... arguments) {
1499                    Locale locale = getLocale();
1500    
1501                    return LanguageUtil.format(locale, pattern, arguments);
1502            }
1503    
1504            public void validateModifiedDate(
1505                            AuditedModel auditedModel, Class<? extends PortalException> clazz)
1506                    throws PortalException {
1507    
1508                    int value = DateUtil.compareTo(
1509                            auditedModel.getModifiedDate(), _formDate);
1510    
1511                    if (value > 0) {
1512                            try {
1513                                    throw clazz.newInstance();
1514                            }
1515                            catch (IllegalAccessException iae) {
1516                                    throw new RuntimeException(iae);
1517                            }
1518                            catch (InstantiationException ie) {
1519                                    throw new RuntimeException(ie);
1520                            }
1521                    }
1522            }
1523    
1524            private boolean _addGroupPermissions;
1525            private boolean _addGuestPermissions;
1526            private long[] _assetCategoryIds;
1527            private boolean _assetEntryVisible = true;
1528            private long[] _assetLinkEntryIds;
1529            private String[] _assetTagNames;
1530            private Map<String, Serializable> _attributes;
1531            private String _command;
1532            private long _companyId;
1533            private Date _createDate;
1534            private String _currentURL;
1535            private boolean _deriveDefaultPermissions;
1536            private Map<String, Serializable> _expandoBridgeAttributes;
1537            private boolean _failOnPortalException = true;
1538            private Date _formDate;
1539            private String[] _groupPermissions;
1540            private String[] _guestPermissions;
1541            private transient Map<String, String> _headers;
1542            private boolean _indexingEnabled = true;
1543            private String _languageId;
1544            private String _layoutFullURL;
1545            private String _layoutURL;
1546            private Date _modifiedDate;
1547            private String _pathFriendlyURLPrivateGroup;
1548            private String _pathFriendlyURLPrivateUser;
1549            private String _pathFriendlyURLPublic;
1550            private String _pathMain;
1551            private long _plid;
1552            private String _portalURL;
1553            private PortletPreferencesIds _portletPreferencesIds;
1554            private String _remoteAddr;
1555            private String _remoteHost;
1556            private transient HttpServletRequest _request;
1557            private long _scopeGroupId;
1558            private boolean _signedIn;
1559            private TimeZone _timeZone;
1560            private String _userDisplayURL;
1561            private long _userId;
1562            private String _uuid;
1563            private int _workflowAction = WorkflowConstants.ACTION_PUBLISH;
1564    
1565    }