Source:
public SProcessDefinition store(final DesignProcessDefinition designProcessDefinition) throws SProcessDefinitionException { NullCheckingUtil.checkArgsNotNull(designProcessDefinition); final SProcessDefinition definition = convertDesignProcessDefinition(designProcessDefinition); final SProcessDefinitionLogBuilder logBuilder = getQueriableLog(ActionType.CREATED, "Creating a new Process definition"); try { final String processDefinitionContent = getProcessContent(designProcessDefinition); final long tenantId = sessionAccessor.getTenantId(); final long processId = generateId(); setIdOnProcessDefinition(definition, processId); BonitaHomeServer.getInstance().createProcess(tenantId, processId); String displayName = designProcessDefinition.getDisplayName(); if (displayName == null || displayName.isEmpty()) { displayName = definition.getName(); } String displayDescription = designProcessDefinition.getDisplayDescription(); if (displayDescription == null || displayDescription.isEmpty()) { displayDescription = definition.getDescription(); } final SProcessDefinitionDeployInfo definitionDeployInfo = BuilderFactory.get(SProcessDefinitionDeployInfoBuilderFactory.class) .createNewInstance(definition.getName(), definition.getVersion()).setProcessId(processId).setDescription(definition.getDescription()) .setDeployedBy(getUserId()).setDeploymentDate(System.currentTimeMillis()).setActivationState(ActivationState.DISABLED.name()) .setConfigurationState(ConfigurationState.UNRESOLVED.name()).setDisplayName(displayName).setDisplayDescription(displayDescription) .setContent(processDefinitionContent).done(); final InsertRecord record = new InsertRecord(definitionDeployInfo); SInsertEvent insertEvent = null; if (eventService.hasHandlers(PROCESSDEFINITION, EventActionType.CREATED)) { insertEvent = (SInsertEvent) BuilderFactory.get(SEventBuilderFactory.class).createInsertEvent(PROCESSDEFINITION) .setObject(definitionDeployInfo).done(); } recorder.recordInsert(record, insertEvent); log(definition.getId(), SQueriableLog.STATUS_OK, logBuilder, "store"); } catch (final Exception e) { log(definition.getId(), SQueriableLog.STATUS_FAIL, logBuilder, "store"); throw new SProcessDefinitionException(e); } return definition; }

Target:
public SProcessDefinition store(final DesignProcessDefinition designProcessDefinition) throws SProcessDefinitionException { NullCheckingUtil.checkArgsNotNull(designProcessDefinition); final SProcessDefinition definition = convertDesignProcessDefinition(designProcessDefinition); final SProcessDefinitionLogBuilder logBuilder = getQueriableLog(ActionType.CREATED, "Creating a new Process definition"); try { final String processDefinitionContent = getProcessContent(designProcessDefinition); final long tenantId = sessionAccessor.getTenantId(); final long processId = generateId(); setIdOnProcessDefinition(definition, processId); String displayName = designProcessDefinition.getDisplayName(); if (displayName == null || displayName.isEmpty()) { displayName = definition.getName(); } String displayDescription = designProcessDefinition.getDisplayDescription(); if (displayDescription == null || displayDescription.isEmpty()) { displayDescription = definition.getDescription(); } final SProcessDefinitionDeployInfo definitionDeployInfo = BuilderFactory.get(SProcessDefinitionDeployInfoBuilderFactory.class) .createNewInstance(definition.getName(), definition.getVersion()).setProcessId(processId).setDescription(definition.getDescription()) .setDeployedBy(getUserId()).setDeploymentDate(System.currentTimeMillis()).setActivationState(ActivationState.DISABLED.name()) .setConfigurationState(ConfigurationState.UNRESOLVED.name()).setDisplayName(displayName).setDisplayDescription(displayDescription) .setDesignContent(processDefinitionContent).done(); final InsertRecord record = new InsertRecord(definitionDeployInfo); SInsertEvent insertEvent = null; if (eventService.hasHandlers(PROCESSDEFINITION, EventActionType.CREATED)) { insertEvent = (SInsertEvent) BuilderFactory.get(SEventBuilderFactory.class).createInsertEvent(PROCESSDEFINITION) .setObject(definitionDeployInfo).done(); } recorder.recordInsert(record, insertEvent); log(definition.getId(), SQueriableLog.STATUS_OK, logBuilder, "store"); } catch (final Exception e) { log(definition.getId(), SQueriableLog.STATUS_FAIL, logBuilder, "store"); throw new SProcessDefinitionException(e); } return definition; }