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.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    /**
056     * Contains context information about a given API call.
057     *
058     * <p>
059     * The <code>ServiceContext</code> object simplifies method signatures and
060     * provides a way to consolidate many different methods with different sets of
061     * optional parameters into a single, easier to use method. It also aggregates
062     * information necessary for transversal features such as permissioning,
063     * tagging, categorization, etc.
064     * </p>
065     *
066     * @author Raymond Aug??
067     * @author Brian Wing Shun Chan
068     * @author Jorge Ferrer
069     */
070    @JSON
071    public class ServiceContext implements Cloneable, Serializable {
072    
073            /**
074             * Creates a new service context object with an attributes map and an
075             * expando bridge attributes map. The attributes map contains standard
076             * service context parameters and the expando bridge attributes map contains
077             * optional service context parameters.
078             */
079            public ServiceContext() {
080                    _attributes = new LinkedHashMap<>();
081                    _expandoBridgeAttributes = new LinkedHashMap<>();
082            }
083    
084            /**
085             * Returns a new service context object identical to this service context
086             * object.
087             *
088             * @return a new service context object
089             */
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            /**
141             * Derive default permissions based on the logic found in
142             * portal-web/docroot/html/taglib/ui/input_permissions/page.jsp. Do not
143             * update this logic updating the logic in the JSP.
144             */
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            /**
199             * Returns the asset category IDs to be applied to an asset entry if the
200             * service context is being passed as a parameter to a method which
201             * manipulates the asset entry.
202             *
203             * @return the asset category IDs
204             */
205            public long[] getAssetCategoryIds() {
206                    return _assetCategoryIds;
207            }
208    
209            /**
210             * Returns the primary keys of the asset entries linked to an asset entry if
211             * the service context is being passed as a parameter to a method which
212             * manipulates the asset entry.
213             *
214             * @return the primary keys of the asset entries
215             */
216            public long[] getAssetLinkEntryIds() {
217                    return _assetLinkEntryIds;
218            }
219    
220            /**
221             * Returns the priority of an asset entry if this service context is being
222             * passed as a parameter to a method which manipulates the asset entry.
223             *
224             * @return the asset entry's priority
225             */
226            public double getAssetPriority() {
227                    return _assetPriority;
228            }
229    
230            /**
231             * Returns the asset tag names to be applied to an asset entry if the
232             * service context is being passed as a parameter to a method which
233             * manipulates the asset entry.
234             *
235             * @return the asset tag names
236             */
237            public String[] getAssetTagNames() {
238                    return _assetTagNames;
239            }
240    
241            /**
242             * Returns the serializable object associated with the name of the standard
243             * parameter of this service context.
244             *
245             * @param  name the name of the standard parameter
246             * @return the serializable object associated with the name
247             */
248            public Serializable getAttribute(String name) {
249                    return _attributes.get(name);
250            }
251    
252            /**
253             * Returns the map of name/value pairs that are the standard parameters of
254             * this service context. Each value is serializable.
255             *
256             * @return the map of name/value pairs
257             */
258            public Map<String, Serializable> getAttributes() {
259                    return _attributes;
260            }
261    
262            /**
263             * Returns the value of the {@link Constants#CMD} parameter used in most
264             * Liferay forms for internal portlets.
265             *
266             * @return the value of the command parameter
267             */
268            public String getCommand() {
269                    return _command;
270            }
271    
272            /**
273             * Returns the company ID of this service context's current portal instance.
274             *
275             * @return the company ID
276             */
277            public long getCompanyId() {
278                    return _companyId;
279            }
280    
281            /**
282             * Returns the date when an entity was created if this service context is
283             * being passed as a parameter to a method which creates an entity.
284             *
285             * @return the creation date
286             */
287            public Date getCreateDate() {
288                    return _createDate;
289            }
290    
291            /**
292             * Returns the date when an entity was created (or a default date) if this
293             * service context is being passed as a parameter to a method which creates
294             * an entity.
295             *
296             * @param  defaultCreateDate an optional default create date to use if the
297             *         service context does not have a create date
298             * @return the creation date if available; the default date otherwise
299             */
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            /**
313             * Returns the current URL of this service context
314             *
315             * @return the current URL
316             */
317            public String getCurrentURL() {
318                    return _currentURL;
319            }
320    
321            /**
322             * Returns an arbitrary number of attributes of an entity to be persisted.
323             *
324             * <p>
325             * These attributes only include fields that this service context does not
326             * possess by default.
327             * </p>
328             *
329             * @return the expando bridge attributes
330             */
331            public Map<String, Serializable> getExpandoBridgeAttributes() {
332                    return _expandoBridgeAttributes;
333            }
334    
335            /**
336             * Returns the date when an <code>aui:form</code> was generated in this
337             * service context. The form date can be used in detecting situations in
338             * which an entity has been modified while another client was editing that
339             * entity. </p>
340             *
341             * <p>
342             * Example:
343             * </p>
344             *
345             * <p>
346             * Person1 and person2 start editing the same version of a Web Content
347             * article. Person1 publishes changes to the article first. When person2
348             * attempts to publish changes to that article, the service implementation
349             * finds that a modification to that article has already been published some
350             * time after person2 started editing the article. Since the the article
351             * modification date was found to be later than the form date for person2,
352             * person2 could be alerted to the modification and make a backup copy of
353             * his edits before synchronizing with the published changes by person1.
354             * </p>
355             */
356            public Date getFormDate() {
357                    return _formDate;
358            }
359    
360            /**
361             * Returns the specific group permissions for a resource if this service
362             * context is being passed as a parameter to a method which manipulates the
363             * resource.
364             *
365             * @return the specific group permissions
366             */
367            public String[] getGroupPermissions() {
368                    return _modelPermissions.getActionIds(
369                            RoleConstants.PLACEHOLDER_DEFAULT_GROUP_ROLE);
370            }
371    
372            /**
373             * Returns this service context's user ID or guest ID if no user ID is
374             * available.
375             *
376             * @return the user ID, or guest ID if there is no user in this service
377             *         context, or <code>0</code> if there is no company in this service
378             *         context
379             */
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            /**
397             * Returns the specific guest permissions for a resource if this service
398             * context is being passed as a parameter to a method which manipulates the
399             * resource.
400             *
401             * @return the specific guest permissions
402             */
403            public String[] getGuestPermissions() {
404                    return _modelPermissions.getActionIds(RoleConstants.GUEST);
405            }
406    
407            /**
408             * Returns the the map of request header name/value pairs of this service
409             * context.
410             *
411             * @return the the map of request header name/value pairs
412             * @see    HttpHeaders
413             */
414            @JSON(include = false)
415            public Map<String, String> getHeaders() {
416                    return _headers;
417            }
418    
419            /**
420             * Returns the language ID of the locale of this service context's current
421             * user.
422             *
423             * @return the language ID
424             */
425            public String getLanguageId() {
426                    if (_languageId != null) {
427                            return _languageId;
428                    }
429    
430                    return LocaleUtil.toLanguageId(LocaleUtil.getMostRelevantLocale());
431            }
432    
433            /**
434             * Returns the complete URL of the current page if a page context can be
435             * determined for this service context.
436             *
437             * @return the complete URL of the current page
438             */
439            public String getLayoutFullURL() {
440                    return _layoutFullURL;
441            }
442    
443            /**
444             * Returns the relative URL of the current page if a page context can be
445             * determined for this service context.
446             *
447             * @return the relative URL of the current page
448             */
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            /**
488             * Returns the date when an entity was modified if this service context is
489             * being passed as a parameter to a method which updates an entity.
490             *
491             * @return the date when an entity was modified if this service context is
492             *         being passed as a parameter to a method which updates an entity
493             */
494            public Date getModifiedDate() {
495                    return _modifiedDate;
496            }
497    
498            /**
499             * Returns the date when an entity was modified if this service context is
500             * being passed as a parameter to a method which modifies an entity.
501             *
502             * @param  defaultModifiedDate an optional default modified date to use if
503             *         this service context does not have a modified date
504             * @return the modified date if available; the default date otherwise
505             */
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            /**
531             * Returns the main context path of the portal, concatenated with
532             * <code>/c</code>.
533             *
534             * @return the main context path of the portal
535             */
536            public String getPathMain() {
537                    return _pathMain;
538            }
539    
540            /**
541             * Returns the portal layout ID of the current page of this service context.
542             *
543             * @return the portal layout ID of the current page
544             */
545            public long getPlid() {
546                    return _plid;
547            }
548    
549            /**
550             * Returns the URL of this service context's portal, including the protocol,
551             * domain, and non-default port relative to the company instance and any
552             * virtual host.
553             *
554             * <p>
555             * The URL returned does not include the port if a default port is used.
556             * </p>
557             *
558             * @return the URL of this service context's portal, including the protocol,
559             *         domain, and non-default port relative to company instance and any
560             *         virtual host
561             */
562            public String getPortalURL() {
563                    return _portalURL;
564            }
565    
566            /**
567             * Returns the ID of the current portlet if this service context is being
568             * passed as a parameter to a portlet.
569             *
570             * @return the ID of the current portlet
571             * @see    PortletPreferencesIds
572             */
573            public String getPortletId() {
574                    if (_portletPreferencesIds == null) {
575                            return null;
576                    }
577    
578                    return _portletPreferencesIds.getPortletId();
579            }
580    
581            /**
582             * Returns the portlet preferences IDs of the current portlet if the service
583             * context is being passed as a parameter to a portlet.
584             *
585             * <p>
586             * The {@link PortletPreferencesIds} can be used to look up portlet
587             * preferences of the current portlet.
588             * </p>
589             *
590             * @return the portlet preferences IDs of the current portlet
591             * @see    PortletPreferencesIds
592             */
593            public PortletPreferencesIds getPortletPreferencesIds() {
594                    return _portletPreferencesIds;
595            }
596    
597            /**
598             * Returns the remote address of the user making the request in this service
599             * context.
600             *
601             * @return the remote address of the user making the request
602             */
603            public String getRemoteAddr() {
604                    return _remoteAddr;
605            }
606    
607            /**
608             * Returns the remote host name of the user making the request in this
609             * service context.
610             *
611             * @return the remote host name of the user making the request
612             */
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            /**
649             * Returns the ID of the group corresponding to the current data scope of
650             * this service context.
651             *
652             * @return the ID of the group corresponding to the current data scope
653             * @see    Group
654             */
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            /**
672             * Returns the user-agent request header of this service context.
673             *
674             * @return the user-agent request header
675             * @see    HttpHeaders
676             */
677            public String getUserAgent() {
678                    if (_request == null) {
679                            return null;
680                    }
681    
682                    return _request.getHeader(HttpHeaders.USER_AGENT);
683            }
684    
685            /**
686             * Returns the complete URL of this service context's current user's profile
687             * page.
688             *
689             * @return the complete URL of this service context's current user's profile
690             *         page
691             */
692            public String getUserDisplayURL() {
693                    return _userDisplayURL;
694            }
695    
696            /**
697             * Returns the ID of this service context's current user.
698             *
699             * @return the ID of this service context's current user
700             */
701            public long getUserId() {
702                    return _userId;
703            }
704    
705            /**
706             * Returns the UUID of this service context's current entity.
707             *
708             * <p>
709             * To ensure the same UUID is never used by two entities, the UUID is reset
710             * to <code>null</code> upon invoking this method.
711             * </p>
712             *
713             * @return the UUID of this service context's current entity
714             */
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            /**
728             * Returns the workflow action to take if this service context is being
729             * passed as a parameter to a method that processes a workflow action.
730             *
731             * @return the workflow action to take
732             */
733            public int getWorkflowAction() {
734                    return _workflowAction;
735            }
736    
737            /**
738             * Returns <code>true</code> if this service context is being passed as a
739             * parameter to a method which manipulates a resource to which default group
740             * permissions apply.
741             *
742             * @return <code>true</code> if this service context is being passed as a
743             *         parameter to a method which manipulates a resource to which
744             *         default group permissions apply; <code>false</code> otherwise
745             */
746            public boolean isAddGroupPermissions() {
747                    return _addGroupPermissions;
748            }
749    
750            /**
751             * Returns <code>true</code> if this service context is being passed as a
752             * parameter to a method which manipulates a resource to which default guest
753             * permissions apply.
754             *
755             * @return <code>true</code> if this service context is being passed as a
756             *         parameter to a method which manipulates a resource to which
757             *         default guest permissions apply; <code>false</code> otherwise
758             */
759            public boolean isAddGuestPermissions() {
760                    return _addGuestPermissions;
761            }
762    
763            public boolean isAssetEntryVisible() {
764                    return _assetEntryVisible;
765            }
766    
767            /**
768             * Returns <code>true</code> if this service context contains an add command
769             * (i.e. has command value {@link Constants#ADD})
770             *
771             * @return <code>true</code> if this service context contains an add
772             *         command; <code>false</code> otherwise
773             */
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            /**
788             * Returns <code>true</code> if this service context contains an update
789             * command (i.e. has command value {@link Constants#UPDATE})
790             *
791             * @return <code>true</code> if this service context contains an update
792             *         command; <code>false</code> otherwise
793             */
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            /**
811             * Returns <code>true</code> if portal exceptions should be handled as
812             * failures, possibly halting processing, or <code>false</code> if the
813             * exceptions should be handled differently, possibly allowing processing to
814             * continue in some manner. Services may check this flag to execute desired
815             * behavior.
816             *
817             * <p>
818             * Batch invocation of such services (exposed as a JSON web services) can
819             * result in execution of all service invocations, in spite of portal
820             * exceptions.
821             * </p>
822             *
823             * <p>
824             * If this flag is set to <code>false</code>, services can implement logic
825             * that allows processing to continue, while collecting information
826             * regarding the exceptions for returning to the caller. For example, the
827             * {@link
828             * com.liferay.portlet.asset.service.impl.AssetVocabularyServiceImpl#deleteVocabularies(
829             * long[], ServiceContext)} method uses the list it returns to give
830             * information on vocabularies it fails to delete; it returns an empty list
831             * if all deletions are successful.
832             * </p>
833             *
834             * @return <code>true</code> if portal exceptions are to be handled as
835             *         failures; <code>false</code> if portal exceptions can be handled
836             *         differently, possibly allowing processing to continue in some
837             *         manner
838             */
839            public boolean isFailOnPortalException() {
840                    return _failOnPortalException;
841            }
842    
843            /**
844             * Returns whether the primary entity of this service context is to be
845             * indexed/re-indexed.
846             *
847             * @return <code>true</code> the primary entity of this service context is
848             *         to be indexed/re-indexed; <code>false</code> otherwise
849             */
850            public boolean isIndexingEnabled() {
851                    return _indexingEnabled;
852            }
853    
854            /**
855             * Returns <code>true</code> if the sender of this service context's request
856             * is signed in.
857             *
858             * @return <code>true</code> if the sender of this service context's request
859             *         is signed in; <code>false</code> otherwise
860             */
861            public boolean isSignedIn() {
862                    return _signedIn;
863            }
864    
865            /**
866             * Merges all of the specified service context's non-<code>null</code>
867             * attributes, attributes greater than <code>0</code>, and fields (except
868             * the request) with this service context object.
869             *
870             * @param serviceContext the service context object to be merged
871             */
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                    // Refrence serviceContext#_uuid directly because calling
1012                    // serviceContext#getUuid() would set it to null
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            /**
1024             * Removes the mapping of the serializable object to the name of the
1025             * standard parameter of this service context.
1026             *
1027             * @param  name the name of the standard parameter
1028             * @return the serializable object associated to the name
1029             */
1030            public Serializable removeAttribute(String name) {
1031                    return _attributes.remove(name);
1032            }
1033    
1034            /**
1035             * Sets whether or not default group permissions should apply to a resource
1036             * being manipulated by a method to which this service context is passed as
1037             * a parameter.
1038             *
1039             * @param addGroupPermissions indicates whether or not to apply default
1040             *        group permissions
1041             */
1042            public void setAddGroupPermissions(boolean addGroupPermissions) {
1043                    _addGroupPermissions = addGroupPermissions;
1044            }
1045    
1046            /**
1047             * Sets whether or not default guest permissions should apply to a resource
1048             * being manipulated by a method to which this service context is passed as
1049             * a parameter.
1050             *
1051             * @param addGuestPermissions indicates whether or not to apply default
1052             *        guest permissions
1053             */
1054            public void setAddGuestPermissions(boolean addGuestPermissions) {
1055                    _addGuestPermissions = addGuestPermissions;
1056            }
1057    
1058            /**
1059             * Sets an array of asset category IDs to be applied to an asset entry if
1060             * this service context is being passed as a parameter to a method which
1061             * manipulates the asset entry.
1062             *
1063             * @param assetCategoryIds the primary keys of the asset categories
1064             */
1065            public void setAssetCategoryIds(long[] assetCategoryIds) {
1066                    _assetCategoryIds = assetCategoryIds;
1067            }
1068    
1069            public void setAssetEntryVisible(boolean assetEntryVisible) {
1070                    _assetEntryVisible = assetEntryVisible;
1071            }
1072    
1073            /**
1074             * Sets an array of the primary keys of asset entries to be linked to an
1075             * asset entry if this service context is being passed as a parameter to a
1076             * method which manipulates the asset entry.
1077             *
1078             * @param assetLinkEntryIds the primary keys of the asset entries to be
1079             *        linked to an asset entry
1080             */
1081            public void setAssetLinkEntryIds(long[] assetLinkEntryIds) {
1082                    _assetLinkEntryIds = assetLinkEntryIds;
1083            }
1084    
1085            /**
1086             * Sets the priority of an asset entry if this service context is being
1087             * passed as a parameter to a method which manipulates the asset entry.
1088             *
1089             * @param assetPriority the priority of an asset entry
1090             */
1091            public void setAssetPriority(double assetPriority) {
1092                    _assetPriority = assetPriority;
1093            }
1094    
1095            /**
1096             * Sets an array of asset tag names to be applied to an asset entry if this
1097             * service context is being passed as a parameter to a method which
1098             * manipulates the asset entry.
1099             *
1100             * @param assetTagNames the tag names to be applied to an asset entry
1101             */
1102            public void setAssetTagNames(String[] assetTagNames) {
1103                    _assetTagNames = assetTagNames;
1104            }
1105    
1106            /**
1107             * Sets a mapping of a standard parameter's name to its serializable object.
1108             *
1109             * @param name the standard parameter name to associate with the value
1110             * @param value the serializable object to be associated with the name
1111             */
1112            public void setAttribute(String name, Serializable value) {
1113                    _attributes.put(name, value);
1114            }
1115    
1116            /**
1117             * Sets the map of the name/value pairs that are the standard parameters of
1118             * this service context. Each value must be serializable.
1119             *
1120             * @param attributes the map of the name/value pairs that are the standard
1121             *        parameters of this service context
1122             */
1123            public void setAttributes(Map<String, Serializable> attributes) {
1124                    _attributes = attributes;
1125            }
1126    
1127            /**
1128             * Sets the value of the {@link Constants#CMD} parameter used in most
1129             * Liferay forms for internal portlets.
1130             *
1131             * @param command the value of the {@link Constants#CMD} parameter
1132             */
1133            public void setCommand(String command) {
1134                    _command = command;
1135            }
1136    
1137            /**
1138             * Sets the company ID of this service context's current portal instance.
1139             *
1140             * @param companyId the primary key of this service context's current portal
1141             *        instance
1142             */
1143            public void setCompanyId(long companyId) {
1144                    _companyId = companyId;
1145            }
1146    
1147            /**
1148             * Sets the date when an entity was created if this service context is being
1149             * passed as a parameter to a method which creates an entity.
1150             *
1151             * @param createDate the date the entity was created
1152             */
1153            public void setCreateDate(Date createDate) {
1154                    _createDate = createDate;
1155            }
1156    
1157            /**
1158             * Sets the current URL of this service context
1159             *
1160             * @param currentURL the current URL of this service context
1161             */
1162            public void setCurrentURL(String currentURL) {
1163                    _currentURL = currentURL;
1164            }
1165    
1166            public void setDeriveDefaultPermissions(boolean deriveDefaultPermissions) {
1167                    _deriveDefaultPermissions = deriveDefaultPermissions;
1168            }
1169    
1170            /**
1171             * Sets an arbitrary number of attributes of an entity to be persisted.
1172             *
1173             * <p>
1174             * These attributes should only include fields that {@link
1175             * ServiceContext} does not possess by default.
1176             * </p>
1177             *
1178             * @param expandoBridgeAttributes the expando bridge attributes (optionally
1179             *        <code>null</code>)
1180             */
1181            public void setExpandoBridgeAttributes(
1182                    Map<String, Serializable> expandoBridgeAttributes) {
1183    
1184                    _expandoBridgeAttributes = expandoBridgeAttributes;
1185            }
1186    
1187            /**
1188             * Sets whether portal exceptions should be handled as failures, possibly
1189             * halting processing, or if exceptions should be handled differently,
1190             * possibly allowing processing to continue in some manner.
1191             *
1192             * @param failOnPortalException whether portal exceptions should be handled
1193             *        as failures, or if portal exceptions should be handled
1194             *        differently, possibly allowing processing to continue in some
1195             *        manner
1196             * @see   #isFailOnPortalException()
1197             */
1198            public void setFailOnPortalException(boolean failOnPortalException) {
1199                    _failOnPortalException = failOnPortalException;
1200            }
1201    
1202            /**
1203             * Sets the date when an <code>aui:form</code> was generated in this service
1204             * context. The form date can be used in detecting situations in which an
1205             * entity has been modified while another client was editing that entity.
1206             *
1207             * <p>
1208             * Example:
1209             * </p>
1210             *
1211             * <p>
1212             * Person1 and person2 start editing the same version of a Web Content
1213             * article. Person1 publishes changes to the article first. When person2
1214             * attempts to publish changes to that article, the service implementation
1215             * finds that a modification to that article has already been published some
1216             * time after person2 started editing the article. Since the article
1217             * modification date was found to be later than the form date for person2,
1218             * person2 could be alerted to the modification and make a backup copy of
1219             * his edits before synchronizing with the published changes by person1.
1220             * </p>
1221             *
1222             * @param formDate the date that an <code>aui:form</code> was generated for
1223             *        this service context (optionally <code>null</code>)
1224             */
1225            public void setFormDate(Date formDate) {
1226                    _formDate = formDate;
1227            }
1228    
1229            /**
1230             * Sets an array containing specific group permissions for a resource if
1231             * this service context is being passed as a parameter to a method which
1232             * manipulates the resource.
1233             *
1234             * @param groupPermissions the permissions (optionally <code>null</code>)
1235             */
1236            public void setGroupPermissions(String[] groupPermissions) {
1237                    _modelPermissions.addRolePermissions(
1238                            RoleConstants.PLACEHOLDER_DEFAULT_GROUP_ROLE, groupPermissions);
1239            }
1240    
1241            /**
1242             * Sets an array containing specific guest permissions for a resource if
1243             * this service context is being passed as a parameter to a method which
1244             * manipulates the resource.
1245             *
1246             * @param guestPermissions the guest permissions (optionally
1247             *        <code>null</code>)
1248             */
1249            public void setGuestPermissions(String[] guestPermissions) {
1250                    _modelPermissions.addRolePermissions(
1251                            RoleConstants.GUEST, guestPermissions);
1252            }
1253    
1254            /**
1255             * Sets the map of request header name/value pairs of this service context.
1256             *
1257             * @param headers map of request header name/value pairs of this service
1258             *        context
1259             * @see   HttpHeaders
1260             */
1261            public void setHeaders(Map<String, String> headers) {
1262                    _headers = headers;
1263            }
1264    
1265            /**
1266             * Sets whether the primary entity of this service context is to be
1267             * indexed/re-indexed.
1268             *
1269             * <p>
1270             * The entity is only indexed/re-indexed if the method receiving this
1271             * service context as a parameter does indexing.
1272             * </p>
1273             *
1274             * @param indexingEnabled whether the primary entity of this service context
1275             *        is to be indexed/re-indexed (default is <code>true</code>)
1276             */
1277            public void setIndexingEnabled(boolean indexingEnabled) {
1278                    _indexingEnabled = indexingEnabled;
1279            }
1280    
1281            /**
1282             * Sets the language ID of the locale of this service context.
1283             *
1284             * @param languageId the language ID of the locale of this service context's
1285             *        current user
1286             */
1287            public void setLanguageId(String languageId) {
1288                    _languageId = languageId;
1289            }
1290    
1291            /**
1292             * Sets the complete URL of the current page for this service context.
1293             *
1294             * @param layoutFullURL the complete URL of the current page if a page
1295             *        context can be determined for this service context
1296             */
1297            public void setLayoutFullURL(String layoutFullURL) {
1298                    _layoutFullURL = layoutFullURL;
1299            }
1300    
1301            /**
1302             * Sets the relative URL of the current page for this service context.
1303             *
1304             * @param layoutURL the relative URL of the current page if a page context
1305             *        can be determined for this service context
1306             */
1307            public void setLayoutURL(String layoutURL) {
1308                    _layoutURL = layoutURL;
1309            }
1310    
1311            public void setModelPermissions(ModelPermissions modelPermissions) {
1312                    _modelPermissions = modelPermissions;
1313            }
1314    
1315            /**
1316             * Sets the date when an entity was modified in this service context.
1317             *
1318             * @param modifiedDate the date when an entity was modified in this service
1319             *        context
1320             */
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            /**
1342             * Sets the main context path of the portal, concatenated with
1343             * <code>/c</code>.
1344             *
1345             * @param pathMain the main context path of the portal
1346             */
1347            public void setPathMain(String pathMain) {
1348                    _pathMain = pathMain;
1349            }
1350    
1351            /**
1352             * Sets the portal layout ID of the current page in this service context.
1353             *
1354             * @param plid the portal layout ID of the current page
1355             */
1356            public void setPlid(long plid) {
1357                    _plid = plid;
1358            }
1359    
1360            /**
1361             * Sets the URL of this service context's portal, including the protocol,
1362             * domain, and non-default port relative to the company instance and any
1363             * virtual host.
1364             *
1365             * <p>
1366             * The URL should not include the port if a default port is used.
1367             * </p>
1368             *
1369             * @param portalURL the portal URL
1370             */
1371            public void setPortalURL(String portalURL) {
1372                    _portalURL = portalURL;
1373            }
1374    
1375            /**
1376             * Sets the portlet preferences IDs of the current portlet if this service
1377             * context is being passed as a parameter to a portlet.
1378             *
1379             * <p>
1380             * The {@link PortletPreferencesIds} can be used to look up portlet
1381             * preferences of the current portlet.
1382             * </p>
1383             *
1384             * @param portletPreferencesIds the portlet preferences
1385             * @see   PortletPreferencesIds
1386             */
1387            public void setPortletPreferencesIds(
1388                    PortletPreferencesIds portletPreferencesIds) {
1389    
1390                    _portletPreferencesIds = portletPreferencesIds;
1391            }
1392    
1393            /**
1394             * Sets the remote address of the user making the request in this service
1395             * context.
1396             *
1397             * @param remoteAddr the remote address of the user making the request in
1398             *        this service context
1399             */
1400            public void setRemoteAddr(String remoteAddr) {
1401                    _remoteAddr = remoteAddr;
1402            }
1403    
1404            /**
1405             * Sets the remote host name of the user making the request in this service
1406             * context.
1407             *
1408             * @param remoteHost the remote host name of the user making the request in
1409             *        this service context
1410             */
1411            public void setRemoteHost(String remoteHost) {
1412                    _remoteHost = remoteHost;
1413            }
1414    
1415            /**
1416             * Sets the optional request used when instantiating this service context.
1417             * The field is volatile and so will be discarded on serialization.
1418             *
1419             * @param request the request
1420             */
1421            public void setRequest(HttpServletRequest request) {
1422                    _request = request;
1423            }
1424    
1425            /**
1426             * Sets the ID of the group corresponding to the current data scope of this
1427             * service context.
1428             *
1429             * @param scopeGroupId the ID of the group corresponding to the current data
1430             *        scope of this service context
1431             * @see   Group
1432             */
1433            public void setScopeGroupId(long scopeGroupId) {
1434                    _scopeGroupId = scopeGroupId;
1435            }
1436    
1437            /**
1438             * Sets whether the sender of this service context's request is signed in.
1439             *
1440             * @param signedIn whether the sender of this service context's request is
1441             *        signed in
1442             */
1443            public void setSignedIn(boolean signedIn) {
1444                    _signedIn = signedIn;
1445            }
1446    
1447            public void setTimeZone(TimeZone timeZone) {
1448                    _timeZone = timeZone;
1449            }
1450    
1451            /**
1452             * Sets the complete URL of this service context's current user's profile
1453             * page.
1454             *
1455             * @param userDisplayURL the complete URL of the current user's profile page
1456             */
1457            public void setUserDisplayURL(String userDisplayURL) {
1458                    _userDisplayURL = userDisplayURL;
1459            }
1460    
1461            /**
1462             * Sets the ID of this service context's current user.
1463             *
1464             * @param userId the ID of the current user
1465             */
1466            public void setUserId(long userId) {
1467                    _userId = userId;
1468            }
1469    
1470            /**
1471             * Sets the UUID of this service context's current entity.
1472             *
1473             * @param uuid the UUID of the current entity
1474             */
1475            public void setUuid(String uuid) {
1476                    _uuid = uuid;
1477            }
1478    
1479            /**
1480             * Sets the workflow action to take if this service context is being passed
1481             * as parameter to a method that processes a workflow action.
1482             *
1483             * @param workflowAction workflow action to take (default is {@link
1484             *        WorkflowConstants#ACTION_PUBLISH})
1485             */
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    }