Java Code Examples for org.activiti.engine.impl.context.Context#getLocalizationElementProperties()

The following examples show how to use org.activiti.engine.impl.context.Context#getLocalizationElementProperties() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HistoricProcessInstanceQueryImpl.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
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() == false) {
        processInstanceEntity.setLocalizedName(languageNameNode.asText());
      }

      JsonNode languageDescriptionNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_DESCRIPTION);
      if (languageDescriptionNode != null && languageDescriptionNode.isNull() == false) {
        processInstanceEntity.setLocalizedDescription(languageDescriptionNode.asText());
      }
    }
  }
}
 
Example 2
Source File: TaskQueryImpl.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
protected void localize(Task task) {
  task.setLocalizedName(null);
  task.setLocalizedDescription(null);
  
  if (locale != null) {
    String processDefinitionId = task.getProcessDefinitionId();
    if (processDefinitionId != null) {
      ObjectNode languageNode = Context.getLocalizationElementProperties(locale, task.getTaskDefinitionKey(), processDefinitionId, withLocalizationFallback);
      if (languageNode != null) {
        JsonNode languageNameNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_NAME);
        if (languageNameNode != null && languageNameNode.isNull() == false) {
          task.setLocalizedName(languageNameNode.asText());
        }
        
        JsonNode languageDescriptionNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_DESCRIPTION);
        if (languageDescriptionNode != null && languageDescriptionNode.isNull() == false) {
          task.setLocalizedDescription(languageDescriptionNode.asText());
        }
      }
    }
  }
}
 
Example 3
Source File: ProcessInstanceQueryImpl.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
protected void localize(ProcessInstance processInstance) {
  ExecutionEntity processInstanceExecution = (ExecutionEntity) processInstance;
  processInstanceExecution.setLocalizedName(null);
  processInstanceExecution.setLocalizedDescription(null);

  if (locale != null) {
    String processDefinitionId = processInstanceExecution.getProcessDefinitionId();
    if (processDefinitionId != null) {
      ObjectNode languageNode = Context.getLocalizationElementProperties(locale, processInstanceExecution.getProcessDefinitionKey(), processDefinitionId, withLocalizationFallback);
      if (languageNode != null) {
        JsonNode languageNameNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_NAME);
        if (languageNameNode != null && languageNameNode.isNull() == false) {
          processInstanceExecution.setLocalizedName(languageNameNode.asText());
        }

        JsonNode languageDescriptionNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_DESCRIPTION);
        if (languageDescriptionNode != null && languageDescriptionNode.isNull() == false) {
          processInstanceExecution.setLocalizedDescription(languageDescriptionNode.asText());
        }
      }
    }
  }
}
 
Example 4
Source File: HistoricTaskInstanceQueryImpl.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
protected void localize(HistoricTaskInstance task) {
  HistoricTaskInstanceEntity taskEntity = (HistoricTaskInstanceEntity) task;
  taskEntity.setLocalizedName(null);
  taskEntity.setLocalizedDescription(null);

  if (locale != null) {
    String processDefinitionId = task.getProcessDefinitionId();
    if (processDefinitionId != null) {
      ObjectNode languageNode = Context.getLocalizationElementProperties(locale, task.getTaskDefinitionKey(), processDefinitionId, withLocalizationFallback);
      if (languageNode != null) {
        JsonNode languageNameNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_NAME);
        if (languageNameNode != null && languageNameNode.isNull() == false) {
          taskEntity.setLocalizedName(languageNameNode.asText());
        }

        JsonNode languageDescriptionNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_DESCRIPTION);
        if (languageDescriptionNode != null && languageDescriptionNode.isNull() == false) {
          taskEntity.setLocalizedDescription(languageDescriptionNode.asText());
        }
      }
    }
  }
}
 
Example 5
Source File: ExecutionQueryImpl.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
protected void localize(Execution execution, String activityId) {
  ExecutionEntity executionEntity = (ExecutionEntity) execution;
  executionEntity.setLocalizedName(null);
  executionEntity.setLocalizedDescription(null);

  String processDefinitionId = executionEntity.getProcessDefinitionId();
  if (locale != null && processDefinitionId != null) {
    ObjectNode languageNode = Context.getLocalizationElementProperties(locale, activityId, processDefinitionId, withLocalizationFallback);
    if (languageNode != null) {
      JsonNode languageNameNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_NAME);
      if (languageNameNode != null && languageNameNode.isNull() == false) {
        executionEntity.setLocalizedName(languageNameNode.asText());
      }

      JsonNode languageDescriptionNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_DESCRIPTION);
      if (languageDescriptionNode != null && languageDescriptionNode.isNull() == false) {
        executionEntity.setLocalizedDescription(languageDescriptionNode.asText());
      }
    }
  }
}
 
Example 6
Source File: HistoricProcessInstanceQueryImpl.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
protected void localize(HistoricProcessInstance processInstance, CommandContext commandContext) {
    processInstance.setLocalizedName(null);
    processInstance.setLocalizedDescription(null);

    if (locale != null && processInstance.getProcessDefinitionId() != null) {
        ProcessDefinition processDefinition = commandContext.getProcessEngineConfiguration().getDeploymentManager().findDeployedProcessDefinitionById(processInstance.getProcessDefinitionId());
        ObjectNode languageNode = Context.getLocalizationElementProperties(locale, processDefinition.getKey(),
                processInstance.getProcessDefinitionId(), withLocalizationFallback);

        if (languageNode != null) {
            JsonNode languageNameNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_NAME);
            if (languageNameNode != null && !languageNameNode.isNull()) {
                processInstance.setLocalizedName(languageNameNode.asText());
            }

            JsonNode languageDescriptionNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_DESCRIPTION);
            if (languageDescriptionNode != null && !languageDescriptionNode.isNull()) {
                processInstance.setLocalizedDescription(languageDescriptionNode.asText());
            }
        }
    }
}
 
Example 7
Source File: TaskQueryImpl.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
protected void localize(Task task) {
    task.setLocalizedName(null);
    task.setLocalizedDescription(null);

    if (locale != null) {
        String processDefinitionId = task.getProcessDefinitionId();
        if (processDefinitionId != null) {
            ObjectNode languageNode = Context.getLocalizationElementProperties(locale, task.getTaskDefinitionKey(), processDefinitionId, withLocalizationFallback);
            if (languageNode != null) {
                JsonNode languageNameNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_NAME);
                if (languageNameNode != null && !languageNameNode.isNull()) {
                    task.setLocalizedName(languageNameNode.asText());
                }

                JsonNode languageDescriptionNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_DESCRIPTION);
                if (languageDescriptionNode != null && !languageDescriptionNode.isNull()) {
                    task.setLocalizedDescription(languageDescriptionNode.asText());
                }
            }
        }
    }
}
 
Example 8
Source File: ProcessInstanceQueryImpl.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
protected void localize(ProcessInstance processInstance) {
    ExecutionEntity processInstanceExecution = (ExecutionEntity) processInstance;
    processInstanceExecution.setLocalizedName(null);
    processInstanceExecution.setLocalizedDescription(null);

    if (locale != null) {
        String processDefinitionId = processInstanceExecution.getProcessDefinitionId();
        if (processDefinitionId != null) {
            ObjectNode languageNode = Context.getLocalizationElementProperties(locale, processInstanceExecution.getProcessDefinitionKey(), processDefinitionId, withLocalizationFallback);
            if (languageNode != null) {
                JsonNode languageNameNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_NAME);
                if (languageNameNode != null && !languageNameNode.isNull()) {
                    processInstanceExecution.setLocalizedName(languageNameNode.asText());
                }

                JsonNode languageDescriptionNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_DESCRIPTION);
                if (languageDescriptionNode != null && !languageDescriptionNode.isNull()) {
                    processInstanceExecution.setLocalizedDescription(languageDescriptionNode.asText());
                }
            }
        }
    }
}
 
Example 9
Source File: HistoricTaskInstanceQueryImpl.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
protected void localize(HistoricTaskInstance task) {
    task.setLocalizedName(null);
    task.setLocalizedDescription(null);

    if (locale != null) {
        String processDefinitionId = task.getProcessDefinitionId();
        if (processDefinitionId != null) {
            ObjectNode languageNode = Context.getLocalizationElementProperties(locale, task.getTaskDefinitionKey(), processDefinitionId, withLocalizationFallback);
            if (languageNode != null) {
                JsonNode languageNameNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_NAME);
                if (languageNameNode != null && !languageNameNode.isNull()) {
                    task.setLocalizedName(languageNameNode.asText());
                }

                JsonNode languageDescriptionNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_DESCRIPTION);
                if (languageDescriptionNode != null && !languageDescriptionNode.isNull()) {
                    task.setLocalizedDescription(languageDescriptionNode.asText());
                }
            }
        }
    }
}
 
Example 10
Source File: ExecutionQueryImpl.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
protected void localize(Execution execution, String activityId) {
    ExecutionEntity executionEntity = (ExecutionEntity) execution;
    executionEntity.setLocalizedName(null);
    executionEntity.setLocalizedDescription(null);

    String processDefinitionId = executionEntity.getProcessDefinitionId();
    if (locale != null && processDefinitionId != null) {
        ObjectNode languageNode = Context.getLocalizationElementProperties(locale, activityId, processDefinitionId, withLocalizationFallback);
        if (languageNode != null) {
            JsonNode languageNameNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_NAME);
            if (languageNameNode != null && !languageNameNode.isNull()) {
                executionEntity.setLocalizedName(languageNameNode.asText());
            }

            JsonNode languageDescriptionNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_DESCRIPTION);
            if (languageDescriptionNode != null && !languageDescriptionNode.isNull()) {
                executionEntity.setLocalizedDescription(languageDescriptionNode.asText());
            }
        }
    }
}