MIFOSX-1737 : Bug fix for center staff assignment history

This commit is contained in:
MithunKashyap
2015-03-04 22:15:34 +05:30
parent 3d7ef79d3d
commit 1b2ea2ebdd
2 changed files with 11 additions and 2 deletions
@@ -217,6 +217,10 @@ public final class Group extends AbstractPersistable<Long> {
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
activate(currentUser, activationLocalDate, dataValidationErrors);
if (this.isCenter() && this.hasStaff()) {
Staff staff = this.getStaff();
this.reassignStaff(staff, activationLocalDate);
}
throwExceptionIfErrors(dataValidationErrors);
}
@@ -492,6 +496,11 @@ public final class Group extends AbstractPersistable<Long> {
return this.groupMembers.contains(group);
}
public boolean hasStaff() {
if (this.staff != null) { return true; }
return false;
}
public List<String> associateGroups(final Set<Group> groupMembersSet) {
final List<String> differences = new ArrayList<>();
@@ -635,7 +644,7 @@ public final class Group extends AbstractPersistable<Long> {
}
// StaffAssignmentHistory[during center creation]
public void caputreStaffHistoryDuringCenterCreation(final Staff newStaff, final LocalDate assignmentDate) {
public void captureStaffHistoryDuringCenterCreation(final Staff newStaff, final LocalDate assignmentDate) {
if (this.isCenter() && this.isActive() && staff != null) {
this.staff = newStaff;
final StaffAssignmentHistory staffAssignmentHistory = StaffAssignmentHistory.createNew(this, this.staff, assignmentDate);
@@ -189,7 +189,7 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group
newGroup.generateHierarchy();
this.groupRepository.saveAndFlush(newGroup);
newGroup.caputreStaffHistoryDuringCenterCreation(staff, activationDate);
newGroup.captureStaffHistoryDuringCenterCreation(staff, activationDate);
return new CommandProcessingResultBuilder() //
.withCommandId(command.commandId()) //
.withOfficeId(groupOffice.getId()) //