cancel
Showing results for 
Search instead for 
Did you mean: 

Consulta código

ferdinandum
Champ in-the-making
Champ in-the-making
**********************
*** SOLUCION  *****
**********************

Crear Carpeta y subcarpeta en CompanyHome



   public static void main(String[] args) throws Exception {
      // Start the session
      AuthenticationUtils.startSession(USERNAME, PASSWORD);

      try {

         // Referenciamos el nodo padre
         Reference SAMPLE_FOLDER = new Reference(STORE, null,"/app:company_home/cm:NodoRaid");
      

         try {
            // Check to see if the sample folder has already been created or
            // not
            WebServiceFactory.getRepositoryService().get(new Predicate(new Reference[] { SAMPLE_FOLDER }, STORE,null));
         }

         catch (Exception exception) {
            

            // Referencia Raiz
            ParentReference parentReference = new ParentReference(STORE,null, "/app:company_home", Constants.ASSOC_CONTAINS,
                                              Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, "NodoRaid"));   

            // Create folder
            NamedValue[] properties = new NamedValue[] { Utils.createNamedValue(Constants.PROP_NAME,"Carpeta Raid") };
            CMLCreate create = new CMLCreate("1", parentReference, null,null, null, Constants.TYPE_FOLDER, properties);
            
            CML cml = new CML();
            cml.setCreate(new CMLCreate[] { create });
            UpdateResult[] results = WebServiceFactory.getRepositoryService().update(cml);

            
   
            // Create parent reference to sample folder
            Reference Padre = results[0].getDestination();
            ParentReference parentReference2 = new ParentReference(STORE,Padre.getUuid(), null, Constants.ASSOC_CONTAINS,
                                             Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, "SubNodo"));

            
            // Create content
            NamedValue[] properties2 = new NamedValue[] { Utils.createNamedValue(Constants.PROP_NAME,"Subcarpeta") };
            CMLCreate create2 = new CMLCreate("1", parentReference2, null,null, null, Constants.TYPE_FOLDER, properties2);
            CML cml2 = new CML();
            cml2.setCreate(new CMLCreate[] { create2 });
            UpdateResult[] results2 = WebServiceFactory.getRepositoryService().update(cml2);
            
            
                        

         }
2 REPLIES 2

pablo_zapico
Champ in-the-making
Champ in-the-making
Supongo q te lo estara creando dentro de cm:sample_folder, debes quitarlo del reference para que te lo cree en el raiz home…

saludos!!!

ferdinandum
Champ in-the-making
Champ in-the-making
Quiero crear un sistema de carpetas:


Raid
|——Sub1
|           |–Sub1.1
|…….Sub2
|           |–Sub2.1


El problema viene que cuando creo Sub1.1 que no se obtener quien es el padre de Sub1
Getting started

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.