MockDraftWorkflowSchemeState(DraftWorkflowSchemeStore.DraftState scheme) { this.id = scheme.getId(); this.mappings = Maps.newHashMap(scheme.getMappings()); this.lastModifiedUser = scheme.getLastModifiedUser(); this.lastModifiedDate = scheme.getLastModifiedDate(); this.parentSchemeId = scheme.getParentSchemeId(); }
public Builder(DraftWorkflowSchemeStore.DraftState state) { this.id = state.getId(); this.parentId = state.getParentSchemeId(); this.schemeMap = newHashMap(state.getMappings()); this.lastModifiedDate = state.getLastModifiedDate(); this.lastModifiedUser = state.getLastModifiedUser(); }
@Override public void update(DraftState state, GenericValue schemeGv) { Long parentId = schemeGv.getLong(SchemeTable.Columns.PARENT); if (parentId == null || !parentId.equals(state.getParentSchemeId())) { throw new DataAccessException("Trying to change the parent of a draft."); } schemeGv.set(SchemeTable.Columns.UPDATED_DATE, currentDate()); schemeGv.set(SchemeTable.Columns.UPDATED_USER, state.getLastModifiedUser()); delegator.store(schemeGv); }
private DraftWorkflowScheme toWorkflowScheme(DraftWorkflowSchemeStore.DraftState state) { if (state == null) { return null; } else { final ApplicationUser userByKey = userManager.getUserByKey(state.getLastModifiedUser()); return new DraftWorkflowSchemeImpl(state, userByKey, getWorkflowSchemeObj(state.getParentSchemeId())); } }
DefaultWorkflowSchemeStateBuilder(DraftState state) { super(state); this.parentId = state.getParentSchemeId(); this.lastModifiedDate = state.getLastModifiedDate(); this.lastModifiedUser = state.getLastModifiedUser(); }
@Override public GenericValue create(DraftState state) { FieldMap fieldMap = FieldMap.build(SchemeTable.Columns.PARENT, state.getParentSchemeId()); fieldMap.add(SchemeTable.Columns.UPDATED_DATE, currentDate()); fieldMap.add(SchemeTable.Columns.UPDATED_USER, state.getLastModifiedUser()); return delegator.createValue(SchemeTable.ENTITY, fieldMap); }