From: Sanjay Dalal Date: Fri, 2 Apr 2010 22:08:57 +0000 (+0000) Subject: CSPACE-863 fixed change introduced by http://fisheye.collectionspace.org/changelog... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=19e11cf9c76eee036ffb02d7f9d6bda85230e038;p=tmp%2Fjakarta-migration.git CSPACE-863 fixed change introduced by http://fisheye.collectionspace.org/changelog/collectionspace?cs=1738. Create new filter only if not available in the context. test: account service test passes M java/org/collectionspace/services/common/storage/jpa/JpaStorageClientImpl.java --- diff --git a/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageClientImpl.java b/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageClientImpl.java index 70a282c48..423f3a144 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageClientImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageClientImpl.java @@ -50,7 +50,6 @@ public class JpaStorageClientImpl implements StorageClient { /** The logger. */ private final Logger logger = LoggerFactory.getLogger(JpaStorageClientImpl.class); - /** The Constant CS_PERSISTENCE_UNIT. */ public final static String CS_PERSISTENCE_UNIT = "org.collectionspace.services"; @@ -113,10 +112,10 @@ public class JpaStorageClientImpl implements StorageClient { * @see org.collectionspace.services.common.storage.StorageClient#get(org.collectionspace.services.common.context.ServiceContext, java.util.List, org.collectionspace.services.common.document.DocumentHandler) */ public void get(ServiceContext ctx, List csidList, DocumentHandler handler) - throws DocumentNotFoundException, DocumentException { + throws DocumentNotFoundException, DocumentException { throw new UnsupportedOperationException(); } - + /* (non-Javadoc) * @see org.collectionspace.services.common.storage.StorageClient#get(org.collectionspace.services.common.context.ServiceContext, java.lang.String, org.collectionspace.services.common.document.DocumentHandler) */ @@ -127,10 +126,9 @@ public class JpaStorageClientImpl implements StorageClient { throw new IllegalArgumentException( "JpaStorageClient.get: handler is missing"); } - DocumentFilter docFilter = handler.createDocumentFilter(ctx); + DocumentFilter docFilter = handler.getDocumentFilter(); if (docFilter == null) { - throw new IllegalArgumentException( - "JpaStorageClient.get: handler has no Filter specified"); + docFilter = handler.createDocumentFilter(ctx); } String docType = ctx.getDocumentType(); if (docType == null) { @@ -212,10 +210,9 @@ public class JpaStorageClientImpl implements StorageClient { throw new IllegalArgumentException( "JpaStorageClient.getFiltered: handler is missing"); } - DocumentFilter docFilter = handler.createDocumentFilter(ctx); + DocumentFilter docFilter = handler.getDocumentFilter(); if (docFilter == null) { - throw new IllegalArgumentException( - "JpaStorageClient.getFiltered: handler has no Filter specified"); + docFilter = handler.createDocumentFilter(ctx); } String docType = ctx.getDocumentType(); if (docType == null) { @@ -238,7 +235,7 @@ public class JpaStorageClientImpl implements StorageClient { String queryStr = queryStrBldr.toString(); //for debugging Query q = em.createQuery(queryStr); //bind parameters - for(DocumentFilter.ParamBinding p : params) { + for (DocumentFilter.ParamBinding p : params) { q.setParameter(p.getName(), p.getValue()); } if (docFilter.getOffset() > 0) { @@ -520,9 +517,9 @@ public class JpaStorageClientImpl implements StorageClient { return (String) o; } - @Override - public void get(ServiceContext ctx, DocumentHandler handler) - throws DocumentNotFoundException, DocumentException { + @Override + public void get(ServiceContext ctx, DocumentHandler handler) + throws DocumentNotFoundException, DocumentException { throw new UnsupportedOperationException(); - } + } }