]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-1432: Apply "List - pagination (return total items, current page, total pages...
authorRichard Millet <richard.millet@berkeley.edu>
Thu, 19 Aug 2010 03:08:51 +0000 (03:08 +0000)
committerRichard Millet <richard.millet@berkeley.edu>
Thu, 19 Aug 2010 03:08:51 +0000 (03:08 +0000)
16 files changed:
services/account/jaxb/pom.xml
services/account/jaxb/src/main/resources/accounts_common.xsd
services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java
services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountDocumentHandler.java
services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountRoleDocumentHandler.java
services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/storage/PermissionDocumentHandler.java
services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/storage/PermissionRoleDocumentHandler.java
services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/storage/RoleDocumentHandler.java
services/common/pom.xml
services/common/src/main/java/org/collectionspace/services/common/document/AbstractMultipartDocumentHandlerImpl.java
services/common/src/main/java/org/collectionspace/services/common/document/DocumentHandler.java
services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageClientImpl.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java
services/hyperjaxb/pom.xml
services/pom.xml

index 82fa944e0a50c8bb22b2932c376107f7df4b0996..7dba4845de39c8558d3e2836a8fed660168b2ff7 100644 (file)
             <groupId>org.jvnet.hyperjaxb3</groupId>
             <artifactId>hyperjaxb3-ejb-runtime</artifactId>
         </dependency>
+        <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.hyperjaxb</artifactId>
+                       <version>${project.version}</version>
+        </dependency>        
     </dependencies>
 
     <build>
index 4fbc5d5486a87d83570bc6852c796a9bd47c0405..27ed6de8592cd7920deafb63f68c582a9ffa2c97 100644 (file)
@@ -8,12 +8,13 @@
     Used for: JAXB binding between XML and Java objects
 
     $LastChangedRevision: 916 $
-    $LastChangedDate: 2009-11-05 16:59:20 -0800 (Thu, 05 Nov 2009) $
+    $LastChangedDate: 2009-11-05 16:59:20 -0800 (Fri, 06 Nov 2009) $
 -->
 
 <xs:schema 
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+    jaxb:version="1.0" elementFormDefault="unqualified"
     xmlns:hj="http://hyperjaxb3.jvnet.org/ejb/schemas/customizations"
     xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
     xmlns:ns="http://collectionspace.org/services/account"
         </xs:complexType>
     </xs:element>
 
+    <!-- This is the base class for paginated lists -->
+    <xs:complexType name="abstractCommonList">
+        <xs:annotation>
+            <xs:appinfo>
+                <jaxb:class ref="org.collectionspace.services.hyperjaxb.AbstractCommonList"/>
+            </xs:appinfo>
+        </xs:annotation>
+    </xs:complexType>
+
     <xs:element name="accounts-common-list">
         <xs:complexType>
             <xs:annotation>
                     <hj:ignored/>
                 </xs:appinfo>
             </xs:annotation>
-            <xs:sequence>
-                <xs:element name="account-list-item" maxOccurs="unbounded">
-                    <xs:complexType>
-                        <xs:annotation>
-                            <xs:appinfo>
-                                <hj:ignored/>
-                            </xs:appinfo>
-                        </xs:annotation>
-                        <xs:sequence>
-                            <xs:element name="screenName" type="xs:string" minOccurs="1"/>
-                            <xs:element name="personRefName" type="xs:string" minOccurs="1" />
-                            <xs:element name="email" type="xs:string" minOccurs="1" />
-                            <xs:element name="status" type="status" minOccurs="1" />
-                            <!-- uri to retrive collection object details -->
-                            <xs:element name="uri" type="xs:anyURI" minOccurs="1" />
-                            <xs:element name="csid" type="xs:string" minOccurs="1" />
-                        </xs:sequence>
-                    </xs:complexType>
-                </xs:element>
-            </xs:sequence>
+            <xs:complexContent>
+                <xs:extension base="abstractCommonList">                    
+                           <xs:sequence>
+                               <xs:element name="account-list-item" maxOccurs="unbounded">
+                                   <xs:complexType>
+                                       <xs:annotation>
+                                           <xs:appinfo>
+                                               <hj:ignored/>
+                                           </xs:appinfo>
+                                       </xs:annotation>
+                                       <xs:sequence>
+                                           <xs:element name="screenName" type="xs:string" minOccurs="1"/>
+                                           <xs:element name="personRefName" type="xs:string" minOccurs="1" />
+                                           <xs:element name="email" type="xs:string" minOccurs="1" />
+                                           <xs:element name="status" type="status" minOccurs="1" />
+                                           <!-- uri to retrive collection object details -->
+                                           <xs:element name="uri" type="xs:anyURI" minOccurs="1" />
+                                           <xs:element name="csid" type="xs:string" minOccurs="1" />
+                                       </xs:sequence>
+                                   </xs:complexType>
+                               </xs:element>
+                           </xs:sequence>
+                </xs:extension>
+            </xs:complexContent>        
         </xs:complexType>
     </xs:element>
 
index ee8937cd320a068c19834d8bef09f4c41dbe53d2..03e6abc007db81bb7639dcf1e03bafd3c69848ba 100644 (file)
@@ -239,13 +239,15 @@ public class AccountResource
             @Context UriInfo ui) {
         AccountsCommonList accountList = new AccountsCommonList();
         try {
-            ServiceContext<AccountsCommon, AccountsCommon> ctx = createServiceContext((AccountsCommon) null, AccountsCommon.class);
-            DocumentHandler handler = createDocumentHandler(ctx);
             MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
-            DocumentFilter myFilter = handler.createDocumentFilter();
-            myFilter.setPagination(queryParams);
-            myFilter.setQueryParams(queryParams);
-            handler.setDocumentFilter(myFilter);
+            ServiceContext<AccountsCommon, AccountsCommon> ctx = createServiceContext((AccountsCommon) null,
+                       queryParams, AccountsCommon.class);
+            DocumentHandler handler = createDocumentHandler(ctx);
+            handler.getDocumentFilter().setQueryParams(queryParams);
+//            DocumentFilter myFilter = handler.createDocumentFilter();
+//            myFilter.setPagination(queryParams);
+//            myFilter.setQueryParams(queryParams);
+//            handler.setDocumentFilter(myFilter);
             getStorageClient(ctx).getFiltered(ctx, handler);
             accountList = (AccountsCommonList) handler.getCommonPartList();
         } catch (UnauthorizedException ue) {
index 454f19c497d60f408f9d178558386acce5c12ca8..03c192217628586c9e63d9db7414e2229e734217 100644 (file)
@@ -27,17 +27,20 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.UUID;
+
 import org.collectionspace.services.account.AccountTenant;
 import org.collectionspace.services.account.AccountsCommon;
 import org.collectionspace.services.account.AccountsCommonList;
 import org.collectionspace.services.account.AccountsCommonList.AccountListItem;
 import org.collectionspace.services.account.Status;
+
+import org.collectionspace.services.common.storage.jpa.JpaDocumentHandler;
 import org.collectionspace.services.common.context.ServiceContext;
-import org.collectionspace.services.common.document.AbstractDocumentHandlerImpl;
 import org.collectionspace.services.common.document.DocumentFilter;
 import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.document.JaxbUtils;
 import org.collectionspace.services.common.security.SecurityUtils;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -46,7 +49,7 @@ import org.slf4j.LoggerFactory;
  * @author 
  */
 public class AccountDocumentHandler
-        extends AbstractDocumentHandlerImpl<AccountsCommon, AccountsCommonList, AccountsCommon, List> {
+        extends JpaDocumentHandler<AccountsCommon, AccountsCommonList, AccountsCommon, List> {
 
     private final Logger logger = LoggerFactory.getLogger(AccountDocumentHandler.class);
     private AccountsCommon account;
@@ -144,7 +147,8 @@ public class AccountDocumentHandler
             DocumentWrapper<List> wrapDoc)
             throws Exception {
 
-        AccountsCommonList accList = new AccountsCommonList();
+       AccountsCommonList accList = this.extractPagingInfo(new AccountsCommonList(), wrapDoc);
+//        AccountsCommonList accList = new AccountsCommonList();
         List<AccountsCommonList.AccountListItem> list = accList.getAccountListItem();
 
         for (Object obj : wrapDoc.getWrappedObject()) {
index 34edb72b7f86bafbdd857ba7b952700e68221583..9233d9f1047aba6d294641fed7fe286181b446a2 100644 (file)
@@ -33,11 +33,13 @@ import org.collectionspace.services.authorization.PermissionsRolesList;
 import org.collectionspace.services.authorization.RoleValue;
 import org.collectionspace.services.authorization.SubjectType;
 import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.common.storage.jpa.JpaDocumentHandler;
 
 import org.collectionspace.services.common.document.AbstractDocumentHandlerImpl;
 import org.collectionspace.services.common.document.DocumentFilter;
 import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.context.ServiceContextProperties;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -46,7 +48,7 @@ import org.slf4j.LoggerFactory;
  * @author 
  */
 public class AccountRoleDocumentHandler
-        extends AbstractDocumentHandlerImpl<AccountRole, PermissionsRolesList, List<AccountRoleRel>, List<AccountRoleRel>> {
+        extends JpaDocumentHandler<AccountRole, PermissionsRolesList, List<AccountRoleRel>, List<AccountRoleRel>> {
 
     private final Logger logger = LoggerFactory.getLogger(AccountRoleDocumentHandler.class);
     private AccountRole accountRole;
index 0252948731e27e22c993ef8414d99f40360ecabc..94d9e03a616e41901f3a8f1434fb3734d14394fe 100644 (file)
@@ -27,9 +27,12 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
 
+import org.collectionspace.services.authorization.AccountRole;
+import org.collectionspace.services.authorization.AccountRoleRel;
 import org.collectionspace.services.authorization.Permission;
 import org.collectionspace.services.authorization.PermissionAction;
 import org.collectionspace.services.authorization.PermissionsList;
+import org.collectionspace.services.authorization.PermissionsRolesList;
 
 import org.collectionspace.services.common.document.AbstractDocumentHandlerImpl;
 import org.collectionspace.services.common.document.BadRequestException;
@@ -37,6 +40,7 @@ import org.collectionspace.services.common.document.DocumentFilter;
 import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.document.JaxbUtils;
 import org.collectionspace.services.common.security.SecurityUtils;
+import org.collectionspace.services.common.storage.jpa.JpaDocumentHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -45,7 +49,7 @@ import org.slf4j.LoggerFactory;
  * @author 
  */
 public class PermissionDocumentHandler
-        extends AbstractDocumentHandlerImpl<Permission, PermissionsList, Permission, List> {
+               extends JpaDocumentHandler<Permission, PermissionsList, Permission, List> {
 
     private final Logger logger = LoggerFactory.getLogger(PermissionDocumentHandler.class);
     private Permission permission;
index 9c8b1c86db7518932e2753c3065064e71d345c88..124d3c19a4aa51be3605ca9fece071a3864c82cf 100644 (file)
@@ -26,9 +26,11 @@ package org.collectionspace.services.authorization.storage;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.collectionspace.services.authorization.Permission;
 import org.collectionspace.services.authorization.PermissionRole;
 import org.collectionspace.services.authorization.PermissionRoleRel;
 import org.collectionspace.services.authorization.PermissionValue;
+import org.collectionspace.services.authorization.PermissionsList;
 import org.collectionspace.services.authorization.PermissionsRolesList;
 import org.collectionspace.services.authorization.RoleValue;
 import org.collectionspace.services.authorization.SubjectType;
@@ -36,6 +38,7 @@ import org.collectionspace.services.authorization.SubjectType;
 import org.collectionspace.services.common.document.AbstractDocumentHandlerImpl;
 import org.collectionspace.services.common.document.DocumentFilter;
 import org.collectionspace.services.common.document.DocumentWrapper;
+import org.collectionspace.services.common.storage.jpa.JpaDocumentHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -44,7 +47,7 @@ import org.slf4j.LoggerFactory;
  * @author 
  */
 public class PermissionRoleDocumentHandler
-        extends AbstractDocumentHandlerImpl<PermissionRole, PermissionsRolesList, List<PermissionRoleRel>, List<PermissionRoleRel>> {
+               extends JpaDocumentHandler<PermissionRole, PermissionsRolesList, List<PermissionRoleRel>, List<PermissionRoleRel>> {
 
     private final Logger logger = LoggerFactory.getLogger(PermissionRoleDocumentHandler.class);
     private PermissionRole permissionRole;
index 7be60a26cfa897dfab38332ed60c35f9c3f61b54..5fd3bf257774484b3ceca8763fb173f4706a06a8 100644 (file)
@@ -30,12 +30,13 @@ import java.util.UUID;
 import org.collectionspace.services.authorization.Role;
 import org.collectionspace.services.authorization.RolesList;
 
-import org.collectionspace.services.common.document.AbstractDocumentHandlerImpl;
 import org.collectionspace.services.common.document.BadRequestException;
 import org.collectionspace.services.common.document.DocumentFilter;
 import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.document.JaxbUtils;
 import org.collectionspace.services.common.security.SecurityUtils;
+import org.collectionspace.services.common.storage.jpa.JpaDocumentHandler;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -44,8 +45,7 @@ import org.slf4j.LoggerFactory;
  * @author 
  */
 public class RoleDocumentHandler
-        extends AbstractDocumentHandlerImpl<Role, RolesList, Role, List> {
-
+               extends JpaDocumentHandler<Role, RolesList, Role, List> {
     private final Logger logger = LoggerFactory.getLogger(RoleDocumentHandler.class);
     private Role role;
     private RolesList rolesList;
index ff3e35e954eaff8e1167a017eb78525cf298b63e..1fc0686724b31d6d94d514b888e820aa2c0f561f 100644 (file)
             <artifactId>org.collectionspace.services.jaxb</artifactId>\r
             <version>${project.version}</version>\r
         </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.hyperjaxb</artifactId>\r
+            <version>${project.version}</version>\r
+        </dependency>\r
         <dependency>\r
             <groupId>org.collectionspace.services</groupId>\r
             <artifactId>org.collectionspace.services.client</artifactId>\r
index 322c40bbe8ba54aff25e8583e9c00cd73626473b..e34b6dc282a98ab7059a6011d7527940fba629c8 100644 (file)
@@ -25,6 +25,7 @@ package org.collectionspace.services.common.document;
 
 
 
+import org.nuxeo.ecm.core.api.DocumentModelList;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -82,6 +83,10 @@ public abstract class AbstractMultipartDocumentHandlerImpl<T, TL, WT, WTL>
     @Override
     public abstract TL extractCommonPartList(DocumentWrapper<WTL> wrapDoc)
             throws Exception;
+    
+    @Override
+    public abstract TL extractPagingInfo(TL theCommonList, DocumentWrapper<WTL> wrapDoc)
+               throws Exception;
 
     @Override
     public abstract T getCommonPart();
index c6f88aeeb1025c0cd709feeaeea0bb9946dcabc2..b869e9f75e76d75c2086f30a06fbe0dda6c048cd 100644 (file)
@@ -221,6 +221,16 @@ public interface DocumentHandler<T, TL, WT, WTL> {
      * @throws Exception
      */
     public TL extractCommonPartList(DocumentWrapper<WTL> docWrap) throws Exception;
+    
+    /**
+     * Extract paging info.
+     *
+     * @param theCommonList the the common list
+     * @param wrapDoc the wrap doc
+     * @return the tL
+     * @throws Exception the exception
+     */
+    public TL extractPagingInfo(TL theCommonList, DocumentWrapper<WTL> wrapDoc)        throws Exception;    
 
     /**
      * fillCommonPartList sets list common part of CS object into given document
index a85e810f2a84c9a835a0df6ec2fa6fb1d83e1325..db943c72d8be7e8ebaaf200bd2df657e5d6ccc61 100644 (file)
@@ -19,10 +19,11 @@ package org.collectionspace.services.common.storage.jpa;
 
 import java.util.Date;
 import java.util.List;
+
 import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
 import javax.persistence.Query;
-import org.collectionspace.services.common.context.ServiceContext;
+
 import org.collectionspace.services.common.document.BadRequestException;
 import org.collectionspace.services.common.document.DocumentException;
 import org.collectionspace.services.common.document.DocumentFilter;
@@ -32,8 +33,12 @@ import org.collectionspace.services.common.document.DocumentHandler.Action;
 import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.document.DocumentWrapperImpl;
 import org.collectionspace.services.common.document.JaxbUtils;
+
 import org.collectionspace.services.common.storage.StorageClient;
 import org.collectionspace.services.common.context.ServiceContextProperties;
+import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.common.query.QueryContext;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -212,15 +217,8 @@ public class JpaStorageClientImpl implements StorageClient {
     @Override
     public void getFiltered(ServiceContext ctx, DocumentHandler handler)
             throws DocumentNotFoundException, DocumentException {
-        if (ctx == null) {
-            throw new IllegalArgumentException(
-                    "getFiltered: ctx is missing");
-        }
-        if (handler == null) {
-            throw new IllegalArgumentException(
-                    "getFiltered: handler is missing");
-        }
-
+       QueryContext queryContext = new QueryContext(ctx, handler);
+       
         DocumentFilter docFilter = handler.getDocumentFilter();
         if (docFilter == null) {
             docFilter = handler.createDocumentFilter();
@@ -229,10 +227,10 @@ public class JpaStorageClientImpl implements StorageClient {
         EntityManager em = null;
         try {
             handler.prepare(Action.GET_ALL);
-
             StringBuilder queryStrBldr = new StringBuilder("SELECT a FROM ");
             queryStrBldr.append(getEntityName(ctx));
             queryStrBldr.append(" a");
+            
             List<DocumentFilter.ParamBinding> params = docFilter.buildWhereForSearch(queryStrBldr);
             emf = JpaStorageUtils.getEntityManagerFactory();
             em = emf.createEntityManager();
index b5d5947a36d26034556dc52620256f9fda1167fe..6fa7c68bd11fa87094c48b14568326c4202b5459 100644 (file)
@@ -133,7 +133,7 @@ public abstract class RemoteDocumentModelHandlerImpl<T, TL>
      * @return the tL
      * @throws Exception the exception
      */
-    protected TL extractPagingInfo(TL theCommonList, DocumentWrapper<DocumentModelList> wrapDoc)
+    public TL extractPagingInfo(TL theCommonList, DocumentWrapper<DocumentModelList> wrapDoc)
             throws Exception {
         AbstractCommonList commonList = (AbstractCommonList) theCommonList;
 
index b0f0238d2924eecfa10072b8974cb24abaa1715e..664a5f77d1df562874021308a892b760dc78a676 100644 (file)
@@ -22,6 +22,11 @@ import java.util.UUID;
 import java.util.List;
 
 import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.common.query.IQueryManager;
+import org.collectionspace.services.common.query.QueryContext;
+import org.collectionspace.services.common.repository.RepositoryClient;
+import org.collectionspace.services.common.profile.Profiler;
+import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 
 import org.collectionspace.services.common.document.BadRequestException;
 import org.collectionspace.services.common.document.DocumentException;
@@ -32,13 +37,9 @@ import org.collectionspace.services.common.document.DocumentHandler.Action;
 import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.document.DocumentWrapperImpl;
 
-import org.collectionspace.services.nuxeo.util.NuxeoUtils;
-import org.collectionspace.services.common.query.IQueryManager;
-import org.collectionspace.services.common.repository.RepositoryClient;
-import org.collectionspace.services.common.profile.Profiler;
-
 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+
 import org.nuxeo.common.utils.IdUtils;
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.DocumentModel;
@@ -62,87 +63,6 @@ import org.slf4j.LoggerFactory;
  */
 public class RepositoryJavaClientImpl implements RepositoryClient {
 
-    /**
-     * The Class QueryContext.
-     */
-    private class QueryContext {
-
-        /** The doc type. */
-        String docType;
-        /** The doc filter. */
-        DocumentFilter docFilter;
-        /** The where clause. */
-        String whereClause;
-        /** The order by clause. */
-        String orderByClause;
-        /** The domain. */
-        String domain;
-        /** The tenant id. */
-        String tenantId;
-
-        /**
-         * Instantiates a new query context.
-         *
-         * @param ctx the ctx
-         * @throws DocumentNotFoundException the document not found exception
-         * @throws DocumentException the document exception
-         */
-        QueryContext(ServiceContext<MultipartInput, MultipartOutput> ctx) throws DocumentNotFoundException, DocumentException {
-            docType = ctx.getDocumentType();
-            if (docType == null) {
-                throw new DocumentNotFoundException(
-                        "Unable to find DocumentType for service " + ctx.getServiceName());
-            }
-            domain = ctx.getRepositoryDomainName();
-            if (domain == null) {
-                throw new DocumentNotFoundException(
-                        "Unable to find Domain for service " + ctx.getServiceName());
-            }
-            tenantId = ctx.getTenantId();
-            if (tenantId == null) {
-                throw new IllegalArgumentException(
-                        "Service context has no Tenant ID specified.");
-            }
-        }
-
-        /**
-         * Instantiates a new query context.
-         *
-         * @param ctx the ctx
-         * @param theWhereClause the where clause
-         * @throws DocumentNotFoundException the document not found exception
-         * @throws DocumentException the document exception
-         */
-        QueryContext(ServiceContext<MultipartInput, MultipartOutput> ctx,
-                String theWhereClause) throws DocumentNotFoundException, DocumentException {
-            this(ctx);
-            whereClause = theWhereClause;
-        }
-
-        /**
-         * Instantiates a new query context.
-         *
-         * @param ctx the ctx
-         * @param handler the handler
-         * @throws DocumentNotFoundException the document not found exception
-         * @throws DocumentException the document exception
-         */
-        QueryContext(ServiceContext<MultipartInput, MultipartOutput> ctx,
-                DocumentHandler handler) throws DocumentNotFoundException, DocumentException {
-            this(ctx);
-            if (handler == null) {
-                throw new IllegalArgumentException(
-                        "Document handler is missing.");
-            }
-            docFilter = handler.getDocumentFilter();
-            if (docFilter == null) {
-                throw new IllegalArgumentException(
-                        "Document handler has no Filter specified.");
-            }
-            whereClause = docFilter.getWhereClause();
-            orderByClause = docFilter.getOrderByClause();
-        }
-    }
     /** The logger. */
     private final Logger logger = LoggerFactory.getLogger(RepositoryJavaClientImpl.class);
 //    private final Logger profilerLogger = LoggerFactory.getLogger("remperf");
@@ -627,7 +547,6 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
     @Override
     public void getFiltered(ServiceContext ctx, DocumentHandler handler)
             throws DocumentNotFoundException, DocumentException {
-
         QueryContext queryContext = new QueryContext(ctx, handler);
 
         RepositoryInstance repoSession = null;
@@ -646,9 +565,9 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
                Profiler profiler = new Profiler(this, 2);
                profiler.log("Executing NXQL query: " + query.toString());
                profiler.start();
-            if ((queryContext.docFilter.getOffset() > 0) || (queryContext.docFilter.getPageSize() > 0)) {
+            if ((queryContext.getDocFilter().getOffset() > 0) || (queryContext.getDocFilter().getPageSize() > 0)) {
                 docList = repoSession.query(query, null,
-                        queryContext.docFilter.getPageSize(), queryContext.docFilter.getOffset(), true);
+                        queryContext.getDocFilter().getPageSize(), queryContext.getDocFilter().getOffset(), true);
             } else {
                 docList = repoSession.query(query);
             }
@@ -928,11 +847,11 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
         //
         query.append(/*IQueryManager.SEARCH_QUALIFIER_AND +*/ " WHERE " + DocumentModelHandler.COLLECTIONSPACE_CORE_SCHEMA + ":"
                 + DocumentModelHandler.COLLECTIONSPACE_CORE_TENANTID
-                + " = " + queryContext.tenantId);
+                + " = " + queryContext.getTenantId());
         //
         // Finally, append the incoming where clause
         //
-        String whereClause = queryContext.whereClause;
+        String whereClause = queryContext.getWhereClause();
         if (whereClause != null && ! whereClause.trim().isEmpty()) {
             // Due to an apparent bug/issue in how Nuxeo translates the NXQL query string
             // into SQL, we need to parenthesize our 'where' clause
@@ -952,7 +871,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
      */
     private final void appendNXQLOrderBy(StringBuilder query, QueryContext queryContext) {
         // Append the incoming ORDER BY clause
-        String orderByClause = queryContext.orderByClause;
+        String orderByClause = queryContext.getOrderByClause();
         if (orderByClause != null && ! orderByClause.trim().isEmpty()) {
             // FIXME Verify whether enclosing parentheses may be required, and add
             // them if so, as is being done in appendNXQLWhere.
@@ -977,7 +896,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
      */
     private final String buildNXQLQuery(QueryContext queryContext) {
         StringBuilder query = new StringBuilder("SELECT * FROM ");
-        query.append(queryContext.docType);
+        query.append(queryContext.getDocType());
         appendNXQLWhere(query, queryContext);
         appendNXQLOrderBy(query, queryContext);
         return query.toString();
index 2b7c9a0a3fe5ff4800506b8926dbe0cd23d20cfc..07cbbd9fd0e9aebd6a0a50370fe7312dccb7a9ad 100644 (file)
   <name>services.hyperjaxb</name>\r
   \r
   <dependencies>  \r
-    <dependency>\r
-      <groupId>com.sun.xml.bind</groupId>\r
-      <artifactId>jaxb-impl</artifactId>\r
-    </dependency>\r
-    \r
-    <dependency>\r
-      <groupId>org.jvnet.jaxb2-commons</groupId>\r
-      <artifactId>property-listener-injector</artifactId>\r
-    </dependency>\r
-    \r
-    <dependency>\r
-      <groupId>org.jvnet.jaxb2_commons</groupId>\r
-      <artifactId>runtime</artifactId>\r
-    </dependency>\r
-    \r
+               <dependency>\r
+                 <groupId>com.sun.xml.bind</groupId>\r
+                 <artifactId>jaxb-impl</artifactId>\r
+               </dependency>    \r
+               <dependency>\r
+                 <groupId>org.jvnet.jaxb2-commons</groupId>\r
+                 <artifactId>property-listener-injector</artifactId>\r
+               </dependency>    \r
+               <dependency>\r
+                 <groupId>org.jvnet.jaxb2_commons</groupId>\r
+                 <artifactId>runtime</artifactId>\r
+               </dependency>\r
+    <!-- Dependencies for HyperJaxB -->\r
+               <dependency>\r
+                   <groupId>javax.persistence</groupId>\r
+                   <artifactId>persistence-api</artifactId>\r
+               </dependency>\r
+               <dependency>\r
+                   <groupId>org.hibernate</groupId>\r
+                   <artifactId>hibernate-entitymanager</artifactId>\r
+               </dependency>\r
+               <dependency>\r
+                   <groupId>org.jvnet.hyperjaxb3</groupId>\r
+                   <artifactId>hyperjaxb3-ejb-runtime</artifactId>\r
+               </dependency>    \r
   </dependencies>\r
   \r
   <build>\r
-    <finalName>collectionspace-services-jaxb</finalName>\r
+    <finalName>collectionspace-services-hyperjaxb</finalName>\r
     <defaultGoal>install</defaultGoal>\r
+\r
     <plugins>\r
-    \r
-      <plugin>\r
-        <groupId>org.jvnet.jaxb2.maven2</groupId>\r
-        <artifactId>maven-jaxb2-plugin</artifactId>\r
-      </plugin>\r
+               <plugin>\r
+                   <groupId>org.jvnet.hyperjaxb3</groupId>\r
+                   <artifactId>maven-hyperjaxb3-plugin</artifactId>\r
+               </plugin>\r
     </plugins>\r
   </build>\r
 \r
index 388c87c1a4651e9a7a90ddec190bca08bebba2ac..26a3b906dbb1a0bdc0c8630ad5da8ef40b06aa2b 100644 (file)
@@ -24,6 +24,7 @@
         <module>authorization</module>
         <module>client</module>
         <module>jaxb</module>
+        <module>hyperjaxb</module>
         <module>common</module>
         <module>authorization-mgt</module> <!-- relies on authorization -->
         <module>common-test</module>