cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the UuID of a Reference manually

robobot
Champ in-the-making
Champ in-the-making
Hello there,

i have the following piece of code to create a folder. Now i want to set the uuid of the new Reference manually when the new folder is created. How can i do that ? Thank you very much.

  public String createFolder(String folderPath, final String folderId,final String folderName) throws RemoteException, RepositoryFault {
      
    final ParentReference parentReference = new ParentReference(STORE,null,folderPath,Constants.ASSOC_CONTAINS,getChildName(folderName));
    final String newId = (null == folderId) ? "-1" : folderId;
    CMLCreate create = new CMLCreate(newId, parentReference, null, null, null, Constants.TYPE_FOLDER, createDefaultProperties(folderName));
    //create content manipulation language
    CML cml = new CML();
    //set content to create
    cml.setCreate(new CMLCreate[]{create});  
       
    UpdateResult[] result;
    try {
      WebServiceFactory.getRepositoryService().update(cml);             
    } catch (RepositoryFault e) {
      e.printStackTrace();
    } catch (RemoteException e) {
      e.printStackTrace();
    }   
    return folderPath;
  }
3 REPLIES 3

openpj
Elite Collaborator
Elite Collaborator
I think that you can't set manually the UUID, this value is generated by a specific implementation of this algorithm.

mjuarez
Champ in-the-making
Champ in-the-making
try with this:

public static final Store STORE = new Store(Constants.WORKSPACE_STORE, "SpacesStore");

Reference ref = new Reference();
ref.setUuid("2e1d57d4-036b-4a4b-8bc0-02670081f45c");
ref.setStore(Properties.STORE);

Regards..

mjuarez
Champ in-the-making
Champ in-the-making
I'm sorry, had not understood!! I believe is not possible, the uuid is automatic.. Regards