Liferay 6.2-ce-ga5

com.liferay.portal.service
Class ServiceContext

java.lang.Object
  extended by com.liferay.portal.service.ServiceContext
All Implemented Interfaces:
Serializable, Cloneable

public class ServiceContext
extends Object
implements Cloneable, Serializable

Contains context information about a given API call.

The ServiceContext object simplifies method signatures and provides a way to consolidate many different methods with different sets of optional parameters into a single, easier to use method. It also aggregates information necessary for transversal features such as permissioning, tagging, categorization, etc.

See Also:
Serialized Form

Constructor Summary
ServiceContext()
          Creates a new service context object with an attributes map and an expando bridge attributes map.
 
Method Summary
 Object clone()
          Returns a new service context object identical to this service context object.
 void deriveDefaultPermissions(long repositoryId, String modelName)
          Derive default permissions based on the logic found in portal-web/docroot/html/taglib/ui/input_permissions/page.jsp.
 boolean getAddCommunityPermissions()
          Deprecated. As of 6.1.0, renamed to isAddGroupPermissions()
 long[] getAssetCategoryIds()
          Returns the asset category IDs to be applied to an asset entry if the service context is being passed as a parameter to a method which manipulates the asset entry.
 long[] getAssetLinkEntryIds()
          Returns the primary keys of the asset entries linked to an asset entry if the service context is being passed as a parameter to a method which manipulates the asset entry.
 String[] getAssetTagNames()
          Returns the asset tag names to be applied to an asset entry if the service context is being passed as a parameter to a method which manipulates the asset entry.
 Serializable getAttribute(String name)
          Returns the serializable object associated with the name of the standard parameter of this service context.
 Map<String,Serializable> getAttributes()
          Returns the map of name/value pairs that are the standard parameters of this service context.
 String getCommand()
          Returns the value of the Constants.CMD parameter used in most Liferay forms for internal portlets.
 String[] getCommunityPermissions()
          Deprecated. As of 6.1.0, renamed to getGroupPermissions()
 long getCompanyId()
          Returns the company ID of this service context's current portal instance.
 Date getCreateDate()
          Returns the date when an entity was created if this service context is being passed as a parameter to a method which creates an entity.
 Date getCreateDate(Date defaultCreateDate)
          Returns the date when an entity was created (or a default date) if this service context is being passed as a parameter to a method which creates an entity.
 String getCurrentURL()
          Returns the current URL of this service context
 Map<String,Serializable> getExpandoBridgeAttributes()
          Returns an arbitrary number of attributes of an entity to be persisted.
 Date getFormDate()
          Returns the date when an aui:form was generated in this service context.
 String[] getGroupPermissions()
          Returns the specific group permissions for a resource if this service context is being passed as a parameter to a method which manipulates the resource.
 long getGuestOrUserId()
          Returns this service context's user ID or guest ID if no user ID is available.
 String[] getGuestPermissions()
          Returns the specific guest permissions for a resource if this service context is being passed as a parameter to a method which manipulates the resource.
 Map<String,String> getHeaders()
          Returns the the map of request header name/value pairs of this service context.
 String getLanguageId()
          Returns the language ID of the locale of this service context's current user.
 String getLayoutFullURL()
          Returns the complete URL of the current page if a page context can be determined for this service context.
 String getLayoutURL()
          Returns the relative URL of the current page if a page context can be determined for this service context.
 LiferayPortletRequest getLiferayPortletRequest()
           
 LiferayPortletResponse getLiferayPortletResponse()
           
 Locale getLocale()
           
 Date getModifiedDate()
          Returns the date when an entity was modified if this service context is being passed as a parameter to a method which updates an entity.
 Date getModifiedDate(Date defaultModifiedDate)
          Returns the date when an entity was modified if this service context is being passed as a parameter to a method which modifies an entity.
 String getPathFriendlyURLPrivateGroup()
           
 String getPathFriendlyURLPrivateUser()
           
 String getPathFriendlyURLPublic()
           
 String getPathMain()
          Returns the main context path of the portal, concatenated with /c.
 long getPlid()
          Returns the portal layout ID of the current page of this service context.
 String getPortalURL()
          Returns the URL of this service context's portal, including the protocol, domain, and non-default port relative to the company instance and any virtual host.
 String getPortletId()
          Returns the ID of the current portlet if this service context is being passed as a parameter to a portlet.
 PortletPreferencesIds getPortletPreferencesIds()
          Returns the portlet preferences IDs of the current portlet if the service context is being passed as a parameter to a portlet.
 String getRemoteAddr()
          Returns the remote address of the user making the request in this service context.
 String getRemoteHost()
          Returns the remote host name of the user making the request in this service context.
 javax.servlet.http.HttpServletRequest getRequest()
           
 javax.servlet.http.HttpServletResponse getResponse()
           
 String getRootPortletId()
           
 Group getScopeGroup()
           
 long getScopeGroupId()
          Returns the ID of the group corresponding to the current data scope of this service context.
 ThemeDisplay getThemeDisplay()
           
 TimeZone getTimeZone()
           
 String getUserAgent()
          Returns the user-agent request header of this service context.
 String getUserDisplayURL()
          Returns the complete URL of this service context's current user's profile page.
 long getUserId()
          Returns the ID of this service context's current user.
 String getUuid()
          Returns the UUID of this service context's current entity.
 String getUuidWithoutReset()
           
 int getWorkflowAction()
          Returns the workflow action to take if this service context is being passed as a parameter to a method that processes a workflow action.
 boolean isAddGroupPermissions()
          Returns true if this service context is being passed as a parameter to a method which manipulates a resource to which default group permissions apply.
 boolean isAddGuestPermissions()
          Returns true if this service context is being passed as a parameter to a method which manipulates a resource to which default guest permissions apply.
 boolean isAssetEntryVisible()
           
 boolean isCommandAdd()
          Returns true if this service context contains an add command (i.e. has command value Constants.ADD)
 boolean isCommandUpdate()
          Returns true if this service context contains an update command (i.e. has command value Constants.UPDATE)
 boolean isDeriveDefaultPermissions()
           
 boolean isFailOnPortalException()
          Returns true if portal exceptions should be handled as failures, possibly halting processing, or false if the exceptions should be handled differently, possibly allowing processing to continue in some manner.
 boolean isIndexingEnabled()
          Returns whether the primary entity of this service context is to be indexed/re-indexed.
 boolean isSignedIn()
          Returns true if the sender of this service context's request is signed in.
 void merge(ServiceContext serviceContext)
           
 Serializable removeAttribute(String name)
          Removes the mapping of the serializable object to the name of the standard parameter of this service context.
 void setAddCommunityPermissions(boolean addCommunityPermissions)
          Deprecated. As of 6.1.0, renamed to setAddGroupPermissions(boolean)
 void setAddGroupPermissions(boolean addGroupPermissions)
          Sets whether or not default group permissions should apply to a resource being manipulated by a method to which this service context is passed as a parameter.
 void setAddGuestPermissions(boolean addGuestPermissions)
          Sets whether or not default guest permissions should apply to a resource being manipulated by a method to which this service context is passed as a parameter.
 void setAssetCategoryIds(long[] assetCategoryIds)
          Sets an array of asset category IDs to be applied to an asset entry if this service context is being passed as a parameter to a method which manipulates the asset entry.
 void setAssetEntryVisible(boolean assetEntryVisible)
           
 void setAssetLinkEntryIds(long[] assetLinkEntryIds)
          Sets an array of the primary keys of asset entries to be linked to an asset entry if this service context is being passed as a parameter to a method which manipulates the asset entry.
 void setAssetTagNames(String[] assetTagNames)
          Sets an array of asset tag names to be applied to an asset entry if this service context is being passed as a parameter to a method which manipulates the asset entry.
 void setAttribute(String name, Serializable value)
          Sets a mapping of a standard parameter's name to its serializable object.
 void setAttributes(Map<String,Serializable> attributes)
          Sets the map of the name/value pairs that are the standard parameters of this service context.
 void setCommand(String command)
          Sets the value of the Constants.CMD parameter used in most Liferay forms for internal portlets.
 void setCommunityPermissions(String[] communityPermissions)
          Deprecated. As of 6.1.0, renamed to setGroupPermissions(String[])
 void setCompanyId(long companyId)
          Sets the company ID of this service context's current portal instance.
 void setCreateDate(Date createDate)
          Sets the date when an entity was created if this service context is being passed as a parameter to a method which creates an entity.
 void setCurrentURL(String currentURL)
          Sets the current URL of this service context
 void setDeriveDefaultPermissions(boolean deriveDefaultPermissions)
           
 void setExpandoBridgeAttributes(Map<String,Serializable> expandoBridgeAttributes)
          Sets an arbitrary number of attributes of an entity to be persisted.
 void setFailOnPortalException(boolean failOnPortalException)
          Sets whether portal exceptions should be handled as failures, possibly halting processing, or if exceptions should be handled differently, possibly allowing processing to continue in some manner.
 void setFormDate(Date formDate)
          Sets the date when an aui:form was generated in this service context.
 void setGroupPermissions(String[] groupPermissions)
          Sets an array containing specific group permissions for a resource if this service context is being passed as a parameter to a method which manipulates the resource.
 void setGuestPermissions(String[] guestPermissions)
          Sets an array containing specific guest permissions for a resource if this service context is being passed as a parameter to a method which manipulates the resource.
 void setHeaders(Map<String,String> headers)
          Sets the map of request header name/value pairs of this service context.
 void setIndexingEnabled(boolean indexingEnabled)
          Sets whether the primary entity of this service context is to be indexed/re-indexed.
 void setLanguageId(String languageId)
          Sets the language ID of the locale of this service context.
 void setLayoutFullURL(String layoutFullURL)
          Sets the complete URL of the current page for this service context.
 void setLayoutURL(String layoutURL)
          Sets the relative URL of the current page for this service context.
 void setModifiedDate(Date modifiedDate)
          Sets the date when an entity was modified in this service context.
 void setPathFriendlyURLPrivateGroup(String pathFriendlyURLPrivateGroup)
           
 void setPathFriendlyURLPrivateUser(String pathFriendlyURLPrivateUser)
           
 void setPathFriendlyURLPublic(String pathFriendlyURLPublic)
           
 void setPathMain(String pathMain)
          Sets the main context path of the portal, concatenated with /c.
 void setPlid(long plid)
          Sets the portal layout ID of the current page in this service context.
 void setPortalURL(String portalURL)
          Sets the URL of this service context's portal, including the protocol, domain, and non-default port relative to the company instance and any virtual host.
 void setPortletPreferencesIds(PortletPreferencesIds portletPreferencesIds)
          Sets the portlet preferences IDs of the current portlet if this service context is being passed as a parameter to a portlet.
 void setRemoteAddr(String remoteAddr)
          Sets the remote address of the user making the request in this service context.
 void setRemoteHost(String remoteHost)
          Sets the remote host name of the user making the request in this service context.
 void setRequest(javax.servlet.http.HttpServletRequest request)
          Sets the optional request used when instantiating this service context.
 void setScopeGroupId(long scopeGroupId)
          Sets the ID of the group corresponding to the current data scope of this service context.
 void setSignedIn(boolean signedIn)
          Sets whether the sender of this service context's request is signed in.
 void setTimeZone(TimeZone timeZone)
           
 void setUserDisplayURL(String userDisplayURL)
          Sets the complete URL of this service context's current user's profile page.
 void setUserId(long userId)
          Sets the ID of this service context's current user.
 void setUuid(String uuid)
          Sets the UUID of this service context's current entity.
 void setWorkflowAction(int workflowAction)
          Sets the workflow action to take if this service context is being passed as parameter to a method that processes a workflow action.
 String translate(String pattern, Object... arguments)
           
 void validateModifiedDate(AuditedModel auditedModel, Class<? extends PortalException> clazz)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceContext

public ServiceContext()
Creates a new service context object with an attributes map and an expando bridge attributes map. The attributes map contains standard service context parameters and the expando bridge attributes map contains optional service context parameters.

Method Detail

clone

public Object clone()
Returns a new service context object identical to this service context object.

Overrides:
clone in class Object
Returns:
a new service context object

deriveDefaultPermissions

public void deriveDefaultPermissions(long repositoryId,
                                     String modelName)
                              throws PortalException,
                                     SystemException
Derive default permissions based on the logic found in portal-web/docroot/html/taglib/ui/input_permissions/page.jsp. Do not update this logic updating the logic in the JSP.

Throws:
PortalException
SystemException

getAddCommunityPermissions

public boolean getAddCommunityPermissions()
Deprecated. As of 6.1.0, renamed to isAddGroupPermissions()

Returns true if this service context is being passed as a parameter to a method which manipulates a resource to which default group permissions apply.

Returns:
true if this service context is being passed as a parameter to a method which manipulates a resource to which default community permissions apply; false otherwise

getAssetCategoryIds

public long[] getAssetCategoryIds()
Returns the asset category IDs to be applied to an asset entry if the service context is being passed as a parameter to a method which manipulates the asset entry.

Returns:
the asset category IDs

getAssetLinkEntryIds

public long[] getAssetLinkEntryIds()
Returns the primary keys of the asset entries linked to an asset entry if the service context is being passed as a parameter to a method which manipulates the asset entry.

Returns:
the primary keys of the asset entries

getAssetTagNames

public String[] getAssetTagNames()
Returns the asset tag names to be applied to an asset entry if the service context is being passed as a parameter to a method which manipulates the asset entry.

Returns:
the asset tag names

getAttribute

public Serializable getAttribute(String name)
Returns the serializable object associated with the name of the standard parameter of this service context.

Parameters:
name - the name of the standard parameter
Returns:
the serializable object associated with the name

getAttributes

public Map<String,Serializable> getAttributes()
Returns the map of name/value pairs that are the standard parameters of this service context. Each value is serializable.

Returns:
the map of name/value pairs

getCommand

public String getCommand()
Returns the value of the Constants.CMD parameter used in most Liferay forms for internal portlets.

Returns:
the value of the command parameter

getCommunityPermissions

public String[] getCommunityPermissions()
Deprecated. As of 6.1.0, renamed to getGroupPermissions()

Returns the specific community permissions for a resource if the service context is being passed as a parameter to a method which manipulates the resource.

Returns:
the community permissions

getCompanyId

public long getCompanyId()
Returns the company ID of this service context's current portal instance.

Returns:
the company ID

getCreateDate

public Date getCreateDate()
Returns the date when an entity was created if this service context is being passed as a parameter to a method which creates an entity.

Returns:
the creation date

getCreateDate

public Date getCreateDate(Date defaultCreateDate)
Returns the date when an entity was created (or a default date) if this service context is being passed as a parameter to a method which creates an entity.

Parameters:
defaultCreateDate - an optional default create date to use if the service context does not have a create date
Returns:
the creation date if available; the default date otherwise

getCurrentURL

public String getCurrentURL()
Returns the current URL of this service context

Returns:
the current URL

getExpandoBridgeAttributes

public Map<String,Serializable> getExpandoBridgeAttributes()
Returns an arbitrary number of attributes of an entity to be persisted.

These attributes only include fields that this service context does not possess by default.

Returns:
the expando bridge attributes

getFormDate

public Date getFormDate()
Returns the date when an aui:form was generated in this service context. The form date can be used in detecting situations in which an entity has been modified while another client was editing that entity.

Example:

Person1 and person2 start editing the same version of a Web Content article. Person1 publishes changes to the article first. When person2 attempts to publish changes to that article, the service implementation finds that a modification to that article has already been published some time after person2 started editing the article. Since the the article modification date was found to be later than the form date for person2, person2 could be alerted to the modification and make a backup copy of his edits before synchronizing with the published changes by person1.


getGroupPermissions

public String[] getGroupPermissions()
Returns the specific group permissions for a resource if this service context is being passed as a parameter to a method which manipulates the resource.

Returns:
the specific group permissions

getGuestOrUserId

public long getGuestOrUserId()
                      throws PortalException,
                             SystemException
Returns this service context's user ID or guest ID if no user ID is available.

Returns:
the user ID, or guest ID if there is no user in this service context, or 0 if there is no company in this service context
Throws:
PortalException - if a default user for the company could not be found
SystemException - if a system exception occurred

getGuestPermissions

public String[] getGuestPermissions()
Returns the specific guest permissions for a resource if this service context is being passed as a parameter to a method which manipulates the resource.

Returns:
the specific guest permissions

getHeaders

@JSON(include=false)
public Map<String,String> getHeaders()
Returns the the map of request header name/value pairs of this service context.

Returns:
the the map of request header name/value pairs
See Also:
HttpHeaders

getLanguageId

public String getLanguageId()
Returns the language ID of the locale of this service context's current user.

Returns:
the language ID

getLayoutFullURL

public String getLayoutFullURL()
Returns the complete URL of the current page if a page context can be determined for this service context.

Returns:
the complete URL of the current page

getLayoutURL

public String getLayoutURL()
Returns the relative URL of the current page if a page context can be determined for this service context.

Returns:
the relative URL of the current page

getLiferayPortletRequest

public LiferayPortletRequest getLiferayPortletRequest()

getLiferayPortletResponse

public LiferayPortletResponse getLiferayPortletResponse()

getLocale

public Locale getLocale()

getModifiedDate

public Date getModifiedDate()
Returns the date when an entity was modified if this service context is being passed as a parameter to a method which updates an entity.

Returns:
the date when an entity was modified if this service context is being passed as a parameter to a method which updates an entity

getModifiedDate

public Date getModifiedDate(Date defaultModifiedDate)
Returns the date when an entity was modified if this service context is being passed as a parameter to a method which modifies an entity.

Parameters:
defaultModifiedDate - an optional default modified date to use if this service context does not have a modified date
Returns:
the modified date if available; the default date otherwise

getPathFriendlyURLPrivateGroup

public String getPathFriendlyURLPrivateGroup()

getPathFriendlyURLPrivateUser

public String getPathFriendlyURLPrivateUser()

getPathFriendlyURLPublic

public String getPathFriendlyURLPublic()

getPathMain

public String getPathMain()
Returns the main context path of the portal, concatenated with /c.

Returns:
the main context path of the portal

getPlid

public long getPlid()
Returns the portal layout ID of the current page of this service context.

Returns:
the portal layout ID of the current page

getPortalURL

public String getPortalURL()
Returns the URL of this service context's portal, including the protocol, domain, and non-default port relative to the company instance and any virtual host.

The URL returned does not include the port if a default port is used.

Returns:
the URL of this service context's portal, including the protocol, domain, and non-default port relative to company instance and any virtual host

getPortletId

public String getPortletId()
Returns the ID of the current portlet if this service context is being passed as a parameter to a portlet.

Returns:
the ID of the current portlet
See Also:
PortletPreferencesIds

getPortletPreferencesIds

public PortletPreferencesIds getPortletPreferencesIds()
Returns the portlet preferences IDs of the current portlet if the service context is being passed as a parameter to a portlet.

The PortletPreferencesIds can be used to look up portlet preferences of the current portlet.

Returns:
the portlet preferences IDs of the current portlet
See Also:
PortletPreferencesIds

getRemoteAddr

public String getRemoteAddr()
Returns the remote address of the user making the request in this service context.

Returns:
the remote address of the user making the request

getRemoteHost

public String getRemoteHost()
Returns the remote host name of the user making the request in this service context.

Returns:
the remote host name of the user making the request

getRequest

public javax.servlet.http.HttpServletRequest getRequest()

getResponse

public javax.servlet.http.HttpServletResponse getResponse()

getRootPortletId

public String getRootPortletId()

getScopeGroup

public Group getScopeGroup()
                    throws PortalException,
                           SystemException
Throws:
PortalException
SystemException

getScopeGroupId

public long getScopeGroupId()
Returns the ID of the group corresponding to the current data scope of this service context.

Returns:
the ID of the group corresponding to the current data scope
See Also:
Group

getThemeDisplay

public ThemeDisplay getThemeDisplay()

getTimeZone

public TimeZone getTimeZone()

getUserAgent

public String getUserAgent()
Returns the user-agent request header of this service context.

Returns:
the user-agent request header
See Also:
HttpHeaders

getUserDisplayURL

public String getUserDisplayURL()
Returns the complete URL of this service context's current user's profile page.

Returns:
the complete URL of this service context's current user's profile page

getUserId

public long getUserId()
Returns the ID of this service context's current user.

Returns:
the ID of this service context's current user

getUuid

public String getUuid()
Returns the UUID of this service context's current entity.

Returns:
the UUID of this service context's current entity

getUuidWithoutReset

public String getUuidWithoutReset()

getWorkflowAction

public int getWorkflowAction()
Returns the workflow action to take if this service context is being passed as a parameter to a method that processes a workflow action.

Returns:
the workflow action to take

isAddGroupPermissions

public boolean isAddGroupPermissions()
Returns true if this service context is being passed as a parameter to a method which manipulates a resource to which default group permissions apply.

Returns:
true if this service context is being passed as a parameter to a method which manipulates a resource to which default group permissions apply; false otherwise

isAddGuestPermissions

public boolean isAddGuestPermissions()
Returns true if this service context is being passed as a parameter to a method which manipulates a resource to which default guest permissions apply.

Returns:
true if this service context is being passed as a parameter to a method which manipulates a resource to which default guest permissions apply; false otherwise

isAssetEntryVisible

public boolean isAssetEntryVisible()

isCommandAdd

public boolean isCommandAdd()
Returns true if this service context contains an add command (i.e. has command value Constants.ADD)

Returns:
true if this service context contains an add command; false otherwise

isCommandUpdate

public boolean isCommandUpdate()
Returns true if this service context contains an update command (i.e. has command value Constants.UPDATE)

Returns:
true if this service context contains an update command; false otherwise

isDeriveDefaultPermissions

public boolean isDeriveDefaultPermissions()

isFailOnPortalException

public boolean isFailOnPortalException()
Returns true if portal exceptions should be handled as failures, possibly halting processing, or false if the exceptions should be handled differently, possibly allowing processing to continue in some manner. Services may check this flag to execute desired behavior.

Batch invocation of such services (exposed as a JSON web services) can result in execution of all service invocations, in spite of portal exceptions.

If this flag is set to false, services can implement logic that allows processing to continue, while collecting information regarding the exceptions for returning to the caller. For example, the com.liferay.portlet.asset.service.impl.AssetVocabularyServiceImpl#deleteVocabularies( long[], ServiceContext) method uses the list it returns to give information on vocabularies it fails to delete; it returns an empty list if all deletions are successful.

Returns:
true if portal exceptions are to be handled as failures; false if portal exceptions can be handled differently, possibly allowing processing to continue in some manner

isIndexingEnabled

public boolean isIndexingEnabled()
Returns whether the primary entity of this service context is to be indexed/re-indexed.

Returns:
true the primary entity of this service context is to be indexed/re-indexed; false otherwise

isSignedIn

public boolean isSignedIn()
Returns true if the sender of this service context's request is signed in.

Returns:
true if the sender of this service context's request is signed in; false otherwise

merge

public void merge(ServiceContext serviceContext)

removeAttribute

public Serializable removeAttribute(String name)
Removes the mapping of the serializable object to the name of the standard parameter of this service context.

Parameters:
name - the name of the standard parameter
Returns:
the serializable object associated to the name

setAddCommunityPermissions

public void setAddCommunityPermissions(boolean addCommunityPermissions)
Deprecated. As of 6.1.0, renamed to setAddGroupPermissions(boolean)

Sets whether or not default community permissions should apply to a resource being manipulated by a method to which this service context is passed as a parameter.

Parameters:
addCommunityPermissions - indicates whether or not to apply default community permissions

setAddGroupPermissions

public void setAddGroupPermissions(boolean addGroupPermissions)
Sets whether or not default group permissions should apply to a resource being manipulated by a method to which this service context is passed as a parameter.

Parameters:
addGroupPermissions - indicates whether or not to apply default group permissions

setAddGuestPermissions

public void setAddGuestPermissions(boolean addGuestPermissions)
Sets whether or not default guest permissions should apply to a resource being manipulated by a method to which this service context is passed as a parameter.

Parameters:
addGuestPermissions - indicates whether or not to apply default guest permissions

setAssetCategoryIds

public void setAssetCategoryIds(long[] assetCategoryIds)
Sets an array of asset category IDs to be applied to an asset entry if this service context is being passed as a parameter to a method which manipulates the asset entry.

Parameters:
assetCategoryIds - the primary keys of the asset categories

setAssetEntryVisible

public void setAssetEntryVisible(boolean assetEntryVisible)

setAssetLinkEntryIds

public void setAssetLinkEntryIds(long[] assetLinkEntryIds)
Sets an array of the primary keys of asset entries to be linked to an asset entry if this service context is being passed as a parameter to a method which manipulates the asset entry.

Parameters:
assetLinkEntryIds - the primary keys of the asset entries to be linked to an asset entry

setAssetTagNames

public void setAssetTagNames(String[] assetTagNames)
Sets an array of asset tag names to be applied to an asset entry if this service context is being passed as a parameter to a method which manipulates the asset entry.

Parameters:
assetTagNames - the tag names to be applied to an asset entry

setAttribute

public void setAttribute(String name,
                         Serializable value)
Sets a mapping of a standard parameter's name to its serializable object.

Parameters:
name - the standard parameter name to associate with the value
value - the serializable object to be associated with the name

setAttributes

public void setAttributes(Map<String,Serializable> attributes)
Sets the map of the name/value pairs that are the standard parameters of this service context. Each value must be serializable.

Parameters:
attributes - the map of the name/value pairs that are the standard parameters of this service context

setCommand

public void setCommand(String command)
Sets the value of the Constants.CMD parameter used in most Liferay forms for internal portlets.

Parameters:
command - the value of the Constants.CMD parameter

setCommunityPermissions

public void setCommunityPermissions(String[] communityPermissions)
Deprecated. As of 6.1.0, renamed to setGroupPermissions(String[])

Sets an array containing specific community permissions for a resource if this service context is being passed as a parameter to a method which manipulates the resource.

Parameters:
communityPermissions - the community permissions (optionally null)

setCompanyId

public void setCompanyId(long companyId)
Sets the company ID of this service context's current portal instance.

Parameters:
companyId - the primary key of this service context's current portal instance

setCreateDate

public void setCreateDate(Date createDate)
Sets the date when an entity was created if this service context is being passed as a parameter to a method which creates an entity.

Parameters:
createDate - the date the entity was created

setCurrentURL

public void setCurrentURL(String currentURL)
Sets the current URL of this service context

Parameters:
currentURL - the current URL of this service context

setDeriveDefaultPermissions

public void setDeriveDefaultPermissions(boolean deriveDefaultPermissions)

setExpandoBridgeAttributes

public void setExpandoBridgeAttributes(Map<String,Serializable> expandoBridgeAttributes)
Sets an arbitrary number of attributes of an entity to be persisted.

These attributes should only include fields that ServiceContext does not possess by default.

Parameters:
expandoBridgeAttributes - the expando bridge attributes (optionally null)

setFailOnPortalException

public void setFailOnPortalException(boolean failOnPortalException)
Sets whether portal exceptions should be handled as failures, possibly halting processing, or if exceptions should be handled differently, possibly allowing processing to continue in some manner.

Parameters:
failOnPortalException - whether portal exceptions should be handled as failures, or if portal exceptions should be handled differently, possibly allowing processing to continue in some manner
See Also:
isFailOnPortalException()

setFormDate

public void setFormDate(Date formDate)
Sets the date when an aui:form was generated in this service context. The form date can be used in detecting situations in which an entity has been modified while another client was editing that entity.

Example:

Person1 and person2 start editing the same version of a Web Content article. Person1 publishes changes to the article first. When person2 attempts to publish changes to that article, the service implementation finds that a modification to that article has already been published some time after person2 started editing the article. Since the article modification date was found to be later than the form date for person2, person2 could be alerted to the modification and make a backup copy of his edits before synchronizing with the published changes by person1.

Parameters:
formDate - the date that an aui:form was generated for this service context (optionally null)

setGroupPermissions

public void setGroupPermissions(String[] groupPermissions)
Sets an array containing specific group permissions for a resource if this service context is being passed as a parameter to a method which manipulates the resource.

Parameters:
groupPermissions - the permissions (optionally null)

setGuestPermissions

public void setGuestPermissions(String[] guestPermissions)
Sets an array containing specific guest permissions for a resource if this service context is being passed as a parameter to a method which manipulates the resource.

Parameters:
guestPermissions - the guest permissions (optionally null)

setHeaders

public void setHeaders(Map<String,String> headers)
Sets the map of request header name/value pairs of this service context.

Parameters:
headers - map of request header name/value pairs of this service context
See Also:
HttpHeaders

setIndexingEnabled

public void setIndexingEnabled(boolean indexingEnabled)
Sets whether the primary entity of this service context is to be indexed/re-indexed.

The entity is only indexed/re-indexed if the method receiving this service context as a parameter does indexing.

Parameters:
indexingEnabled - whether the primary entity of this service context is to be indexed/re-indexed (default is true)

setLanguageId

public void setLanguageId(String languageId)
Sets the language ID of the locale of this service context.

Parameters:
languageId - the language ID of the locale of this service context's current user

setLayoutFullURL

public void setLayoutFullURL(String layoutFullURL)
Sets the complete URL of the current page for this service context.

Parameters:
layoutFullURL - the complete URL of the current page if a page context can be determined for this service context

setLayoutURL

public void setLayoutURL(String layoutURL)
Sets the relative URL of the current page for this service context.

Parameters:
layoutURL - the relative URL of the current page if a page context can be determined for this service context

setModifiedDate

public void setModifiedDate(Date modifiedDate)
Sets the date when an entity was modified in this service context.

Parameters:
modifiedDate - the date when an entity was modified in this service context

setPathFriendlyURLPrivateGroup

public void setPathFriendlyURLPrivateGroup(String pathFriendlyURLPrivateGroup)

setPathFriendlyURLPrivateUser

public void setPathFriendlyURLPrivateUser(String pathFriendlyURLPrivateUser)

setPathFriendlyURLPublic

public void setPathFriendlyURLPublic(String pathFriendlyURLPublic)

setPathMain

public void setPathMain(String pathMain)
Sets the main context path of the portal, concatenated with /c.

Parameters:
pathMain - the main context path of the portal

setPlid

public void setPlid(long plid)
Sets the portal layout ID of the current page in this service context.

Parameters:
plid - the portal layout ID of the current page

setPortalURL

public void setPortalURL(String portalURL)
Sets the URL of this service context's portal, including the protocol, domain, and non-default port relative to the company instance and any virtual host.

The URL should not include the port if a default port is used.

Parameters:
portalURL - the portal URL

setPortletPreferencesIds

public void setPortletPreferencesIds(PortletPreferencesIds portletPreferencesIds)
Sets the portlet preferences IDs of the current portlet if this service context is being passed as a parameter to a portlet.

The PortletPreferencesIds can be used to look up portlet preferences of the current portlet.

Parameters:
portletPreferencesIds - the portlet preferences
See Also:
PortletPreferencesIds

setRemoteAddr

public void setRemoteAddr(String remoteAddr)
Sets the remote address of the user making the request in this service context.

Parameters:
remoteAddr - the remote address of the user making the request in this service context

setRemoteHost

public void setRemoteHost(String remoteHost)
Sets the remote host name of the user making the request in this service context.

Parameters:
remoteHost - the remote host name of the user making the request in this service context

setRequest

public void setRequest(javax.servlet.http.HttpServletRequest request)
Sets the optional request used when instantiating this service context. The field is volatile and so will be discarded on serialization.

Parameters:
request - the request

setScopeGroupId

public void setScopeGroupId(long scopeGroupId)
Sets the ID of the group corresponding to the current data scope of this service context.

Parameters:
scopeGroupId - the ID of the group corresponding to the current data scope of this service context
See Also:
Group

setSignedIn

public void setSignedIn(boolean signedIn)
Sets whether the sender of this service context's request is signed in.

Parameters:
signedIn - whether the sender of this service context's request is signed in

setTimeZone

public void setTimeZone(TimeZone timeZone)

setUserDisplayURL

public void setUserDisplayURL(String userDisplayURL)
Sets the complete URL of this service context's current user's profile page.

Parameters:
userDisplayURL - the complete URL of the current user's profile page

setUserId

public void setUserId(long userId)
Sets the ID of this service context's current user.

Parameters:
userId - the ID of the current user

setUuid

public void setUuid(String uuid)
Sets the UUID of this service context's current entity.

Parameters:
uuid - the UUID of the current entity

setWorkflowAction

public void setWorkflowAction(int workflowAction)
Sets the workflow action to take if this service context is being passed as parameter to a method that processes a workflow action.

Parameters:
workflowAction - workflow action to take (default is WorkflowConstants.ACTION_PUBLISH)

translate

public String translate(String pattern,
                        Object... arguments)

validateModifiedDate

public void validateModifiedDate(AuditedModel auditedModel,
                                 Class<? extends PortalException> clazz)
                          throws PortalException
Throws:
PortalException

Liferay 6.2-ce-ga5