/**
* @return
*/
- public List<UuidAndTitleCache<Institution>> getInstitutionUuidAndTitleCache();
+ public List<UuidAndTitleCache<Institution>> getInstitutionUuidAndTitleCache(Integer limit, String pattern);
/**
* @param limit
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
import eu.etaxonomy.cdm.model.common.Annotation;
-import eu.etaxonomy.cdm.model.common.MarkerType;
import eu.etaxonomy.cdm.model.common.Marker;
+import eu.etaxonomy.cdm.model.common.MarkerType;
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
+import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.query.OrderHint;
/**
* @version 1.0
*/
public interface IAnnotatableDao<T extends AnnotatableEntity> extends IVersionableDao<T>{
-
+
/**
* Returns a List of Annotations belonging to the supplied AnnotatableEntity
- *
+ *
* @param annotatableEntity the entity which is annotated
* @param status The status of the annotations (null to return annotations regardless of status)
* @param pageSize The maximum number of annotations returned (can be null for all annotations)
* @return a List of Annotation instances
*/
public List<Annotation> getAnnotations(T annotatableEntity, MarkerType status, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
-
+
/**
* Returns a count of Annotations belonging to the supplied AnnotatableEntity
- *
+ *
* @param annotatableEntity the entity which is annotated
* @param status The status of the annotations (null to count all annotations regardless of status)
* @return a count of Annotation instances
*/
public int countAnnotations(T annotatableEntity, MarkerType status);
-
+
/**
- * Returns a count of Markers belonging to the supplied AnnotatableEntity
- *
+ * Returns a count of Markers belonging to the supplied AnnotatableEntity
+ *
* @param annotatableEntity the entity which is marked
* @param technical The type of MarkerTypes to consider (null to count all markers, regardless of whether the makerType is technical or not)
* @return a count of Marker instances
*/
public int countMarkers(T annotatableEntity, Boolean technical);
-
+
/**
- *
+ *
* @param annotatableEntity the entity which is marked
* @param technical The type of MarkerTypes to consider (null to count all markers, regardless of whether the makerType is technical or not)
* @param pageSize The maximum number of markers returned (can be null for all markers)
*/
public List<Marker> getMarkers(T annotatableEntity, Boolean technical, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
/**
- * Returns a list of arrays representing counts of entities of type clazz, grouped by their markerTypes. The arrays have two elements.
+ * Returns a list of arrays representing counts of entities of type clazz, grouped by their markerTypes. The arrays have two elements.
* The first element is the MarkerType, initialized using the propertyPaths parameter. The second element is the count of all markers of Objects
* of type clazz with that MarkerType. The boolean technical can be used to choose only technical or only non-technical marker types. The list is sorted by
* titleCache of the markerType, in ascending order.
- *
+ *
* @param clazz optionally restrict the markers to those belonging to this class
* @param technical The type of MarkerTypes to consider (null to count all markers, regardless of whether the makerType is technical or not)
* @param pageSize The maximum number of arrays returned (can be null for all arrays)
* @return
*/
public List<Object[]> groupMarkers(Class<? extends T> clazz, Boolean technical, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
-
+
/**
* returns a count of all markers belonging to that clazz, optionally filtered to include only technical or only non-technical markers.
- *
+ *
* @param clazz optionally restrict the markers to those belonging to this class
* @param technical The type of MarkerTypes to consider (null to count all markers, regardless of whether the makerType is technical or not)
* @return a count of markers
*/
public int countMarkers(Class<? extends T> clazz, Boolean technical);
+
+ /**
+ * Return a list of all uuids mapped to titleCache in the convenient <code>UuidAndTitleCache</code> object.
+ * Retrieving this list is considered to be significantly faster than initializing the fully fledged buiseness
+ * objects. To be used in cases where you want to present large amount of data and provide details after
+ * a selection has been made.
+ *
+ * @return a list of <code>UuidAndTitleCache</code> instances
+ * @see #getUuidAndTitleCache(Class, Integer, String)
+ */
+ public List<UuidAndTitleCache<T>> getUuidAndTitleCache(Integer limit, String pattern);
+
+ /**
+ * Like {@link #getUuidAndTitleCache(Integer, String)} but searching only on a subclass
+ * of the type handled by the DAO.
+ *
+ * @param clazz the (sub)class
+ * @param limit max number of results
+ * @param pattern search pattern
+
+ * @see #getUuidAndTitleCache(Integer, String)
+ */
+ public <S extends T> List<UuidAndTitleCache<S>> getUuidAndTitleCache(Class<S> clazz, Integer limit, String pattern);
+
+
+ /**
+ * Return a list of all uuids mapped to titleCache in the convenient <code>UuidAndTitleCache</code> object.
+ * Retrieving this list is considered to be significantly faster than initializing the fully fledged buiseness
+ * objects. To be used in cases where you want to present large amount of data and provide details after
+ * a selection has been made.
+ *
+ * @return a list of <code>UuidAndTitleCache</code> instances
+ */
+ public List<UuidAndTitleCache<T>> getUuidAndTitleCache();
}
import eu.etaxonomy.cdm.model.common.MarkerType;
import eu.etaxonomy.cdm.model.media.Rights;
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
-import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.query.MatchMode;
import eu.etaxonomy.cdm.persistence.query.OrderHint;
// TODO Migrated from IOriginalSourceDao
public List<T> findOriginalSourceByIdInSource(String idInSource, String idNamespace);
- /**
- * Return a list of all uuids mapped to titleCache in the convenient <code>UuidAndTitleCache</code> object.
- * Retrieving this list is considered to be significantly faster than initializing the fully fledged buiseness
- * objects. To be used in cases where you want to present large amount of data and provide details after
- * a selection has been made.
- *
- * @return a list of <code>UuidAndTitleCache</code> instances
- * @see #getUuidAndTitleCache(Class, Integer, String)
- */
- public List<UuidAndTitleCache<T>> getUuidAndTitleCache(Integer limit, String pattern);
-
- /**
- * Like {@link #getUuidAndTitleCache(Integer, String)} but searching only on a subclass
- * of the type handled by the DAO.
- *
- * @param clazz the (sub)class
- * @param limit max number of results
- * @param pattern search pattern
- * @see #getUuidAndTitleCache(Integer, String)
- */
- public <S extends T> List<UuidAndTitleCache<S>> getUuidAndTitleCache(Class<S> clazz, Integer limit, String pattern);
-
-
- /**
- * Return a list of all uuids mapped to titleCache in the convenient <code>UuidAndTitleCache</code> object.
- * Retrieving this list is considered to be significantly faster than initializing the fully fledged buiseness
- * objects. To be used in cases where you want to present large amount of data and provide details after
- * a selection has been made.
- *
- * @return a list of <code>UuidAndTitleCache</code> instances
- */
- public List<UuidAndTitleCache<T>> getUuidAndTitleCache();
/**
* Returns the titleCache for a given object defined by uuid.
}
@Override
- public List<UuidAndTitleCache<Institution>> getInstitutionUuidAndTitleCache() {
+ public List<UuidAndTitleCache<Institution>> getInstitutionUuidAndTitleCache(Integer limit, String pattern) {
Query query = getSession().createQuery("select uuid, id, titleCache from " + type.getSimpleName() + " where dtype = 'Institution'");
return getUuidAndTitleCache(query);
}
package eu.etaxonomy.cdm.persistence.dao.hibernate.common;
+import java.util.ArrayList;
import java.util.List;
+import java.util.UUID;
import org.apache.log4j.Logger;
import org.hibernate.Query;
+import org.hibernate.Session;
import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
import eu.etaxonomy.cdm.model.common.Annotation;
+import eu.etaxonomy.cdm.model.common.IAnnotatableEntity;
import eu.etaxonomy.cdm.model.common.Marker;
import eu.etaxonomy.cdm.model.common.MarkerType;
import eu.etaxonomy.cdm.persistence.dao.common.IAnnotatableDao;
+import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.query.OrderHint;
import eu.etaxonomy.cdm.persistence.query.OrderHint.SortOrder;
return result;
}
+ @Override
+ public List<UuidAndTitleCache<T>> getUuidAndTitleCache(Integer limit, String pattern){
+ return getUuidAndTitleCache(type, limit, pattern);
+ }
+
+
+ @Override
+ public <S extends T> List<UuidAndTitleCache<S>> getUuidAndTitleCache(Class<S> clazz, Integer limit, String pattern){
+ Session session = getSession();
+ Query query = null;
+ if (pattern != null){
+ query = session.createQuery("select uuid, id, titleCache from " + clazz.getSimpleName() +" where titleCache like :pattern");
+ pattern = pattern.replace("*", "%");
+ pattern = pattern.replace("?", "_");
+ pattern = pattern + "%";
+ query.setParameter("pattern", pattern);
+ } else {
+ query = session.createQuery("select uuid, id, titleCache from " + clazz.getSimpleName() );
+ }
+ if (limit != null){
+ query.setMaxResults(limit);
+ }
+ return getUuidAndTitleCache(query);
+ }
+
+
+ @Override
+ public List<UuidAndTitleCache<T>> getUuidAndTitleCache(){
+ return getUuidAndTitleCache(type, null, null);
+ }
+
+ protected <E extends IAnnotatableEntity> List<UuidAndTitleCache<E>> getUuidAndAbbrevTitleCache(Query query){
+ List<UuidAndTitleCache<E>> list = new ArrayList<UuidAndTitleCache<E>>();
+
+ List<Object[]> result = query.list();
+
+ for(Object[] object : result){
+ list.add(new UuidAndTitleCache<E>((UUID) object[0],(Integer) object[1], (String) object[3], (String) object[2]));
+ }
+ return list;
+ }
+
+ protected <E extends IAnnotatableEntity> List<UuidAndTitleCache<E>> getUuidAndTitleCache(Query query){
+ List<UuidAndTitleCache<E>> list = new ArrayList<UuidAndTitleCache<E>>();
+
+ List<Object[]> result = query.list();
+
+ for(Object[] object : result){
+ list.add(new UuidAndTitleCache<E>((UUID) object[0],(Integer) object[1], (String) object[2]));
+ }
+ return list;
+ }
+
}
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.Credit;
import eu.etaxonomy.cdm.model.common.DefinedTerm;
-import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
import eu.etaxonomy.cdm.model.common.LSID;
import eu.etaxonomy.cdm.model.media.Rights;
import eu.etaxonomy.cdm.persistence.dao.QueryParseException;
import eu.etaxonomy.cdm.persistence.dao.common.IIdentifiableDao;
-import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.query.MatchMode;
import eu.etaxonomy.cdm.persistence.query.OrderHint;
}
}
- @Override
- public List<UuidAndTitleCache<T>> getUuidAndTitleCache(Integer limit, String pattern){
- return getUuidAndTitleCache(type, limit, pattern);
- }
-
-
- @Override
- public <S extends T> List<UuidAndTitleCache<S>> getUuidAndTitleCache(Class<S> clazz, Integer limit, String pattern){
- Session session = getSession();
- Query query = null;
- if (pattern != null){
- query = session.createQuery("select uuid, id, titleCache from " + clazz.getSimpleName() +" where titleCache like :pattern");
- pattern = pattern.replace("*", "%");
- pattern = pattern.replace("?", "_");
- pattern = pattern + "%";
- query.setParameter("pattern", pattern);
- } else {
- query = session.createQuery("select uuid, id, titleCache from " + clazz.getSimpleName() );
- }
- if (limit != null){
- query.setMaxResults(limit);
- }
- return getUuidAndTitleCache(query);
- }
-
- @Override
- public List<UuidAndTitleCache<T>> getUuidAndTitleCache(){
- return getUuidAndTitleCache(type, null, null);
- }
-
- protected <E extends IIdentifiableEntity> List<UuidAndTitleCache<E>> getUuidAndAbbrevTitleCache(Query query){
- List<UuidAndTitleCache<E>> list = new ArrayList<UuidAndTitleCache<E>>();
-
- List<Object[]> result = query.list();
-
- for(Object[] object : result){
- list.add(new UuidAndTitleCache<E>((UUID) object[0],(Integer) object[1], (String) object[3], (String) object[2]));
- }
- return list;
- }
-
- protected <E extends IIdentifiableEntity> List<UuidAndTitleCache<E>> getUuidAndTitleCache(Query query){
- List<UuidAndTitleCache<E>> list = new ArrayList<UuidAndTitleCache<E>>();
-
- List<Object[]> result = query.list();
-
- for(Object[] object : result){
- list.add(new UuidAndTitleCache<E>((UUID) object[0],(Integer) object[1], (String) object[2]));
- }
- return list;
- }
@SuppressWarnings("deprecation")
@Override
}
@Override
- public List<UuidAndTitleCache<Amplification>> getAmplificationUuidAndLabelCache() {
+ public List<UuidAndTitleCache<Amplification>> getAmplificationUuidAndLabelCache(Integer limit, String pattern) {
List<UuidAndTitleCache<Amplification>> list = new ArrayList<UuidAndTitleCache<Amplification>>();
Session session = getSession();
-
- Query query = session.createQuery("select uuid, id, labelCache from Amplification");
-
+ Query query;
+ if (pattern != null){
+ query = session.createQuery("select uuid, id, labelCache from Amplification where labelCache like :pattern");
+ query.setParameter("pattern", pattern);
+ }else{
+ query = session.createQuery("select uuid, id, labelCache from Amplification");
+ }
+ if (limit != null){
+ query.setMaxResults(limit);
+ }
@SuppressWarnings("unchecked")
List<Object[]> result = query.list();
* {@link Amplification}s found in the data base.
* @return a list of {@link UuidAndTitleCache}
*/
- public List<UuidAndTitleCache<Amplification>> getAmplificationUuidAndLabelCache();
+ public List<UuidAndTitleCache<Amplification>> getAmplificationUuidAndLabelCache(Integer limit, String pattern);
/**
* Return a count of {@link Amplification}s matching the given query string in the titleCache, optionally with a particular MatchMode
}
@Override
- public List<UuidAndTitleCache<Institution>> getInstitutionUuidAndTitleCache() {
- return dao.getInstitutionUuidAndTitleCache();
+ public List<UuidAndTitleCache<AgentBase>> getInstitutionUuidAndTitleCache(Integer limit, String pattern) {
+ return dao.getUuidAndAbbrevTitleCache(limit, pattern, Institution.class);
}
@Override
import eu.etaxonomy.cdm.model.common.Marker;\r
import eu.etaxonomy.cdm.model.common.MarkerType;\r
import eu.etaxonomy.cdm.persistence.dao.common.IAnnotatableDao;\r
+import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;\r
import eu.etaxonomy.cdm.persistence.query.OrderHint;\r
\r
public abstract class AnnotatableServiceBase<T extends AnnotatableEntity,DAO extends IAnnotatableDao<T>> extends VersionableServiceBase<T, DAO>\r
return dao.countMarkers(clazz, technical);\r
}\r
\r
+ @Transactional(readOnly = true)\r
+ @Override\r
+ public List<UuidAndTitleCache<T>> getUuidAndTitleCache(Integer limit, String pattern) {\r
+ return dao.getUuidAndTitleCache(limit, pattern);\r
+ }\r
+\r
+ @Transactional(readOnly = true)\r
+ @Override\r
+ public <S extends T> List<UuidAndTitleCache<S>> getUuidAndTitleCache(Class<S> clazz,Integer limit, String pattern) {\r
+ return dao.getUuidAndTitleCache(clazz, limit, pattern);\r
+ }\r
+\r
\r
}\r
*
* @return a list of <code>UuidAndTitleCache</code> instances
*/
- public List<UuidAndTitleCache<Institution>> getInstitutionUuidAndTitleCache();
+ public List<UuidAndTitleCache<AgentBase>> getInstitutionUuidAndTitleCache(Integer limit, String pattern);
/**
import eu.etaxonomy.cdm.model.common.Marker;\r
import eu.etaxonomy.cdm.model.common.MarkerType;\r
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;\r
+import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;\r
import eu.etaxonomy.cdm.persistence.query.OrderHint;\r
\r
public interface IAnnotatableService<T extends AnnotatableEntity>\r
* @return a count of markers\r
*/\r
public int countMarkers(Class<? extends T> clazz, Boolean technical);\r
+ /**\r
+ * Like {@link #getUuidAndTitleCache(Integer, String)} but searching only on a subclass\r
+ * of the type handled by the DAO.\r
+ *\r
+ * @param clazz the (sub)class\r
+ * @param limit max number of results\r
+ * @param pattern search pattern\r
+\r
+ * @see #getUuidAndTitleCache(Integer, String)\r
+ */\r
+ public <S extends T> List<UuidAndTitleCache<S>> getUuidAndTitleCache(Class<S> clazz, Integer limit, String pattern);\r
+\r
+ /**\r
+ * Return a list of all uuids mapped to titleCache in the convenient <code>UuidAndTitleCache</code> object.\r
+ * Retrieving this list is considered to be significantly faster than initializing the fully fledged business\r
+ * objects. To be used in cases where you want to present large amount of data and provide details after\r
+ * a selection has been made.\r
+ *\r
+ * @return a list of <code>UuidAndTitleCache</code> instances\r
+ *\r
+ * @see #getUuidAndTitleCache(Class, Integer, String)\r
+ */\r
+ public List<UuidAndTitleCache<T>> getUuidAndTitleCache(Integer limit, String pattern);\r
+\r
}\r
import eu.etaxonomy.cdm.model.common.MarkerType;
import eu.etaxonomy.cdm.model.media.Rights;
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
-import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.query.MatchMode;
import eu.etaxonomy.cdm.persistence.query.OrderHint;
import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
*/
public Pager<Rights> getRights(T t, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
- /**
- * Return a list of all uuids mapped to titleCache in the convenient <code>UuidAndTitleCache</code> object.
- * Retrieving this list is considered to be significantly faster than initializing the fully fledged business
- * objects. To be used in cases where you want to present large amount of data and provide details after
- * a selection has been made.
- *
- * @return a list of <code>UuidAndTitleCache</code> instances
- *
- * @see #getUuidAndTitleCache(Class, Integer, String)
- */
- public List<UuidAndTitleCache<T>> getUuidAndTitleCache(Integer limit, String pattern);
/**
* Returns the titleCache for a given object defined by uuid.
*/
public String getTitleCache(UUID uuid, boolean refresh);
- /**
- * Like {@link #getUuidAndTitleCache(Integer, String)} but searching only on a subclass
- * of the type handled by the DAO.
- *
- * @param clazz the (sub)class
- * @param limit max number of results
- * @param pattern search pattern
- * @see #getUuidAndTitleCache(Integer, String)
- */
- public <S extends T> List<UuidAndTitleCache<S>> getUuidAndTitleCache(Class<S> clazz, Integer limit, String pattern);
/**
* Return a Pager of objects matching the given query string, optionally filtered by class, optionally with a particular MatchMode
}
@Override
- public List<UuidAndTitleCache<Amplification>> getAmplificationUuidAndLabelCache() {
- return dao.getAmplificationUuidAndLabelCache();
+ public List<UuidAndTitleCache<Amplification>> getAmplificationUuidAndLabelCache(Integer limit, String pattern) {
+ return dao.getAmplificationUuidAndLabelCache(limit, pattern);
}
@Override
* {@link Amplification}s found in the data base.
* @return a list of {@link UuidAndTitleCache}
*/
- public List<UuidAndTitleCache<Amplification>> getAmplificationUuidAndLabelCache();
+ public List<UuidAndTitleCache<Amplification>> getAmplificationUuidAndLabelCache(Integer limit, String pattern);
/**
* Return a List of {@link Amplification}s matching the given query string, optionally with a particular MatchMode