@Override public ChangeSet add(final ChangeSet changeSet) { if (LOG.isDebugEnabled()) { LOG.debug("Add a change set: " + changeSet); } String groupId = changeSetMemberDao.generateChangeSetGroupId(); changeSet.addAssignedUser(changeSet.getCreatedByUserGuid()); // for consistency, always use the time service to set the created date changeSet.setCreatedDate(timeService.getCurrentTime()); // if no state code was set the default is OPEN if (changeSet.getStateCode() == null) { changeSet.setStateCode(ChangeSetStateCode.OPEN); } getChangeSetMutator(changeSet).setObjectGroupId(groupId); return changeSetDao.add(changeSet); }
/** * @param changeSet the change set to add members to * @param loadTuner the load tuner to use */ protected void addMemberObjectsToChangeSet(final ChangeSet changeSet, final LoadTuner loadTuner) { if (!isLoadingMembersEnabled(loadTuner)) { return; } ChangeSetMutator changeSetWithMembers = getChangeSetMutator(changeSet); Collection<BusinessObjectGroupMember> businessObjectGroupMembers = changeSetMemberDao.findGroupMembersByGroupId(changeSet.getGuid()); Collection<BusinessObjectMetadata> memberObjectsMetadata = Collections.emptySet(); if (isLoadingMembersMetadataEnabled(loadTuner)) { memberObjectsMetadata = changeSetMemberDao.findBusinessObjectMetadataByGroupId(changeSet.getGuid()); } Collection<ChangeSetMember> memberObjects = changeSetHelper.convertGroupMembersToChangeSetMembers( businessObjectGroupMembers, memberObjectsMetadata); changeSetWithMembers.setMemberObjects(memberObjects); }
@Override public ChangeSet updateState( final String changeSetGuid, final ChangeSetStateCode stateCode, final LoadTuner loadTuner) { if (StringUtils.isEmpty(changeSetGuid) || stateCode == null) { throw new IllegalArgumentException( String.format( "Must specify change set GUID: %s and a state code: %s", new Object[] {changeSetGuid, stateCode})); } ChangeSet changeSet = changeSetDao.findByGuid(changeSetGuid); if (changeSet == null) { throw new EpServiceException( "No change set with GUID '" + changeSetGuid + "' could be found."); } changeSet.setStateCode(stateCode); final ChangeSet updatedChangedSet = changeSetDao.update(changeSet); addMemberObjectsToChangeSet(updatedChangedSet, loadTuner); return updatedChangedSet; }
@Override public ChangeSet update(final ChangeSet changeSet, final LoadTuner loadTuner) { if (LOG.isDebugEnabled()) { LOG.debug("Update a change set: " + changeSet); } checkChangeAllowed(changeSet.getGuid()); ChangeSet updatedChangedSet = changeSetDao.update(changeSet); addMemberObjectsToChangeSet(updatedChangedSet, loadTuner); return updatedChangedSet; }