|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.iai.ilcd.model.dao.DataSetDao<T,L,D>
T
- Element type that is accessed by this DAOL
- ListVO interface type for the accesspublic abstract class DataSetDao<T extends DataSet,L extends de.fzk.iai.ilcd.service.model.IDataSetListVO,D extends de.fzk.iai.ilcd.service.model.IDataSetVO>
Common implementation for data set DAO objects
Constructor Summary | |
---|---|
DataSetDao(java.lang.String jpaName,
java.lang.Class<T> accessedClass,
java.lang.Class<L> listVOClass,
java.lang.Class<D> voClass)
Create a data set DAO |
Method Summary | ||
---|---|---|
protected java.lang.String |
buildClassificationJoin(java.lang.String entityPrefix)
Build up join string for classification containing query (with default values for classification field name and alias prefix), example: LEFT JOIN p.classification.classes c1 LEFT JOIN p.classification.classes c2
default classification field name = classification
default alias prefix = c
|
|
protected java.lang.String |
buildClassificationJoin(java.lang.String entityPrefix,
java.lang.String classificFieldName,
java.lang.String aliasPrefix)
Build up join string for classification containing query, example: LEFT JOIN p.classification.classes c1 LEFT JOIN p.classification.classes c2
|
|
protected java.lang.String |
buildClassificationWhere(java.lang.String entityPrefix)
Build up string for classification where clause (with default values for classification field name and alias prefix), example: ( p.classification IS NULL OR (c1.level=0 AND c2.level=0) OR (c1.level=0 AND c2.level=1) )
default classification field name = classification
default alias prefix = c
|
|
protected java.lang.String |
buildClassificationWhere(java.lang.String entityPrefix,
java.lang.String classificFieldName,
java.lang.String aliasPrefix)
Build up string for classification where clause, example: ( p.classification IS NULL OR (c1.level=0 AND c2.level=0) OR (c1.level=0 AND c2.level=1) )
|
|
boolean |
checkAndPersist(T dataSet,
PersistType pType,
java.io.PrintWriter out)
Generic persist method for data set objects. |
|
protected abstract javax.persistence.Query |
createQueryObject(org.apache.velocity.tools.generic.ValueParser params,
java.lang.String sortCriterium,
boolean ascending,
boolean returnCount,
boolean mostRecentVersionOnly)
This method must be implemented by each dao class extending this class. |
|
protected java.lang.Class<T> |
getAccessedClass()
Get the class accessed by this DAO |
|
java.util.List<T> |
getAll()
Get all data sets in the persistence unit of the represented type T |
|
java.lang.Long |
getAllCount()
Get the count of elements in the database for type T |
|
java.util.List<T> |
getByClass(java.lang.String mainClass)
Get data sets of type T by main class |
|
java.util.List<T> |
getByClass(java.lang.String mainClass,
java.lang.String subClass)
Get data sets of type T by main and sub class |
|
T |
getByDataSetId(long id)
Get the data set of type T by JPA id |
|
T |
getByDataSetId(java.lang.String id)
Get the data set of type T by JPA id |
|
T |
getByUuid(java.lang.String uuid)
Get a the most recent data set of type T by UUID string |
|
T |
getByUuidAndVersion(java.lang.String uuid,
DataSetVersion version)
Get data set by UUID string and version |
|
java.util.List<T> |
getDataSets(int startIndex,
int pageSize)
Get pageSize data sets starting on startIndex |
|
D |
getForeignDataSet(java.lang.String nodeShortName,
java.lang.String uuid)
Get a foreign data set |
|
protected java.lang.String |
getJpaName()
Get the name in JPA of class |
|
long |
getNumberByClass(java.lang.String mainClass)
Get number of data sets of type T by main class |
|
long |
getNumberByClass(java.lang.String mainClass,
java.lang.String subClass)
Get data sets of type T by main and sub class |
|
java.util.List<T> |
getOtherVersions(T current)
Get all other versions of this data set |
|
java.util.List<java.lang.String> |
getSubClasses(java.lang.String className,
java.lang.String level)
Get the sub classes for provided class name and level |
|
java.util.List<java.lang.String> |
getTopClasses()
Get the top classes for the data set type T |
|
java.util.List<T> |
lsearch(org.apache.velocity.tools.generic.ValueParser params)
This method (local serach) works as search method for datasets only on local database entities, i.e. |
|
java.util.List<T> |
lsearch(org.apache.velocity.tools.generic.ValueParser params,
int startPosition,
int pageSize,
java.lang.String sortCriterium,
boolean mostRecentVersionOnly)
This method (local lsearch) works as lsearch method for datasets only on local database entities, i.e. |
|
java.util.List<T> |
lsearch(org.apache.velocity.tools.generic.ValueParser params,
int startPosition,
int pageSize,
java.lang.String sortCriterium,
boolean ascending,
boolean mostRecentVersionOnly)
This method (local lsearch) works as lsearch method for datasets only on local database entities, i.e. |
|
void |
merge(DataSet dataSet)
|
|
protected abstract void |
preCheckAndPersist(T dataSet)
Invoked at beginning of checkAndPersist(DataSet, PersistType, PrintWriter) to manipulate data prior to
persisting |
|
void |
remove(DataSet dataSet)
Remove a given data set from the database |
|
|
search(java.lang.Class<E> dataSetClassType,
org.apache.velocity.tools.generic.ValueParser params,
boolean mostRecentVersionOnly)
This search method can also be used for distributed search because it uses the common interface types of the ServiceAPI For a version without the dataSetClassType parameter look in the subclasses |
|
|
search(java.lang.Class<E> dataSetClassType,
org.apache.velocity.tools.generic.ValueParser params,
int startPosition,
int pageSize,
java.lang.String sortCriterium,
boolean mostRecentVersionOnly)
This search method can also be used for distributed search because it uses the common interface types of the ServiceAPI |
|
|
search(java.lang.Class<E> dataSetClassType,
org.apache.velocity.tools.generic.ValueParser params,
int startPosition,
int pageSize,
java.lang.String sortCriterium,
boolean ascending,
boolean mostRecentVersionOnly)
This search method can also be used for distributed search because it uses the common interface types of the ServiceAPI |
|
java.util.List<L> |
search(org.apache.velocity.tools.generic.ValueParser params,
boolean mostRecentVersionOnly)
Search for data sets of type T |
|
java.util.List<L> |
search(org.apache.velocity.tools.generic.ValueParser params,
int startIndex,
int pageSize,
boolean mostRecentVersionOnly)
Search for data sets of type T |
|
long |
searchResultCount(org.apache.velocity.tools.generic.ValueParser params,
boolean mostRecentVersionOnly)
Get result count for lsearch call |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataSetDao(java.lang.String jpaName, java.lang.Class<T> accessedClass, java.lang.Class<L> listVOClass, java.lang.Class<D> voClass)
jpaName
- the name in JPA of classaccessedClass
- the class accessed by this DAOlistVOClass
- the interface based on ILCIAMethodListVO
for the accessed classMethod Detail |
---|
protected java.lang.String getJpaName()
protected java.lang.Class<T> getAccessedClass()
public java.util.List<T> getAll()
public java.lang.Long getAllCount()
public java.util.List<T> getDataSets(int startIndex, int pageSize)
pageSize
data sets starting on startIndex
startIndex
- pageSize
-
public T getByUuidAndVersion(java.lang.String uuid, DataSetVersion version)
uuid
- the UUID stringversion
- the version of the method
null
if none foundpublic T getByUuid(java.lang.String uuid)
uuid
- the UUID string
null
if none foundpublic java.util.List<T> getOtherVersions(T current)
public T getByDataSetId(long id)
id
- id of the data set
public T getByDataSetId(java.lang.String id)
id
- id of the data set as string
public java.util.List<java.lang.String> getTopClasses()
public java.util.List<java.lang.String> getSubClasses(java.lang.String className, java.lang.String level)
className
- class namelevel
- level
public java.util.List<T> getByClass(java.lang.String mainClass)
mainClass
- the main class to get data sets by
public long getNumberByClass(java.lang.String mainClass)
mainClass
- the main class to get data sets by
public java.util.List<T> getByClass(java.lang.String mainClass, java.lang.String subClass)
mainClass
- the main class to get data sets bysubClass
- the sub class to get data sets by
public long getNumberByClass(java.lang.String mainClass, java.lang.String subClass)
mainClass
- the main class to get data sets bysubClass
- the sub class to get data sets by
public java.util.List<L> search(org.apache.velocity.tools.generic.ValueParser params, boolean mostRecentVersionOnly)
params
- parametermostRecentVersionOnly
- flag to indicate if only the most recent version of a data set shall be returned if multiple versions
exist
public java.util.List<L> search(org.apache.velocity.tools.generic.ValueParser params, int startIndex, int pageSize, boolean mostRecentVersionOnly)
params
- parameterstartIndex
- start index for querypageSize
- count of result itemsmostRecentVersionOnly
- flag to indicate if only the most recent version of a data set shall be returned if multiple versions
exist
protected abstract void preCheckAndPersist(T dataSet)
checkAndPersist(DataSet, PersistType, PrintWriter)
to manipulate data prior to
persisting
dataSet
- data set to manipulatecheckAndPersist(DataSet, PersistType, PrintWriter)
public boolean checkAndPersist(T dataSet, PersistType pType, java.io.PrintWriter out)
dataSet
- data set to persistpType
- which type of persistence operation, new, update (i.e. overwrite existing data set), ...out
- PrintWriter to log error messages which can be presented to the end user
preCheckAndPersist(DataSet)
public java.util.List<T> lsearch(org.apache.velocity.tools.generic.ValueParser params)
T
- Class name of "type" of objects to return, i.e. Process, Flow, ...params
- search parameters as key-value pairs
public java.util.List<T> lsearch(org.apache.velocity.tools.generic.ValueParser params, int startPosition, int pageSize, java.lang.String sortCriterium, boolean mostRecentVersionOnly)
T
- Class name of "type" of objects to return, i.e. Process, Flow, ...params
- lsearch parameters as key-value pairsstartPosition
- start index within the whole list of lsearch resultspageSize
- pages size, i.e. maximum count of results to returnsortCriterium
- name of the objects field which should be used for sortingmostRecentVersionOnly
- flag to indicate if only the most recent version of a data set shall be returned if multiple versions
exist
public java.util.List<T> lsearch(org.apache.velocity.tools.generic.ValueParser params, int startPosition, int pageSize, java.lang.String sortCriterium, boolean ascending, boolean mostRecentVersionOnly)
T
- Class name of "type" of objects to return, i.e. Process, Flow, ...params
- lsearch parameters as key-value pairsstartPosition
- start index within the whole list of lsearch resultspageSize
- pages size, i.e. maximum count of results to returnsortCriterium
- name of the objects field which should be used for sortingascending
- define ordering of resultmostRecentVersionOnly
- flag to indicate if only the most recent version of a data set shall be returned if multiple versions
exist
public <E extends de.fzk.iai.ilcd.service.model.IDataSetListVO> java.util.List<E> search(java.lang.Class<E> dataSetClassType, org.apache.velocity.tools.generic.ValueParser params, boolean mostRecentVersionOnly)
E
- interface name of "type" of objects to return, i.e. IProcessListVO, IFlowListVo, ...dataSetClassType
- Class object of T, i.e. IProcessListVO.classparams
- search parametermostRecentVersionOnly
- flag to indicate if only the most recent version of a data set shall be returned if multiple versions
exist
public <E extends de.fzk.iai.ilcd.service.model.IDataSetListVO> java.util.List<E> search(java.lang.Class<E> dataSetClassType, org.apache.velocity.tools.generic.ValueParser params, int startPosition, int pageSize, java.lang.String sortCriterium, boolean mostRecentVersionOnly)
E
- interface name of "type" of objects to return, i.e. IProcessListVO, IFlowListVo, ...dataSetClassType
- Class object of T, i.e. IProcessListVO.classparams
- search parameter as ParameterTool objectstartPosition
- start index for first search resultpageSize
- size of one page of search resultssortCriterium
- field name of object which is used for orderingmostRecentVersionOnly
- flag to indicate if only the most recent version of a data set shall be returned if multiple versions
exist
public <E extends de.fzk.iai.ilcd.service.model.IDataSetListVO> java.util.List<E> search(java.lang.Class<E> dataSetClassType, org.apache.velocity.tools.generic.ValueParser params, int startPosition, int pageSize, java.lang.String sortCriterium, boolean ascending, boolean mostRecentVersionOnly)
E
- interface name of "type" of objects to return, i.e. IProcessListVO, IFlowListVo, ...dataSetClassType
- Class object of T, i.e. IProcessListVO.classparams
- search parameter as ParameterTool objectstartPosition
- start index for first search resultpageSize
- size of one page of search resultssortCriterium
- field name of object which is used for orderingascending
- define the ordering of the resultmostRecentVersionOnly
- flag to indicate if only the most recent version of a data set shall be returned if multiple versions
exist
public long searchResultCount(org.apache.velocity.tools.generic.ValueParser params, boolean mostRecentVersionOnly)
params
- lsearch parametersmostRecentVersionOnly
- flag to indicate if only the most recent version of a data set shall be returned if multiple versions
exist
protected abstract javax.persistence.Query createQueryObject(org.apache.velocity.tools.generic.ValueParser params, java.lang.String sortCriterium, boolean ascending, boolean returnCount, boolean mostRecentVersionOnly)
params
- lsearch parametersortCriterium
- field of result object which will be used for ordering of lsearch resultsreturnCount
- if true return count of lsearch result instead of lsearch resultsascending
- true
for ascending ordering, false
for descendingmostRecentVersionOnly
- flag to indicate if only the most recent version of a data set shall be returned if multiple versions
exist
public void remove(DataSet dataSet) throws DeleteDataSetException
dataSet
- data set to be removed
DeleteDataSetException
public void merge(DataSet dataSet) throws MergeException
MergeException
public D getForeignDataSet(java.lang.String nodeShortName, java.lang.String uuid)
nodeShortName
- short name / id of remote nodeuuid
- uuid of data set
protected java.lang.String buildClassificationWhere(java.lang.String entityPrefix)
Build up string for classification where clause (with default values for classification field name and alias prefix), example:
( p.classification IS NULL OR (c1.level=0 AND c2.level=0) OR (c1.level=0 AND c2.level=1) )
classification
c
entityPrefix
- prefix of the entity, in example it is p
buildClassificationWhere(String, String, String)
protected java.lang.String buildClassificationWhere(java.lang.String entityPrefix, java.lang.String classificFieldName, java.lang.String aliasPrefix)
Build up string for classification where clause, example:
( p.classification IS NULL OR (c1.level=0 AND c2.level=0) OR (c1.level=0 AND c2.level=1) )
entityPrefix
- prefix of the entity, in example it is p
classificFieldName
- name of the classification field in the entity, in example it is classification
aliasPrefix
- alias prefix for the left joined references, in example it is c
protected java.lang.String buildClassificationJoin(java.lang.String entityPrefix)
Build up join string for classification containing query (with default values for classification field name and alias prefix), example:
LEFT JOIN p.classification.classes c1 LEFT JOIN p.classification.classes c2
classification
c
entityPrefix
- prefix of the entity, in example it is p
buildClassificationJoin(String, String, String)
protected java.lang.String buildClassificationJoin(java.lang.String entityPrefix, java.lang.String classificFieldName, java.lang.String aliasPrefix)
Build up join string for classification containing query, example:
LEFT JOIN p.classification.classes c1 LEFT JOIN p.classification.classes c2
entityPrefix
- prefix of the entity, in example it is p
classificFieldName
- name of the classification field in the entity, in example it is classification
aliasPrefix
- alias prefix for the left joined references, in example it is c
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |