AnsweredAssumed Answered

Create a file in the repository: exception during update

Question asked by sergio on Nov 27, 2006
Latest reply on Nov 27, 2006 by sergio
Hi all.

I am not able to find the error in my code. The task is very simple: creating a file inside a node.

Here the code:

private void wsCreateNewContent(String nodeId)
   {
      String storeSchema = Constants.WORKSPACE_STORE;
     String storeAddress = "SpacesStore";
     final Store STORE = new Store(storeSchema, storeAddress);
     
     ParentReference parentRef = new ParentReference();
    parentRef.setStore(STORE);
    parentRef.setUuid("14c29a12-7be0-11db-83b6-f5ef9685f99e");
    parentRef.setAssociationType(Constants.ASSOC_CHILDREN);
    parentRef.setChildName(Constants.ASSOC_CHILDREN);
   
    CMLCreate create = new CMLCreate();
    create.setId("1");
    create.setParent(parentRef);
    create.setType(Constants.TYPE_CONTENT);
    NamedValue[] nv = new NamedValue[1];
    NamedValue n = new NamedValue(Constants.PROP_NAME, false, "readme.txt", null);
    nv[0] = n;
    create.setProperty(nv);
   
    CML cml = new CML();
    cml.setCreate(new CMLCreate[]{create});
    try
    {
         UpdateResult[] result = repositoryService.update(cml);
      }
    catch (RepositoryFault e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
    catch (RemoteException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }    
   } 

Please, could anyone help me in findind the problem. The code is apparently the same as the code provided with the testContentService() method for the ContentServiseSystemTest class from the SDK, but mine does not work.

Many thanks to all in advance.

All the best,

Sergio

Outcomes