MIFOSX-2036 Refactoring Groups and Centers API - removing clientOptions and groupMemberOptions for template true.

This commit is contained in:
Chandrika
2015-05-12 16:31:36 -04:00
parent d7ff069e11
commit 84b9d5f9f2
2 changed files with 4 additions and 33 deletions
@@ -67,9 +67,6 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
private final StaffReadPlatformService staffReadPlatformService;
private final CodeValueReadPlatformService codeValueReadPlatformService;
// data mappers
private final AllGroupTypesDataMapper allGroupTypesDataMapper = new AllGroupTypesDataMapper();
// data mappers
private final CenterDataMapper centerMapper = new CenterDataMapper();
private final GroupDataMapper groupDataMapper = new GroupDataMapper();
@@ -411,11 +408,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
if (CollectionUtils.isEmpty(staffOptions)) {
staffOptions = null;
}
Collection<GroupGeneralData> groupMembersOptions = retrieveAllGroupsForCenterDropdown(officeIdDefaulted);
if (CollectionUtils.isEmpty(groupMembersOptions)) {
groupMembersOptions = null;
}
final Collection<GroupGeneralData> groupMembersOptions = null;
// final boolean clientPendingApprovalAllowed =
// this.configurationDomainService.isClientPendingApprovalAllowedEnabled();
@@ -423,21 +416,6 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
return CenterData.template(officeIdDefaulted, new LocalDate(), officeOptions, staffOptions, groupMembersOptions);
}
private Collection<GroupGeneralData> retrieveAllGroupsForCenterDropdown(final Long officeId) {
final Long defaultOfficeId = defaultToUsersOfficeIfNull(officeId);
final AppUser currentUser = this.context.authenticatedUser();
final String hierarchy = currentUser.getOffice().getHierarchy();
final String hierarchySearchString = hierarchy + "%";
final String sql = "select " + this.allGroupTypesDataMapper.schema()
+ " where g.office_id = ? and g.parent_id is null and g.level_Id = ? and o.hierarchy like ? order by g.hierarchy";
return this.jdbcTemplate.query(sql, this.allGroupTypesDataMapper, new Object[] { defaultOfficeId, GroupTypes.GROUP.getId(),
hierarchySearchString });
}
private Long defaultToUsersOfficeIfNull(final Long officeId) {
Long defaultOfficeId = officeId;
if (defaultOfficeId == null) {
@@ -31,7 +31,6 @@ import org.mifosplatform.organisation.office.service.OfficeReadPlatformService;
import org.mifosplatform.organisation.staff.data.StaffData;
import org.mifosplatform.organisation.staff.service.StaffReadPlatformService;
import org.mifosplatform.portfolio.client.data.ClientData;
import org.mifosplatform.portfolio.client.service.ClientReadPlatformService;
import org.mifosplatform.portfolio.group.api.GroupingTypesApiConstants;
import org.mifosplatform.portfolio.group.data.CenterData;
import org.mifosplatform.portfolio.group.data.GroupGeneralData;
@@ -50,7 +49,6 @@ public class GroupReadPlatformServiceImpl implements GroupReadPlatformService {
private final JdbcTemplate jdbcTemplate;
private final PlatformSecurityContext context;
private final ClientReadPlatformService clientReadPlatformService;
private final OfficeReadPlatformService officeReadPlatformService;
private final StaffReadPlatformService staffReadPlatformService;
private final CenterReadPlatformService centerReadPlatformService;
@@ -64,14 +62,13 @@ public class GroupReadPlatformServiceImpl implements GroupReadPlatformService {
@Autowired
public GroupReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource,
final CenterReadPlatformService centerReadPlatformService, final ClientReadPlatformService clientReadPlatformService,
final CenterReadPlatformService centerReadPlatformService,
final OfficeReadPlatformService officeReadPlatformService, final StaffReadPlatformService staffReadPlatformService,
final CodeValueReadPlatformService codeValueReadPlatformService,
final PaginationParametersDataValidator paginationParametersDataValidator) {
this.context = context;
this.jdbcTemplate = new JdbcTemplate(dataSource);
this.centerReadPlatformService = centerReadPlatformService;
this.clientReadPlatformService = clientReadPlatformService;
this.officeReadPlatformService = officeReadPlatformService;
this.staffReadPlatformService = staffReadPlatformService;
this.codeValueReadPlatformService = codeValueReadPlatformService;
@@ -103,11 +100,6 @@ public class GroupReadPlatformServiceImpl implements GroupReadPlatformService {
staffOptions = null;
}
Collection<ClientData> clientOptions = this.clientReadPlatformService.retrieveAllForLookupByOfficeId(defaultOfficeId);
if (CollectionUtils.isEmpty(clientOptions)) {
clientOptions = null;
}
final Collection<CodeValueData> availableRoles = this.codeValueReadPlatformService
.retrieveCodeValuesByCode(GroupingTypesApiConstants.GROUP_ROLE_NAME);
@@ -115,7 +107,8 @@ public class GroupReadPlatformServiceImpl implements GroupReadPlatformService {
final String centerName = null;
final Long staffId = null;
final String staffName = null;
final Collection<ClientData> clientOptions = null;
return GroupGeneralData.template(defaultOfficeId, centerId, centerName, staffId, staffName, centerOptions, officeOptions,
staffOptions, clientOptions, availableRoles);
}