03-16-2012 04:44 AM
SessionFactory factory = SessionFactoryImpl.newInstance();
Map<String, String> parameter = new HashMap<String, String>();
// user credentials
parameter.put(SessionParameter.USER, configurationUtils.getCmisUserLogin());
parameter.put(SessionParameter.PASSWORD, configurationUtils.getCmisUserPassword());
// ATOMPUB binding
parameter.put(SessionParameter.ATOMPUB_URL, configurationUtils.getCmisBindingUrl());
parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
List<Repository> repositories = factory.getRepositories(parameter);
this.session = repositories.get(0).createSession();
Session session = cmisClient.getSession();
OperationContext operationContext = new OperationContextImpl();
operationContext.setMaxItemsPerPage(10);
String queryString = "select d.*,w.* "
+ "from cmis:document as d join adp:my_aspect as w on d.cmis:objectId = w.cmis:objectId "
+ "where w.adp:stato = 'DA INVIARE'";
ItemIterable<QueryResult> results = session.query(queryString, false,operationContext);
int pageNumber = 0;
boolean finished = false;
int count = 0;
while (!finished) {
ItemIterable<QueryResult> currentPage = results.skipTo(count).getPage();
for (QueryResult qResult : currentPage) {
String objectId = "";
PropertyData<?> propData = qResult.getPropertyById("cmis:objectId"); // Atom Pub binding
if (propData != null) {
objectId = (String) propData.getFirstValue();
} else {
//TODO: decidere se fare o meno
objectId = qResult.getPropertyValueByQueryName("d.cmis:objectId"); // Web Services binding
}
CmisObject obj = session.getObject(session.createObjectId(objectId));
count++;
_log.info("CMIS obj id: [" + obj.getId() + "], name:["+ obj.getName() + "], adp:status: ["+obj.getPropertyValue("adp:stato")+"]");
}
pageNumber++;
if (!currentPage.getHasMoreItems())
finished = true;
}
01-30-2013 11:22 AM
07-05-2013 12:51 PM
11-20-2013 05:42 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.