use of org.jbpm.shared.services.impl.commands.MergeObjectCommand in project jbpm by kiegroup.
the class DeploymentStore method deactivateDeploymentUnit.
public void deactivateDeploymentUnit(DeploymentUnit unit) {
DeploymentStoreEntry entry = findDeploymentStoreByDeploymentId(unit.getIdentifier());
if (entry != null && entry.getState() != STATE_DEACTIVATED) {
// update only
// 0 - disabled, 1 - enabled, 2 - activated, 3 - deactivated
entry.setState(STATE_DEACTIVATED);
entry.setUpdateDate(new Date());
commandService.execute(new MergeObjectCommand(entry));
}
}
use of org.jbpm.shared.services.impl.commands.MergeObjectCommand in project jbpm by kiegroup.
the class DeploymentStore method enableDeploymentUnit.
public void enableDeploymentUnit(DeploymentUnit unit) {
String unitContent = xstream.toXML(unit);
DeploymentStoreEntry entry = findDeploymentStoreByDeploymentId(unit.getIdentifier());
if (entry != null) {
// update only
// 0 - disabled, 1 - enabled, 2 - activated, 3 - deactivated
entry.setState(STATE_ENABLED);
entry.setUpdateDate(new Date());
entry.setDeploymentUnit(unitContent);
commandService.execute(new MergeObjectCommand(entry));
return;
}
entry = new DeploymentStoreEntry();
entry.setDeploymentId(unit.getIdentifier());
// 0 - disabled, 1 - enabled, 2 - activated, 3 - deactivated
entry.setState(STATE_ENABLED);
entry.setUpdateDate(new Date());
entry.setDeploymentUnit(unitContent);
if (unit instanceof AttributesAware) {
String attribtues = buildEntryAttributes(((AttributesAware) unit).getAttributes());
entry.setAttributes(attribtues);
}
commandService.execute(new PersistObjectCommand(entry));
}
use of org.jbpm.shared.services.impl.commands.MergeObjectCommand in project jbpm by kiegroup.
the class CaseInstanceAuditEventListener method afterCaseDataAdded.
@Override
public void afterCaseDataAdded(CaseDataEvent event) {
Map<String, Object> addedData = event.getData();
if (addedData.isEmpty()) {
return;
}
List<CaseFileDataLog> insert = new ArrayList<>();
List<CaseFileDataLog> update = new ArrayList<>();
List<String> currentCaseData = currentCaseData(event.getCaseId());
addedData.forEach((name, value) -> {
if (value != null) {
CaseFileDataLog caseFileDataLog = null;
if (currentCaseData.contains(name)) {
logger.debug("Case instance {} has already stored log value for {} thus it's going to be updated", event.getCaseId(), name);
caseFileDataLog = caseFileDataByName(event.getCaseId(), name);
update.add(caseFileDataLog);
} else {
logger.debug("Case instance {} has no log value for {} thus it's going to be inserted", event.getCaseId(), name);
caseFileDataLog = new CaseFileDataLog(event.getCaseId(), event.getDefinitionId(), name);
insert.add(caseFileDataLog);
}
caseFileDataLog.setItemType(value.getClass().getName());
caseFileDataLog.setItemValue(value.toString());
caseFileDataLog.setLastModified(new Date());
caseFileDataLog.setLastModifiedBy(event.getUser());
}
});
commandService.execute(new PersistObjectCommand(insert.toArray()));
commandService.execute(new MergeObjectCommand(update.toArray()));
}
use of org.jbpm.shared.services.impl.commands.MergeObjectCommand in project jbpm by kiegroup.
the class DeploymentStore method disableDeploymentUnit.
public void disableDeploymentUnit(DeploymentUnit unit) {
DeploymentStoreEntry entry = findDeploymentStoreByDeploymentId(unit.getIdentifier());
if (entry != null) {
// update only
// 0 - disabled, 1 - enabled, 2 - activated, 3 - deactivated
entry.setState(STATE_DISABLED);
entry.setUpdateDate(new Date());
commandService.execute(new MergeObjectCommand(entry));
}
}
use of org.jbpm.shared.services.impl.commands.MergeObjectCommand in project jbpm by kiegroup.
the class DeploymentStore method activateDeploymentUnit.
public void activateDeploymentUnit(DeploymentUnit unit) {
DeploymentStoreEntry entry = findDeploymentStoreByDeploymentId(unit.getIdentifier());
if (entry != null && entry.getState() != STATE_ACTIVATED) {
// update only
// 0 - disabled, 1 - enabled, 2 - activated, 3 - deactivated
entry.setState(STATE_ACTIVATED);
entry.setUpdateDate(new Date());
commandService.execute(new MergeObjectCommand(entry));
}
}
Aggregations