10-08-2018 03:56 AM
HI all,
I am going to update aspect but it is giving internal server error for this?
here is code that is going to update the aspect
private static void customAspectAdd(AlfrescoDocument alfDocFromDocumentByPath, String aspect) {
if (!alfDocFromDocumentByPath.hasAspect(aspect)) {
Map<String, GregorianCalendar> mapOfAspect = new HashMap<String, GregorianCalendar>();
mapOfAspect.put(aspect, null);
alfDocFromDocumentByPath.addAspect(aspect);
System.out.println(" ##############----Alfresco document Updated for aspect -----------########### : "
+ aspect + " : Document Name : " + alfDocFromDocumentByPath.getName() + "Document Path :"
+ alfDocFromDocumentByPath.getPaths().get(0));
numOfDocUpdatedForAspect++;
} else {
System.out.println(" Aspect is already present: " + aspect + " : Document Path :"
+ alfDocFromDocumentByPath.getPaths().get(0));
}
}
Here is the exception I am getting
Exception in file :to_collectkeys_apinputgen_adela.bpmn :Not able to update aspect at path : /Sites/vikas/vikasdocument/Itineraries/to_collectkeys_apinputgen_adela.bpmn :: Internal Server Error
org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: Internal Server Error
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:452)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.put(AbstractAtomPubService.java:595)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.put(AbstractAtomPubService.java:581)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.updateProperties(ObjectServiceImpl.java:307)
at org.alfresco.cmis.client.impl.AlfrescoUtils.updateAspects(AlfrescoUtils.java:432)
at org.alfresco.cmis.client.impl.AlfrescoAspectsImpl.addAspect(AlfrescoAspectsImpl.java:104)
at org.alfresco.cmis.client.impl.AlfrescoAspectsImpl.addAspect(AlfrescoAspectsImpl.java:96)
at org.alfresco.cmis.client.impl.AlfrescoDocumentImpl.addAspect(AlfrescoDocumentImpl.java:126)
at com.gl.main.CorrectAspectLessFileNewComputeZone.customAspectAdd(CorrectAspectLessFileNewComputeZone.java:94)
at com.gl.main.CorrectAspectLessFileNewComputeZone.main(CorrectAspectLessFileNewComputeZone.java:74)
Thanks in Advance for any help.
JeffEarley _Angel Borroy
10-10-2018 04:04 PM
What version of Alfresco are you using? Newer versions of Alfresco do not use the OpenCMIS Extension, which is where I think you found the org.alfresco.cmis.client.impl.AlfrescoDocumentImpl class.
The correct way to add aspects via CMIS is to add the aspect ID to the cmis:secondaryObjectTypeIds property.
Explore our Alfresco products with the links below. Use labels to filter content by product module.