cancel
Showing results for 
Search instead for 
Did you mean: 

Como lograr que 2 procesos de un script sean sincronos

Marquitos
Champ in-the-making
Champ in-the-making

Hola, estoy teniendo una complicación la cual no puedo solucionar. Tengo este codigo que realizó para duplicar los archivos de una carpeta convirtiendolos en xml y agregando en el, las propiedades del archivo. Las 3 líneas principales funcionan correctamente, pero al agregar el xml.content + = me devuelve un error que me informa que el archivo al que le deseo agregar contenido no existe. Necesito crear el archivo y luego que lo busque para agregarle contenido. Alguien me puede ayudar? Gracias !! 

var archivos = espacio; var propiedades = document.properties; 
var xml = archivos.createFile (propiedades.name + ".metadata.properties.xml");
xml.content + = "<? xml version = '1.0' encoding = 'UTF-8'?>" + "\ n" +
"<! DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties .dtd '> "+" \ n "+

" <propiedades> "+" \ n "+

" <entrada clave =' tipo '> "+ propiedades.type +" </entry> "+" \ n "+

" <entrada clave = 'aspectos'> "+" cm: versionable, connexasAdministración: aspecto de administración "+" </entry> "+"

"<entry key = 'cm: description'>" + propiedades.description + "</entry>" + "\ n" +

"<entry key = 'cm: created'>" + propiedades.created + "</ entry > "+" \ n "+

" <entrada clave = 'connexasAdministration: sapstatus'> "+ propiedades.sapstatus +" </entry> "+" \ n "+

" </properties> ";
4 REPLIES 4

angelborroy
Community Manager Community Manager
Community Manager

Esta prueba me ha funcionado sin problemas...

var propiedades = document.properties; 
var xml = 
  document.createFile (propiedades.name + ".metadata.properties.xml"); 

xml.content = "Sample Text";
xml.save();

¿Qué versión de Alfresco estás utilizando?

Hyland Developer Evangelist

Muchas gracias angel, por tu respuesta.  Lo he intentado pero directamente no puedo ejecutar la regla.  La version de alfresco es la 7.0.0 acs enterprise edition. Intento ver el log para ver que tipo de error me da, pero no muestra nada. imageerror

Me ha lanzado el siguiente error

2021-11-29 14:02:38,442 ERROR [node.integrity.IntegrityChecker] [http-nio-8080-exec-5] Found 2 integrity violations:The association source type is incorrect: Source Node: workspace://SpacesStore/a40f0c27-905d-4e89-985d-e15c657b879f Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/content/1.0}folder], name={http://www.alfresco.org/model/content/1.0}contains, target class={http://www.alfresco.org/model/system/1.0}base, source role=null, target role=null] Required Source Type: {http://www.alfresco.org/model/content/1.0}folder Actual Source Type: {http://www.alfresco.org/model/content/1.0}contentThe association source type is incorrect: Source Node: workspace://SpacesStore/268eb66d-4739-4bf8-8512-a5e910e2d2b1 Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/content/1.0}folder], name={http://www.alfresco.org/model/content/1.0}contains, target class={http://www.alfresco.org/model/system/1.0}base, source role=null, target role=null] Required Source Type: {http://www.alfresco.org/model/content/1.0}folder Actual Source Type: {http://www.alfresco.org/model/content/1.0}content
2021-11-29 14:02:38,474 ERROR [extensions.webscripts.AbstractRuntime] [http-nio-8080-exec-5] Exception from executeScript: 10290021 Found 2 integrity violations:The association source type is incorrect: Source Node: workspace://SpacesStore/a40f0c27-905d-4e89-985d-e15c657b879f Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/content/1.0}folder], name={http://www.alfresco.org/model/content/1.0}contains, target class={http://www.alfresco.org/model/system/1.0}base, source role=null, target role=null] Required Source Type: {http://www.alfresco.org/model/content/1.0}folder Actual Source Type: {http://www.alfresco.org/model/content/1.0}contentThe association source type is incorrect: Source Node: workspace://SpacesStore/268eb66d-4739-4bf8-8512-a5e910e2d2b1 Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/content/1.0}folder], name={http://www.alfresco.org/model/content/1.0}contains, target class={http://www.alfresco.org/model/system/1.0}base, source role=null, target role=null] Required Source Type: {http://www.alfresco.org/model/content/1.0}folder Actual Source Type: {http://www.alfresco.org/model/content/1.0}content
org.alfresco.repo.node.integrity.IntegrityException: 10290021 Found 2 integrity violations:
The association source type is incorrect:
Source Node: workspace://SpacesStore/a40f0c27-905d-4e89-985d-e15c657b879f
Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/content/1.0}folder], name={http://www.alfresco.org/model/content/1.0}contains, target class={http://www.alfresco.org/model/system/1.0}base, source role=null, target role=null]
Required Source Type: {http://www.alfresco.org/model/content/1.0}folder
Actual Source Type: {http://www.alfresco.org/model/content/1.0}content
The association source type is incorrect:
Source Node: workspace://SpacesStore/268eb66d-4739-4bf8-8512-a5e910e2d2b1
Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/content/1.0}folder], name={http://www.alfresco.org/model/content/1.0}contains, target class={http://www.alfresco.org/model/system/1.0}base, source role=null, target role=null]
Required Source Type: {http://www.alfresco.org/model/content/1.0}folder
Actual Source Type: {http://www.alfresco.org/model/content/1.0}content

En el ejemplo "document" debe ser una carpeta.

Solo pueden crearse documentos debajo de una carpeta.

Hyland Developer Evangelist
Getting started

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.