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