Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.endeca.portlet.util
Class EndecaPortletUtil

    java.lang.Object
      com.endeca.portlet.util.EndecaPortletUtil

    public class EndecaPortletUtil

extends java.lang.Object

Author:
  Endeca Technologies, Inc. Contains various utility methods used by `EndecaPortlet`.

Constructor Summary
`EndecaPortletUtil()`

Method Summary
`static DataSource` | `getDataSource(javax.portlet.PortletRequest request)` Retrieve the DataSource that this portlet listens to.
`static java.lang.String` | `getDataSourceId(javax.portlet.PortletRequest request)` Retrieve the dataSourceId of the data source that this portlet listens to.
`static java.lang.String` | `getDefaultDataSourceId()` Retrieves the value of the default data source
`static java.lang.String` | `getDefaultLocale(Container container)` Returns the default locale for the container.
`static java.lang.String` | `getDisplayName(DataSource dataSource, java.lang.String key)` Retrieves the global display name for the specified attribute
`static java.lang.String` | `getDisplayName(javax.portlet.PortletRequest request, java.lang.String key)` Retrieves the global display name for the specified attribute
`static java.lang.String` | `getFullyQualifiedTransitionContext(javax.portlet.PortletRequest request, java.lang.String viewTransitionPageContext)` Returns a fully-qualified target page context path.
`static java.lang.String` | `getMetadataDisplayName(java.lang.String dataSourceId, java.lang.String key)` Portlets should not call this method directly!
`static java.lang.String` | `getRequestLocale(javax.portlet.PortletRequest request, Container container)` Returns the locale to be used for the current request.
`static boolean` | `hasPrivilege(javax.portlet.PortletRequest request, Container container, java.lang.String privilege)`
`static boolean` | `hasUpdatePrivileges(javax.portlet.PortletRequest request, Container container)`
`static boolean` | `hasViewPrivileges(javax.portlet.PortletRequest request, Container container)`
`static boolean` | `isLiferay(Container container)`
`static void` | `writeJSONArrayResponse(org.json.JSONArray jsonArr, javax.portlet.ResourceResponse response)` Convenience method for outputting a JSONArray to a resource response.
`static void` | `writeJSONResponse(org.json.JSONObject jsonObj, javax.portlet.RenderResponse response)`
`static void` | `writeJSONResponse(org.json.JSONObject jsonObj, javax.portlet.RenderResponse response, java.lang.String callback)` Convenience method for outputting a JSONObject to a render response, with the name of a JavaScript callback function to be appended to the JSON response.
`static void` | `writeJSONResponse(org.json.JSONObject jsonObj, javax.portlet.ResourceResponse response)` Convenience method for outputting a JSONObject to a resource response.
`static void` | `writeJSONResponse(org.json.JSONObject jsonObj, javax.portlet.ResourceResponse response, java.lang.String callback)` Convenience method for outputting a JSONObject to a resource response, with the name of a JavaScript callback function to be appended to the JSON response.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### EndecaPortletUtil

    public EndecaPortletUtil()

Method Detail

### hasPrivilege

    public static boolean hasPrivilege(javax.portlet.PortletRequest request,
                                       Container container,
                                       java.lang.String privilege)

### hasUpdatePrivileges

    public static boolean hasUpdatePrivileges(javax.portlet.PortletRequest request,
                                              Container container)

### hasViewPrivileges

    public static boolean hasViewPrivileges(javax.portlet.PortletRequest request,
                                            Container container)

### isLiferay

    public static boolean isLiferay(Container container)

### getDataSource

    public static DataSource getDataSource(javax.portlet.PortletRequest request)

  Retrieve the DataSource that this portlet listens to. Returns null if the data source could not be retrieved.

  Parameters:
    `request` - the current request
  Returns:
    the DataSource

### getDataSourceId

    public static java.lang.String getDataSourceId(javax.portlet.PortletRequest request)

  Retrieve the dataSourceId of the data source that this portlet listens to.

  Parameters:
    `request` - the current request
  Returns:
    the dataSourceId

### getDisplayName

    public static java.lang.String getDisplayName(javax.portlet.PortletRequest request,
                                                  java.lang.String key)

  Retrieves the global display name for the specified attribute

  Parameters:
    `request` - the current request
    `key` - the attribute for which to fetch a display name
  Returns:
    the display name for the attribute, or the attribute name if no display name was found

### getDisplayName

    public static java.lang.String getDisplayName(DataSource dataSource,
                                                  java.lang.String key)

  Retrieves the global display name for the specified attribute

  Parameters:
    `dataSource` - the current datasource
    `key` - the attribute for which to fetch a display name
  Returns:
    the display name for the attribute, or the attribute name if no display name was found

### getMetadataDisplayName

    public static java.lang.String getMetadataDisplayName(java.lang.String dataSourceId,
                                                          java.lang.String key)

  Portlets should not call this method directly! Utility method to retrieve the display name directly from the metadata layer. Valid only for MDEX 6 data sources.

  Parameters:
    `dataSourceId` - the data source containing the target attribute
    `key` - the name of the target attribute
  Returns:
    the display name, as calculated from the metadata layer.

### getDefaultLocale

    public static java.lang.String getDefaultLocale(Container container)

  Returns the default locale for the container.

  Parameters:
    `container` - the current container
  Returns:
    the locale

### getRequestLocale

    public static java.lang.String getRequestLocale(javax.portlet.PortletRequest request,
                                                    Container container)

  Returns the locale to be used for the current request.

  Parameters:
    `request` - the request
    `container` - the current container
  Returns:
    the locale

### getDefaultDataSourceId

    public static java.lang.String getDefaultDataSourceId()

  Retrieves the value of the default data source

  Returns:
    the default data source

### getFullyQualifiedTransitionContext

    public static java.lang.String getFullyQualifiedTransitionContext(javax.portlet.PortletRequest request,
                                                                      java.lang.String viewTransitionPageContext)

  Returns a fully-qualified target page context path. If the specified viewTransitionPageContext parameter starts with "/", the path is returned unchanged. If it does not, the path is appended to the default context path, as defined in `Constants.VIEW_TRANSITION_DEFAULT_CONTEXT`.

### writeJSONResponse

    public static void writeJSONResponse(org.json.JSONObject jsonObj,
                                         javax.portlet.RenderResponse response)
                                  throws java.io.IOException

  Throws:
    `java.io.IOException`

### writeJSONResponse

    public static void writeJSONResponse(org.json.JSONObject jsonObj,
                                         javax.portlet.RenderResponse response,
                                         java.lang.String callback)
                                  throws java.io.IOException

  Convenience method for outputting a JSONObject to a render response, with the name of a JavaScript callback function to be appended to the JSON response.

  Parameters:
    `jsonObj` - the JSON Object
    `response` - the render response
    `callback` - the name of the JavaScript callback function
  Throws:
    `java.io.IOException`

### writeJSONResponse

    public static void writeJSONResponse(org.json.JSONObject jsonObj,
                                         javax.portlet.ResourceResponse response)
                                  throws java.io.IOException

  Convenience method for outputting a JSONObject to a resource response.

  Parameters:
    `jsonObj` - the JSON Object
    `response` - the resource response
  Throws:
    `java.io.IOException`

### writeJSONResponse

    public static void writeJSONResponse(org.json.JSONObject jsonObj,
                                         javax.portlet.ResourceResponse response,
                                         java.lang.String callback)
                                  throws java.io.IOException

  Convenience method for outputting a JSONObject to a resource response, with the name of a JavaScript callback function to be appended to the JSON response.

  Parameters:
    `jsonObj` - the JSON Object
    `response` - the resource response
    `callback` - the name of the JavaScript callback function
  Throws:
    `java.io.IOException`

### writeJSONArrayResponse

    public static void writeJSONArrayResponse(org.json.JSONArray jsonArr,
                                              javax.portlet.ResourceResponse response)
                                       throws java.io.IOException

  Convenience method for outputting a JSONArray to a resource response.

  Parameters:
    `jsonArr` - the JSON Array
    `response` - the resource response
  Throws:
    `java.io.IOException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD