06-09-2014 10:50 AM
06-09-2014 11:28 AM
SELECT * FROM cmis:document D WHERE CONTAINS(D,'PATH: "/app:company_home//*"')
06-09-2014 11:36 AM
org.alfresco.scripts.ScriptException - 05090198 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js': 05090197 Unknown column/property PATH06-09-2014 12:13 PM
06-09-2014 12:30 PM
public Session getSession(String repositoryUrl, String user, String password){
   Session session = cacheSession.getIfPresent(user);
   if (session == null) {
      Map<String, String> sessionParameters = new HashMap<String, String>();
      sessionParameters.put(SessionParameter.USER, user);
      sessionParameters.put(SessionParameter.PASSWORD, password);
      sessionParameters.put(SessionParameter.ATOMPUB_URL, repositoryUrl + "/service/cmis");
      sessionParameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
      sessionParameters.put(SessionParameter.OBJECT_FACTORY_CLASS,"org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
      try {
         SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
         session = sessionFactory.getRepositories(sessionParameters).get(0).createSession();
      } catch (CmisBaseException e) {
          //TODO
      }
      cacheSession.put(user, session);
   }
   return session;
}
// somewhere in the code 
ItemIterable<QueryResult> qrs = getSession("url","user","pwd").query("SELECT * FROM cmis:document D WHERE CONTAINS(D,'PATH: \"/app:company_home//*\"')", false);
for(QueryResult q : qrs) {
       System.out.println(q.getPropertyByQueryName("cmis:name"));
}
org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: Erreur Interne de Servlet
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:452)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:570)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.DiscoveryServiceImpl.query(DiscoveryServiceImpl.java:142)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl$3.fetchPage(SessionImpl.java:557)
   at org.apache.chemistry.opencmis.client.runtime.util.AbstractIterator.getCurrentPage(AbstractIterator.java:132)
   at org.apache.chemistry.opencmis.client.runtime.util.CollectionIterator.hasNext(CollectionIterator.java:48)
   at com.sqli.sante.ged.alfresco.document.service.AlfrescoDocumentServiceImpl.main(AlfrescoDocumentServiceImpl.java:729)
					
				
			
			
				
			
			
			
			
			
			
			
		06-09-2014 01:01 PM
http://localhost:8080/alfresco/cmisatom for 1.0
http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom for 1.1
					
				
			
			
				
			
			
			
			
			
			
			
		06-09-2014 01:26 PM
06-09-2014 07:52 PM
      String serverUrl= "http://localhost:8080/alfresco/cmisatom";
      String userName = "admin";
      String password = "admin";
      SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
      Map<String, String> params = new HashMap<String, String>();
      params.put(SessionParameter.USER, userName);
      params.put(SessionParameter.PASSWORD, password);
      params.put(SessionParameter.ATOMPUB_URL, serverUrl);
      params.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
      params.put(SessionParameter.OBJECT_FACTORY_CLASS,
            "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
      List<Repository> repos = sessionFactory.getRepositories(params);
      if (repos.isEmpty()) {
         throw new RuntimeException("Server has no repositories!");
      }
      Session session =  repos.get(0).createSession();
      ItemIterable<QueryResult> qrs = session.query("SELECT * FROM cmis:document D WHERE CONTAINS(D,'PATH: \"/app:company_home//*\"')", false);
      for(QueryResult q : qrs) {
             System.out.println(q.getPropertyValueById(PropertyIds.OBJECT_ID));
             System.out.println(q.getPropertyValueById(PropertyIds.NAME));
      }
06-10-2014 03:42 AM
06-10-2014 04:40 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.