10-08-2008 11:20 AM
var espacio="Proforma4";
var dest = companyhome.childByNamePath(espacio);
if (dest == null)
{
companyhome.createFolder(espacio);
}
for (var i = 0; i < bpm_package.children.length; i++)
{
var documento = bpm_package.children[i];
var mover = documento.move(dest);
if (mover == null)
{
var backupName = "Backup of " + mover.name;
mover.name = backupName;
mover.save();
mover.move(espacio);
}
}
El cual comprueba si existe un espacio10-08-2008 04:47 PM
var espacio="Proforma4";
var dest = companyhome.childByNamePath(espacio);
if (dest == null)
{
dest = companyhome.createFolder(espacio);
}
for (var i = 0; i < bpm_package.children.length; i++)
{
var documento = bpm_package.children[i];
var backupName = "Backup of " + documento.name;
if (dest.childByNamePath(documento.name) != null) {
//Falta determinar qué ocurre si ya existe en dest o en origen el nodo "Backup of X"
documento.name = backupName;
documento.save();
}
documento.move(dest);
}
Básicamente lo que no me parecía bien era el fragmento de:mover.name = backupName;
mover.save();
mover.move(espacio);
Ya que no deberían aplicarse sobre la variable mover (que es simplemente un indicador de si ha ido bien o no el movimiento del nodo). Debería hacerse contra documento.10-09-2008 01:15 PM
<task-node name="Vendedor">
<task name="wfj:prueba" swimlane="initiator">
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
<actor>#{bpm_assignee}</actor>
</assignment>
</task>
<transition to="Documentos Proformas" name="Enviar a Proforma">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
var espacio="Proforma4";
var dest = companyhome.childByNamePath(espacio);
if (dest == null)
{
companyhome.createFolder(espacio);
}
for (var i = 0; i < bpm_package.children.length; i++)
{
var text=espacio + "/"+ bpm_package.children[i].name;
var logFile = companyhome.childByNamePath(text);
if (logFile == null)
{
bpm_package.children[i].move(dest);
}
else
{
var x=1;
var rr=0;
while(rr!=1)
{
var backupName2 = x + "-" + bpm_package.children[i].name;
var text2=espacio + "/"+ backupName2;
var logFile2 = companyhome.childByNamePath(text2);
if (logFile2 == null)
{
bpm_package.children[i].name= backupName2;
bpm_package.children[i].move(dest);
rr=1;
}
logFile = companyhome.childByNamePath(text2);
x=x+1;
}
}
}
</script>
</action>
</transition>
<transition to="OC Rechazadas" name="Rechazar"></transition>
</task-node>
<task-node name="Vendedor">
<task name="wfj:prueba" swimlane="initiator">
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
<actor>#{bpm_assignee}</actor>
</assignment>
</task>
<transition to="Documentos Proformas" name="Enviar a Proforma">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
var espacio="Proforma4";
var dest = companyhome.childByNamePath(espacio);
if (dest == null)
{
companyhome.createFolder(espacio);
}
for (var i = 0; i < bpm_package.children.length; i++)
{
var text=espacio + "/"+ bpm_package.children[i].name;
var logFile = companyhome.childByNamePath(text);
if (logFile == null)
{
bpm_package.children[i].move(dest);
}
else
{
var x=1;
var rr=0;
while(rr!=1)
{
var documento =bpm_package.children[i];
var backupName2 = x + "-" + documento.name;
var text2=espacio + "/"+ backupName2;
var logFile2 = companyhome.childByNamePath(text2);
if (logFile2 == null)
{
documento.name= backupName2;
documento.save();
documento.move(dest);
rr=1;
}
logFile = companyhome.childByNamePath(text2);
x=x+1;
}
}
}
</script>
</action>
</transition>
<transition to="OC Rechazadas" name="Rechazar"></transition>
</task-node>
10-15-2008 02:42 PM
for (var i = 0; i < bpm_package.children.length; i++)
{
var text=espacio + "/"+ bpm_package.children[i].name;
var logFile = companyhome.childByNamePath(text);
if (logFile == null)
{
bpm_package.children[i].move(dest);
}
else
{
var x=1;
var rr=0;
while(rr!=1)
{
var backupName2 = x + "-" + bpm_package.children[i].name;
var text2=espacio + "/"+ backupName2;
var logFile2 = companyhome.childByNamePath(text2);
if (logFile2 == null)
{
bpm_package.children[i].name= backupName2;
bpm_package.children[i].move(dest);
rr=1;
}
x=x+1;
}
}
10-16-2008 05:55 AM
10-16-2008 02:52 PM
01-23-2009 09:19 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.