public <T extends Entity> T selectById(Class<T> entityClass, String id) { return selectById(entityClass, id, true); }
@Override public <T extends Entity> T selectById(Class<T> entityClass, String id, boolean useCache) { if (getCurrentCommandExecution() != null) { getCurrentCommandExecution().addDbSelect("selectById " + entityClass.getName()); } return super.selectById(entityClass, id, useCache); }
@Override public EntityImpl findById(String entityId) { if (entityId == null) { return null; } // Cache EntityImpl cachedEntity = getEntityCache().findInCache(getManagedEntityClass(), entityId); if (cachedEntity != null) { return cachedEntity; } // Database return getDbSqlSession().selectById(getManagedEntityClass(), entityId, false); }
PropertyEntity dbVersionProperty = selectById(PropertyEntity.class, "schema.version"); String dbVersion = dbVersionProperty.getValue(); insert(dbHistoryProperty); } else { dbHistoryProperty = selectById(PropertyEntity.class, "schema.history");
public Attachment execute(CommandContext commandContext) { return commandContext .getDbSqlSession() .selectById(AttachmentEntity.class, attachmentId); }
private ByteArrayEntity getExceptionByteArray() { if ((exceptionByteArray == null) && (exceptionByteArrayId != null)) { exceptionByteArray = Context .getCommandContext() .getDbSqlSession() .selectById(ByteArrayEntity.class, exceptionByteArrayId); } return exceptionByteArray; } }
public HistoricProcessInstanceEntity findHistoricProcessInstance(String processInstanceId) { if (getHistoryManager().isHistoryEnabled()) { return (HistoricProcessInstanceEntity) getDbSqlSession().selectById(HistoricProcessInstanceEntity.class, processInstanceId); } return null; }
@Override public void recordTaskCategoryChange(String taskId, String category) { if (isHistoryLevelAtLeast(HistoryLevel.AUDIT)) { HistoricTaskInstanceEntity historicTaskInstance = getDbSqlSession().selectById(HistoricTaskInstanceEntity.class, taskId); if (historicTaskInstance != null) { historicTaskInstance.setCategory(category); } } }
/** * Record task description change, if audit history is enabled. */ public void recordTaskDescriptionChange(String taskId, String description) { if (isHistoryLevelAtLeast(HistoryLevel.AUDIT)) { HistoricTaskInstanceEntity historicTaskInstance = getDbSqlSession().selectById(HistoricTaskInstanceEntity.class, taskId); if (historicTaskInstance!=null) { historicTaskInstance.setDescription(description); } } }
/** * Record task due date change, if audit history is enabled. */ public void recordTaskDueDateChange(String taskId, Date dueDate) { if (isHistoryLevelAtLeast(HistoryLevel.AUDIT)) { HistoricTaskInstanceEntity historicTaskInstance = getDbSqlSession().selectById(HistoricTaskInstanceEntity.class, taskId); if (historicTaskInstance!=null) { historicTaskInstance.setDueDate(dueDate); } } }
@Override public void recordTaskEnd(String taskId, String deleteReason) { if (isHistoryLevelAtLeast(HistoryLevel.AUDIT)) { HistoricTaskInstanceEntity historicTaskInstance = getDbSqlSession().selectById(HistoricTaskInstanceEntity.class, taskId); if (historicTaskInstance != null) { historicTaskInstance.markEnded(deleteReason); } } }
public HistoricProcessInstanceEntity findHistoricProcessInstance(String processInstanceId) { if (getHistoryManager().isHistoryEnabled()) { return (HistoricProcessInstanceEntity) getDbSqlSession().selectById(HistoricProcessInstanceEntity.class, processInstanceId); } return null; }
/** * Record task priority change, if audit history is enabled. */ public void recordTaskPriorityChange(String taskId, int priority) { if (isHistoryLevelAtLeast(HistoryLevel.AUDIT)) { HistoricTaskInstanceEntity historicTaskInstance = getDbSqlSession().selectById(HistoricTaskInstanceEntity.class, taskId); if (historicTaskInstance!=null) { historicTaskInstance.setPriority(priority); } } }
@Override public void recordTaskPriorityChange(String taskId, int priority) { if (isHistoryLevelAtLeast(HistoryLevel.AUDIT)) { HistoricTaskInstanceEntity historicTaskInstance = getDbSqlSession().selectById(HistoricTaskInstanceEntity.class, taskId); if (historicTaskInstance != null) { historicTaskInstance.setPriority(priority); } } }
@Override public void recordTaskParentTaskIdChange(String taskId, String parentTaskId) { if (isHistoryLevelAtLeast(HistoryLevel.AUDIT)) { HistoricTaskInstanceEntity historicTaskInstance = getDbSqlSession().selectById(HistoricTaskInstanceEntity.class, taskId); if (historicTaskInstance != null) { historicTaskInstance.setParentTaskId(parentTaskId); } } }
public void deleteGroup(String groupId) { GroupEntity group = getDbSqlSession().selectById(GroupEntity.class, groupId); getDbSqlSession().delete("deleteMembershipsByGroupId", groupId); getDbSqlSession().delete(group); }
public void deleteEditorSourceExtra(ModelEntity model) { if (model.getEditorSourceExtraValueId() != null) { ByteArrayEntity data = getDbSqlSession().selectById(ByteArrayEntity.class, model.getEditorSourceExtraValueId()); getDbSqlSession().delete(data); } }
@Override public void recordTaskClaim(String taskId) { if (isHistoryLevelAtLeast(HistoryLevel.AUDIT)) { HistoricTaskInstanceEntity historicTaskInstance = getDbSqlSession().selectById(HistoricTaskInstanceEntity.class, taskId); if (historicTaskInstance != null) { historicTaskInstance.setClaimTime(Context.getProcessEngineConfiguration().getClock().getCurrentTime()); } } }
public Object execute(CommandContext commandContext) { AttachmentEntity updateAttachment = commandContext .getDbSqlSession() .selectById(AttachmentEntity.class, attachment.getId()); updateAttachment.setName(attachment.getName()); updateAttachment.setDescription(attachment.getDescription()); return null; } }
public void deleteModel(String modelId) { ModelEntity model = getDbSqlSession().selectById(ModelEntity.class, modelId); getDbSqlSession().delete(model); deleteEditorSource(model); deleteEditorSourceExtra(model); if (Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) { Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent( ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_DELETED, model)); } }