09-20-2010 11:55 AM
<aspect name="cm:attachable">
         <title>Attachable</title>
         <associations>
            <association name="cm:attachments">
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>cm:cmobject</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </association>
         </associations>
      </aspect>09-20-2010 07:21 PM
09-21-2010 03:21 AM
CMLAddAspect attachableAspect = new CMLAddAspect("{http://www.alfresco.org/model/content/1.0}attachable", new NamedValue[] { Utils.createNamedValue("{http://www.alfresco.org/model/content/1.0}attachments", **********) }, null, contentId);09-22-2010 08:47 PM
09-23-2010 03:34 AM
09-24-2010 02:11 AM
CMLCreate create = new CMLCreate();
        create.setId("id1");
        create.setType(Constants.TYPE_CONTENT);
        ParentReference parentReference = new ParentReference();
        parentReference.setAssociationType(Constants.ASSOC_CHILDREN);
        parentReference.setChildName(Constants.ASSOC_CHILDREN);
        parentReference.setStore(BaseWebServiceSystemTest.store);
        parentReference.setUuid(BaseWebServiceSystemTest.rootReference.getUuid());
        create.setParent(parentReference);
        create.setProperty(new NamedValue[] {
                        new NamedValue(
                                Constants.PROP_NAME,
                                false,
                                "name.txt",
                                null)});
        
        // Create a folder used for later tests
        CMLCreate createFolder = new CMLCreate();
        createFolder.setId("folder1");
        createFolder.setType(Constants.TYPE_FOLDER);
        createFolder.setParent(parentReference);
        createFolder.setProperty(new NamedValue[] {
                new NamedValue(
                        Constants.PROP_NAME,
                        false,
                        "tempFolder",
                        null)});
        
        CMLAddAspect aspect = new CMLAddAspect();
        aspect.setAspect(Constants.ASPECT_VERSIONABLE);
        aspect.setWhere_id("id1");
        ContentFormat format = new ContentFormat(Constants.MIMETYPE_TEXT_PLAIN, "UTF-8");
        
        CMLWriteContent write = new CMLWriteContent();
        write.setProperty(Constants.PROP_CONTENT);
        write.setContent("this is a test".getBytes());
        write.setFormat(format);
        write.setWhere_id("id1");
        
        CML cml = new CML();
        cml.setCreate(new CMLCreate[]{create, createFolder});
        cml.setAddAspect(new CMLAddAspect[]{aspect});
        cml.setWriteContent(new CMLWriteContent[]{write});
        
        UpdateResult[] results = WebServiceFactory.getRepositoryService().update(cml);
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.