2013-10-09 3 views
0
"java.lang.IllegalStateException: Failed to resolve to a single NodeRef with parameters (store=workspace:SpacesStore uuid=null path=/app:company_home/cm:DCSL_DOCS/cm:Scanned_Docs), found 0 nodes." 

위의 오류가 내 오류를 나타냅니다. 여기공백을 만들 때 Alfresco java.lang.IllegalStateException 오류가 발생했습니다.

protected Reference createSpace(Reference parentref, String spacename) throws Exception { 
    Reference space = null; 
    ParentReference parent = ReferenceToParent(parentref); 
    try { 
     System.out.println("Entering space:" + spacename+":"); 
     space = new Reference(STORE, null, parent.getPath() + "/cm:" + ISO9075.encode(spacename)); 
     WebServiceFactory.getRepositoryService().get(new Predicate(new Reference[]{space}, STORE, null)); 
    } catch (Exception e1) { 
     System.out.println("The space named " + spacename + " does not exist. Creating it."); 
     parent.setChildName(Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, normilizeNodeName(spacename))); 
     //Set the space's property name 
     NamedValue[] properties = new NamedValue[]{Utils.createNamedValue(Constants.PROP_NAME, spacename)}; 
     // Create the space using CML (Content Manipulation Language) 
     CMLCreate create = new CMLCreate("1", parent, null, null, null, Constants.TYPE_FOLDER, properties); 
     CML cml = new CML(); 
     cml.setCreate(new CMLCreate[]{create}); 

     //Execute the CML create statement 
     try { 
      getRepositoryService().update(cml); 
     } catch (Exception e2) { 
      e2.printStackTrace(); 
      System.err.println("Can not create the space."); 
      throw e2; 
     } 
    } 
    return space; 
} 

이 문제를 밖으로 정렬 도와주세요 야외 공간을 만들려고 내 소스 코드입니다. 감사

+1

예외가 발생하는 라인은 무엇입니까? – Gagravarr

+1

경로를 사용하여 NodeRef 일명 참조를 만들 수 없습니다. 이 행은 작동하지 않습니다. space = new 참조 (STORE, null, parent.getPath() + "/ cm :"+ ISO9075.encode (spacename)); 공간이 존재하는지 확인하려면 RepositoryService.queryChildren (...) 또는 RepositoryService.query (...)를 사용하십시오. – alfrescian

+2

가능하면 REST 또는 CMIS 사용을 고려하십시오 - Alfresco CML은 약간 구식입니다 – alfrescian

답변

2

를 사용하는 대신이 하나

ParentReference parentReference = new ParentReference(STORE, null, parent.getPath() + "/cm:" + ISO9075.encode(spacename), Constants.ASSOC_CONTAINS, Constants.ASSOC_CONTAINS); 

이 프레스코 SDK에서 샘플을 확인합니다 샘플 \ WebServiceSamples 소스 \ \ 조직 \ 야외 \ 샘플 \의 웹 서비스 \ CMLUpdates.java

에서 이 샘플은 경로가있는 상위 참조를 가져오고 폴더에 추가 파일을 만듭니다.

+0

감사합니다. Tahir :-) –

관련 문제