Skip to content

Instantly share code, notes, and snippets.

@douglascrp
Last active August 10, 2022 20:12
Show Gist options
  • Save douglascrp/0e6379dfdac1afc3ee73eed523cac9ee to your computer and use it in GitHub Desktop.
Save douglascrp/0e6379dfdac1afc3ee73eed523cac9ee to your computer and use it in GitHub Desktop.
Using Alfresco's AttributeService with javascript
var context = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext();
var attributeService = context.getBean("attributeService", Packages.org.alfresco.repo.attributes.AttributeServiceImpl);
attributeService.getAttributes(function(id, value, keys) {
logger.warn("id: " + id + " - key: " + keys[0] + " - " + keys[1] + " - value: " + value);
if (keys[0] == "project-repo.sequencial.documentos.operacoes") {
attributeService.removeAttribute([keys[0], keys[1]]);
}
return true;
}, ["project-repo.sequencial.documentos.operacoes"]);
var context = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext();
var attributeService = context.getBean("attributeService", Packages.org.alfresco.repo.attributes.AttributeServiceImpl);
attributeService.setAttribute([1459], ["project-repo.sequencial.documentos.operacoes", "numero"]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment