]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
fe2251fa5a2e74844c6b589d0f0ed22f09452559
[tmp/jakarta-migration.git] /
1 package org.collectionspace.services.nuxeo.client.java;
2
3 import java.io.Serializable;
4 import java.security.Principal;
5 import java.util.ArrayList;
6 import java.util.List;
7 import java.util.Map;
8
9 import org.collectionspace.services.common.context.ServiceContext;
10 import org.collectionspace.services.common.document.DocumentHandler;
11 import org.collectionspace.services.nuxeo.util.ReindexFulltextRoot;
12 import org.collectionspace.services.nuxeo.util.ReindexFulltextRoot.ReindexInfo;
13 import org.nuxeo.ecm.core.api.IterableQueryResult;
14 import org.nuxeo.ecm.core.api.NuxeoException;
15 import org.nuxeo.ecm.core.api.NuxeoPrincipal;
16 import org.nuxeo.ecm.core.query.QueryFilter;
17 import org.nuxeo.ecm.core.query.sql.NXQL;
18 import org.nuxeo.ecm.core.storage.StorageException;
19 import org.nuxeo.runtime.transaction.TransactionHelper;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
22
23 /*
24  * Use the inherited reindexFulltext() method to reindex the Nuxeo full-text index.
25  */
26 public class CSReindexFulltextRoot extends ReindexFulltextRoot {
27
28         /** The logger. */
29         private final Logger logger = LoggerFactory.getLogger(CSReindexFulltextRoot.class);
30         protected String repoQuery;
31
32         public CSReindexFulltextRoot(CoreSessionInterface repoSession, String repoQuery) {
33                 this.coreSession = repoSession.getCoreSession();
34                 this.repoQuery = repoQuery;
35         }
36         
37         
38         @Override
39     protected List<ReindexInfo> getInfos() throws StorageException {
40         getLowLevelSession();
41         List<ReindexInfo> infos = new ArrayList<ReindexInfo>();
42 //        String query = "SELECT ecm:uuid, ecm:primaryType FROM Document"
43 //                + " WHERE ecm:isProxy = 0"
44 //                + " AND ecm:currentLifeCycleState <> 'deleted'"
45 //                + " ORDER BY ecm:uuid";
46         IterableQueryResult it = session.queryAndFetch(this.repoQuery, NXQL.NXQL,
47                 QueryFilter.EMPTY);
48         try {
49             for (Map<String, Serializable> map : it) {
50                 Serializable id = map.get(NXQL.ECM_UUID);
51                 String type = (String) map.get(NXQL.ECM_PRIMARYTYPE);
52                 infos.add(new ReindexInfo(id, type));
53             }
54         } finally {
55             it.close();
56         }
57         return infos;
58     }    
59
60 }