Skip to content

Commit

Permalink
impl
Browse files Browse the repository at this point in the history
Issue #190
  • Loading branch information
rsoika committed Aug 1, 2023
1 parent 91bc7db commit 2fa9ba0
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import javax.inject.Inject;

import org.imixs.archive.core.SnapshotService;
import org.imixs.workflow.FileData;
import org.imixs.workflow.ItemCollection;
import org.imixs.workflow.SignalAdapter;
import org.imixs.workflow.WorkflowKernel;
Expand Down Expand Up @@ -175,7 +176,7 @@ protected void createSubprocesses(final List<String> subProcessDefinitions, fina
if (debug) {
logger.info("....split filename " + fileName);
}
processSubWorktitem(processData,originWorkitem, fileName);
processSubWorkitem(processData,originWorkitem, fileName);
}
if (count==0) {
throw new PluginException(DOCUMENTSPLIT, FILE_ERROR, "DocumentSplitAdapter - no file found matching the given filepattern, please check workflow model!");
Expand All @@ -198,7 +199,7 @@ protected void createSubprocesses(final List<String> subProcessDefinitions, fina
* @throws PluginException
* @throws ModelException
*/
private void processSubWorktitem( ItemCollection processData, ItemCollection originWorkitem, String filename) throws AccessDeniedException, ProcessingErrorException, PluginException, ModelException {
private void processSubWorkitem( ItemCollection processData, ItemCollection originWorkitem, String filename) throws AccessDeniedException, ProcessingErrorException, PluginException, ModelException {
boolean debug = logger.isLoggable(Level.FINE);
// create new process instance
ItemCollection workitemSubProcess = new ItemCollection();
Expand All @@ -211,16 +212,15 @@ private void processSubWorktitem( ItemCollection processData, ItemCollection ori
workitemSubProcess.removeItem("$eventlog");
workitemSubProcess.removeItem("txtworkflowhistory");

// now remove all filesdata object not equal to the current filename.
List<String> fileNames=originWorkitem.getFileNames();
for (String _fileName : fileNames) {
if (!_fileName.equals(filename)) {
if (debug) {
logger.info("....remove filename " + _fileName);
}
workitemSubProcess.removeFile(_fileName);
}
}
// now remove all filesdata objects....
workitemSubProcess.removeItem("$file");
// ... and copy the content form the origin snapshot!
FileData snapshotFileData = snapshotService.getWorkItemFile(originWorkitem.getUniqueID(), filename);
if (snapshotFileData==null) {
throw new PluginException(DOCUMENTSPLIT, FILE_ERROR, "DocumentSplitAdapter - no snapshot filedata object found!");
}
workitemSubProcess.addFileData(snapshotFileData);

// check model version
String sModelVersion = processData.getItemValueString("modelversion");
if (sModelVersion.isEmpty()) {
Expand Down

0 comments on commit 2fa9ba0

Please # to comment.