We've been using a version of the Upload.java code that was included with the CWS code samples to upload new files to Content Server. After the 2016-12 update, the files are able to be created and uploaded but the Category is not getting added, therefore all the metadata is lost.
Reviewing the release notes, I see that there is a new way to handle Categories, Category inheritance, and Metadata. The release notes are pretty detailed, but it isn't clear exactly what we need to change in our Java code to accomplish this.
Can someone please provide a code sample so that we can really understand what we need to do differently now so that our new documents that are uploaded via CWS have the Category assigned? The ParentID of the new file already has the correct Category assigned in Content Server.
From the release notes guide: "– The Document Management web service has been extended. a. There is now a way to get Category inheritance during node creation when using Metadata to pass in AttributeGroups that do not contain Category information. Create a new AttributeGroup, set its Type to "Category" (do not change any of its other features such as Key, Values, etc) and put it in Metadata's AttributeGroups list during node creation."
The way we've been doing this was by creating a new node, then using docManClient.createNodeAndVersionContext to set the contextID.
{
LogUtil.log_data(Level.INFO, "Uploading new document. Parent ObjectId: " + PARENT_ID);
Node myCadNode = new Node();
myCadNode.setDisplayType("CAD Document");
myCadNode.setIsContainer(false);
myCadNode.setIsReference(false);
myCadNode.setIsReservable(true);
myCadNode.setName(dwfFileName);
myCadNode.setParentID(PARENT_ID);
myCadNode.setPartialData(false);
myCadNode.setType("CADDocument");
myCadNode.setComment(llDescription);
contextID = docManClient.createNodeAndVersionContext(myCadNode);
//contextID = docManClient.createDocumentContext(PARENT_ID, file.getName(), null, false, null);
}
Finally, here's how our attributes are set:
//docManService.
AttributeGroupDefinition atgrp = docManClient.getCategoryDefinition(CATEGORY_ID);
List<MultilingualMetadata> mlmd = docManClient.getMultilingualMetadata(424965, null);
List<Attribute> atts = atgrp.getAttributes();
Node doc = docManClient.getNode(OBJECT_ID);
NodeContainerInfo ci = doc.getContainerInfo();
List<NodeFeature> nf = doc.getFeatures();
NodeVersionInfo nvi = doc.getVersionInfo(); //Provides basic info as list for each version. No Category info.
Metadata md = doc.getMetadata();
List<AttributeGroup> atl = md.getAttributeGroups(); //This has the info needed. Just need to figure out how to access it.
AttributeGroup a = atl.get(0);
This code has been working perfectly well for us up until the update.
Can someone please provide a code sample so that we can really understand what we need to do differently now so that our new documents that are uploaded via CWS have the Category assigned? The ParentID of the new file already has the correct Category assigned in Content Server.
BTW, we are not using a version of Tomcat that is affected by the issue noted in the release notes.
I've also reviewed the updated Upload.java code sample that is available on the CS16 OpenText portal. I don't see any differences to the original. It doesn't appear to have been updated by OpenText to use the new method.
Thank you for any help you can provide!