As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
SELECT * FROM cmis:document D WHERE CONTAINS(D,'PATH: "/app:company_home//*"')
org.alfresco.scripts.ScriptException - 05090198 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js': 05090197 Unknown column/property PATH
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)
http://localhost:8080/alfresco/cmisatom for 1.0 http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom for 1.1
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)); }