Esempi di Automazione

Replica le annotazioni del workflow nelle note del documento

# iterate over the documents attached to the current workflow
#foreach( $doc in $documents ) 
  # retrieve the last task completion event
  #set($lastEvent = $WorkflowTool.getLastHistory($processId,'task.end'))
  
  # apply the 'rejected' stamp and move the file to the Approved subfolder
  $StampTool.stamp($doc, 'approved', $lastEvent.user.username);
  $DocTool.move($doc, 'Approved', $lastEvent.user.username);
  
  # make a pdf conversion of the approved file an store it in a public area
  #set($docConverted = $DocTool.convert($doc, "pdf", $lastEvent.user.username))
  $DocTool.move($docConverted, "/AreaTEST/TEST MERITOR/PUBLIC/Approved", $lastEvent.user.username);
  
  # get the collection of all annotation done by the participants in the current workflow
  #set($histories = $WorkflowTool.getHistories($processId, 'task.note'))
  $log.info("histories: $histories")
  $log.info("histories.size: $histories.size()")
  
  # iterate over the annotations and replicate them in the document
  #set($noteDAO = $ContextTool.getBean('DocumentNoteDAO'))
  #foreach( $hist in $histories )      
      # create the new note to be saved for the document
      #set($note = $ClassTool.newInstance('com.logicaldoc.core.document.DocumentNote'))

      # prepare all the metadata and save to database
      $note.setDocId($doc.id);
      $note.setUsername($hist.username);
      $note.setMessage($hist.comment);
      $note.setDate($doc.date);
      $note.setUserId($hist.userId);
      $note.setFileName($doc.fileName);
      $note.setFileVersion($doc.fileVersion);

      $noteDAO.store($note, null);
  #end
#end

Questa procedura è progettata per essere eseguita all'interno di un flusso di lavoro, l'identificatore dell'istanza del flusso di lavoro corrente è memorizzato nella variabile processId.

Per ogni documento allegato al flusso di lavoro, viene applicato il timbro approved e una conversione pdf viene archiviata in una cartella pubblica.

Una volta completato il flusso di lavoro, le annotazioni lasciate dagli utenti rimangono nella cronologia del forkflow (all'interno della bacheca del workflow), quindi per renderle più facilmente accessibili agli utenti normali, ogni annotazione viene replicata nei documenti come note.