02-08-2016 12:21 PM
ParentReference parentReference = new ParentReference(store, uuid, null, ASSOC_CONTAINS,
"{" + Constants.NAMESPACE_CONTENT_MODEL + "}" + name);
// Define the content format for the content we are adding
ContentFormat contentFormat = new ContentFormat("image/tiff", "UTF-8");
NamedValue[] propertiesNV = new NamedValue[] { new NamedValue() };
propertiesNV[0].setName("{http://www.alfresco.org/model/content/1.0}name");
propertiesNV[0].setValue(name);
CMLCreate create = new CMLCreate("1", parentReference, null, null, null, Constants.TYPE_CONTENT, propertiesNV);
NamedValue propAspect1 = Utils.createNamedValue(PROP_APPLY_OCR,
properties.getProperty("ocr"));
NamedValue propAspect2 = Utils.createNamedValue(PROP_CIF_EMPRESA,
properties.getProperty("cif"));
NamedValue propAspect3 = Utils.createNamedValue(PROP_USER_NAME,
properties.getProperty("user"));
NamedValue[] aspectProps = new NamedValue[] {propAspect1, propAspect2, propAspect3};
CMLAddAspect addAspect = new CMLAddAspect(ASPECT_OCR, aspectProps, null, "1");
CML cml = new CML();
cml.setCreate(new CMLCreate[]{create});
cml.setAddAspect(new CMLAddAspect[]{addAspect});
UpdateResult[] result = WebServiceFactory.getRepositoryService().update(cml);
Reference newContentNode = result[0].getDestination();
System.out.println("Ref new node " + newContentNode.getPath());
FileInputStream fileInputStream = new FileInputStream(files.get(i));
byte[] bytes = ContentUtils.convertToByteArray(fileInputStream);
System.out.println("Add content. Bytes size " + bytes.length);
Content content = contentService.write(newContentNode, Constants.PROP_CONTENT, bytes, contentFormat);
System.out.println("Saved!!!! " + content.getUrl());
The Web Script /alfresco/api/RepositoryService has responded with a status of 404 - Not Found.
404 Description: Requested resource is not available.
Message: 01050008 Script url network does not map to a Web Script.
Exception: org.springframework.extensions.webscripts.WebScriptException - 01050008 Script url network does not map to a Web Script.
UpdateResult[] result = WebServiceFactory.getRepositoryService().update(cml);
02-11-2016 03:36 AM
240: checkMandatoryProperties(action, getActionDefinition());
public void execute(Action action, NodeRef actionedUponNodeRef)
para que no realice la validaciónpublic ActionDefinition getActionDefinition()
para incorporarle el parámetro script-ref
02-11-2016 01:12 PM
02-11-2016 03:26 PM
02-12-2016 02:42 AM
@Override
public void execute(Action action, NodeRef actionedUponNodeRef) {
// Check the mandatory properties
//checkMandatoryProperties(action, getActionDefinition());
// Only execute the action if this action is read only or the actioned upon node reference doesn't
// have a lock applied for this user.
boolean nodeIsLockedForThisUser = false;
// null nodeRefs can't be locked and some actions can be run against 'null' nodes.
// non-existent nodes can't be locked.
if (!ignoreLock && actionedUponNodeRef != null && mlAwareNodeService.exists(actionedUponNodeRef)) {
nodeIsLockedForThisUser = LockUtils.isLockedAndReadOnly(actionedUponNodeRef, lockService);
}
if (!nodeIsLockedForThisUser) {
// Execute the implementation
executeImpl(action, actionedUponNodeRef);
} else {
if (logger.isWarnEnabled() == true) {
logger.warn("Action (" + action.getActionDefinitionName() +
") ignored because actioned upon node (" + actionedUponNodeRef +
") is locked.");
}
}
}
02-12-2016 05:17 AM
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.