Search in sources :

Example 1 with AttributesAware

use of org.jbpm.kie.services.api.AttributesAware 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));
}
Also used : AttributesAware(org.jbpm.kie.services.api.AttributesAware) PersistObjectCommand(org.jbpm.shared.services.impl.commands.PersistObjectCommand) MergeObjectCommand(org.jbpm.shared.services.impl.commands.MergeObjectCommand) Date(java.util.Date)

Aggregations

Date (java.util.Date)1 AttributesAware (org.jbpm.kie.services.api.AttributesAware)1 MergeObjectCommand (org.jbpm.shared.services.impl.commands.MergeObjectCommand)1 PersistObjectCommand (org.jbpm.shared.services.impl.commands.PersistObjectCommand)1