pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.component.core.accesscontrol.admin
Class AbstractAccessControlEditor

java.lang.Object
  extended by org.torweg.pulse.bundle.Controller
      extended by org.torweg.pulse.component.core.accesscontrol.admin.AbstractAccessControlEditor
Direct Known Subclasses:
AttributeRegistryEditor, CommandMatcherEditor, GroupEditor, PermissionEditor, RoleEditor, UserEditor, VFSPermissionEditor

public abstract class AbstractAccessControlEditor
extends Controller

Base-class to derive access-control-editors from. Provides utility-methods.

Version:
$Revision: 2013 $
Author:
Daniel Dietz

Nested Class Summary
 
Nested classes/interfaces inherited from class org.torweg.pulse.bundle.Controller
Controller.AlwaysRun
 
Field Summary
protected static org.slf4j.Logger LOGGER
          the Logger.
 
Constructor Summary
AbstractAccessControlEditor()
           
 
Method Summary
protected  org.hibernate.criterion.Criterion buildCriterionFromRequest(ServiceRequest request, java.lang.String parameterName, java.lang.String propertyName)
          builds Restrictions.ilike from request-parameter for given property-name with MatchMode.ANYWHERE.
protected  org.hibernate.criterion.Criterion buildIdCriterionFromRequest(ServiceRequest request)
          builds Restrictions.idEq from request.
protected  org.hibernate.Criteria buildLoadAssorterCriteria(ServiceRequest request, boolean unasoc, org.hibernate.Session s, java.util.List<java.lang.Long> ids, java.lang.Class<? extends AbstractBasicEntity> clazz)
          builds the Criteria for the assorter to load the joined entities.
protected  org.hibernate.Criteria buildLoadAssorterCriteria(ServiceRequest request, boolean unasoc, org.hibernate.Session s, java.lang.Long id, java.lang.Class<? extends AbstractBasicEntity> clazz, java.lang.String alias)
          builds the Criteria for the assorter to load the contained entities.
protected  java.lang.String getReqParamIgnoreEmptyValue(ServiceRequest request, java.lang.String parameterName)
          returns the parameter-value or "", null if request-parameter parameterName is null.
protected  java.lang.String getReqParamOrNullIfValueEmpty(ServiceRequest request, java.lang.String parameterName)
          returns the parameter-value; null if request-parameter parameterName is null or "".
protected  net.sf.json.JSONArray loadAssorterData(ServiceRequest request, java.lang.Class<? extends AbstractBasicEntity> clazz, java.lang.String alias)
          Loads the assorter-data for the contained entities.
protected  net.sf.json.JSONArray loadAssorterData(ServiceRequest request, org.hibernate.Session s, java.lang.Class<? extends AbstractAccessControlObject> clazz, java.util.List<java.lang.Long> ids)
          Loads the assorter-data for the joined entities.
protected  long processCriteriaForPaging(ServiceRequest request, org.hibernate.Criteria criteria)
          returns the total number of results for the current criteria as integer and applies paging-start/limit to the criteria.
protected  java.util.List<java.lang.Object> retrieveAssorterObjects(java.lang.String identifier, ServiceRequest request, java.lang.String clazz, org.hibernate.Session s)
           
 
Methods inherited from class org.torweg.pulse.bundle.Controller
getAlwaysRun, isAlwaysRun, setAlwaysRun
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

protected static final org.slf4j.Logger LOGGER
the Logger.

Constructor Detail

AbstractAccessControlEditor

public AbstractAccessControlEditor()
Method Detail

loadAssorterData

protected final net.sf.json.JSONArray loadAssorterData(ServiceRequest request,
                                                       java.lang.Class<? extends AbstractBasicEntity> clazz,
                                                       java.lang.String alias)
Loads the assorter-data for the contained entities.

Parameters:
request - the ServiceRequest
clazz - the Class&lt;? extends AbstractBasicEntity&gt;
alias - the alias to be used
Returns:
a JSONArray with the data

loadAssorterData

protected final net.sf.json.JSONArray loadAssorterData(ServiceRequest request,
                                                       org.hibernate.Session s,
                                                       java.lang.Class<? extends AbstractAccessControlObject> clazz,
                                                       java.util.List<java.lang.Long> ids)
Loads the assorter-data for the joined entities.

Parameters:
request - the ServiceRequest
s - the hibernateTM-Session
clazz - the Class&lt;? extends AbstractAccessControlObject&gt;
ids - the ids
Returns:
the data-JSONArray

buildLoadAssorterCriteria

protected final org.hibernate.Criteria buildLoadAssorterCriteria(ServiceRequest request,
                                                                 boolean unasoc,
                                                                 org.hibernate.Session s,
                                                                 java.lang.Long id,
                                                                 java.lang.Class<? extends AbstractBasicEntity> clazz,
                                                                 java.lang.String alias)
builds the Criteria for the assorter to load the contained entities.

Parameters:
request - the current ServiceRequest
unasoc - true to retrieve criteria for loading of Class&lt;? extends AbstractBasicEntity&gt;s, false for criteria for loading of UN-associated Class&lt;? extends AbstractBasicEntity&gt;s
s - the current Session
id - the id
clazz - the Class&lt;? extends AbstractBasicEntity&gt;
alias - the field in the clazz
Returns:
the built Criteria

buildLoadAssorterCriteria

protected final org.hibernate.Criteria buildLoadAssorterCriteria(ServiceRequest request,
                                                                 boolean unasoc,
                                                                 org.hibernate.Session s,
                                                                 java.util.List<java.lang.Long> ids,
                                                                 java.lang.Class<? extends AbstractBasicEntity> clazz)
builds the Criteria for the assorter to load the joined entities.

Parameters:
request - the current ServiceRequest
unasoc - true to retrieve criteria for loading of associated Class&lt;? extends AbstractBasicEntity&gt;s, false for criteria for loading of UN-associated Class&lt;? extends AbstractBasicEntity&gt;s
s - the current Session
ids - the ids
clazz - the Class&lt;? extends AbstractBasicEntity&gt;
Returns:
the built Criteria

retrieveAssorterObjects

protected final java.util.List<java.lang.Object> retrieveAssorterObjects(java.lang.String identifier, ServiceRequest request,
                                                                         java.lang.String clazz,
                                                                         org.hibernate.Session s)
Parameters:
identifier - further identifies the request-parameter to look for
request - the current ServiceRequest
clazz - the class to load
s - the current Session
Returns:
the list of the loaded objects defined by clazz

buildCriterionFromRequest

protected final org.hibernate.criterion.Criterion buildCriterionFromRequest(ServiceRequest request,
                                                                            java.lang.String parameterName,
                                                                            java.lang.String propertyName)
builds Restrictions.ilike from request-parameter for given property-name with MatchMode.ANYWHERE.

Parameters:
request - the current ServiceRequest
parameterName - the name of the request-parameter
propertyName - the name of the property
Returns:
a Criterion if request-parameter name != '' or null, null otherwise

buildIdCriterionFromRequest

protected final org.hibernate.criterion.Criterion buildIdCriterionFromRequest(ServiceRequest request)
builds Restrictions.idEq from request.

Parameters:
request - the current ServiceRequest
Returns:
a Criterion if request-parameter id != '' or null, null otherwise

processCriteriaForPaging

protected final long processCriteriaForPaging(ServiceRequest request,
                                              org.hibernate.Criteria criteria)
returns the total number of results for the current criteria as integer and applies paging-start/limit to the criteria.

Parameters:
request - the current ServiceRequest
criteria - the criteria
Returns:
the total number of results for the current criteria as integer

getReqParamOrNullIfValueEmpty

protected final java.lang.String getReqParamOrNullIfValueEmpty(ServiceRequest request,
                                                               java.lang.String parameterName)
returns the parameter-value; null if request-parameter parameterName is null or "".

Parameters:
request - the current ServiceRequest
parameterName - the name of the request-parameter
Returns:
the parameter-value, null if request-parameter parameterName is null or ""

getReqParamIgnoreEmptyValue

protected final java.lang.String getReqParamIgnoreEmptyValue(ServiceRequest request,
                                                             java.lang.String parameterName)
returns the parameter-value or "", null if request-parameter parameterName is null.

Parameters:
request - the current ServiceRequest
parameterName - the name of the request-parameter
Returns:
the parameter-value or "", null if request-parameter parameterName is null