Search in sources :

Example 11 with HistoricProcessInstanceEntity

use of org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity in project Activiti by Activiti.

the class HistoricProcessInstanceQueryImpl method localize.

protected void localize(HistoricProcessInstance processInstance, CommandContext commandContext) {
    HistoricProcessInstanceEntity processInstanceEntity = (HistoricProcessInstanceEntity) processInstance;
    processInstanceEntity.setLocalizedName(null);
    processInstanceEntity.setLocalizedDescription(null);
    if (locale != null && processInstance.getProcessDefinitionId() != null) {
        ProcessDefinition processDefinition = commandContext.getProcessEngineConfiguration().getDeploymentManager().findDeployedProcessDefinitionById(processInstanceEntity.getProcessDefinitionId());
        ObjectNode languageNode = Context.getLocalizationElementProperties(locale, processDefinition.getKey(), processInstanceEntity.getProcessDefinitionId(), withLocalizationFallback);
        if (languageNode != null) {
            JsonNode languageNameNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_NAME);
            if (languageNameNode != null && !languageNameNode.isNull()) {
                processInstanceEntity.setLocalizedName(languageNameNode.asText());
            }
            JsonNode languageDescriptionNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_DESCRIPTION);
            if (languageDescriptionNode != null && !languageDescriptionNode.isNull()) {
                processInstanceEntity.setLocalizedDescription(languageDescriptionNode.asText());
            }
        }
    }
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) HistoricProcessInstanceEntity(org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity) ProcessDefinition(org.activiti.engine.repository.ProcessDefinition) JsonNode(com.fasterxml.jackson.databind.JsonNode)

Aggregations

HistoricProcessInstanceEntity (org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity)11 Date (java.util.Date)5 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)4 ArrayList (java.util.ArrayList)3 Collection (java.util.Collection)3 HashSet (java.util.HashSet)3 ActivitiEventDispatcher (org.activiti.engine.delegate.event.ActivitiEventDispatcher)3 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)3 HistoricActivityInstanceEntity (org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity)3 JobStatusEnum (org.finra.herd.model.api.xml.JobStatusEnum)3 JobSummaries (org.finra.herd.model.api.xml.JobSummaries)3 JobSummary (org.finra.herd.model.api.xml.JobSummary)3 JobDefinitionEntity (org.finra.herd.model.jpa.JobDefinitionEntity)3 NamespaceEntity (org.finra.herd.model.jpa.NamespaceEntity)3 Test (org.junit.Test)3 IdGenerator (org.activiti.engine.impl.cfg.IdGenerator)2 ProcessEngineConfigurationImpl (org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 HistoricActivityInstance (org.activiti.engine.history.HistoricActivityInstance)1