Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dewniMW committed Oct 5, 2023
1 parent b4a7a58 commit 6223a56
Showing 1 changed file with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
public class OrganizationManagementService {

private static final Log LOG = LogFactory.getLog(OrganizationManagementService.class);
private static final OrganizationDiscoveryManager organizationDiscoveryManager =
OrganizationManagementServiceHolder.getInstance().getOrganizationDiscoveryManager();

/**
* Retrieve organization IDs.
Expand Down Expand Up @@ -399,7 +401,7 @@ public Response addOrganizationDiscoveryAttributes(OrganizationDiscoveryPostRequ
organizationDiscoveryPostRequest) {

try {
List<OrgDiscoveryAttribute> orgDiscoveryAttributeList = getOrganizationDiscoveryManager()
List<OrgDiscoveryAttribute> orgDiscoveryAttributeList = organizationDiscoveryManager
.addOrganizationDiscoveryAttributes(organizationDiscoveryPostRequest.getOrganizationId(),
getOrgDiscoveryAttributesFromPostRequest(organizationDiscoveryPostRequest), true);
String organizationId = organizationDiscoveryPostRequest.getOrganizationId();
Expand All @@ -421,7 +423,7 @@ public Response addOrganizationDiscoveryAttributes(OrganizationDiscoveryPostRequ
public Response getOrganizationDiscoveryAttributes(String organizationId) {

try {
List<OrgDiscoveryAttribute> orgDiscoveryAttributeList = getOrganizationDiscoveryManager()
List<OrgDiscoveryAttribute> orgDiscoveryAttributeList = organizationDiscoveryManager
.getOrganizationDiscoveryAttributes(organizationId, true);
return Response.ok().entity(getOrganizationDiscoveryAttributesResponse(orgDiscoveryAttributeList)).build();
} catch (OrganizationManagementClientException e) {
Expand All @@ -443,7 +445,7 @@ public Response updateOrganizationDiscoveryAttributes(String organizationId, Org
organizationDiscoveryAttributes) {

try {
List<OrgDiscoveryAttribute> orgDiscoveryAttributeList = getOrganizationDiscoveryManager()
List<OrgDiscoveryAttribute> orgDiscoveryAttributeList = organizationDiscoveryManager
.updateOrganizationDiscoveryAttributes(organizationId,
getOrgDiscoveryAttributesFromPutRequest(organizationDiscoveryAttributes), true);
return Response.ok().entity(getOrganizationDiscoveryAttributesResponse(orgDiscoveryAttributeList)).build();
Expand All @@ -463,7 +465,7 @@ public Response updateOrganizationDiscoveryAttributes(String organizationId, Org
public Response deleteOrganizationDiscoveryAttributes(String organizationId) {

try {
getOrganizationDiscoveryManager().deleteOrganizationDiscoveryAttributes(organizationId, true);
organizationDiscoveryManager.deleteOrganizationDiscoveryAttributes(organizationId, true);
return Response.noContent().build();
} catch (OrganizationManagementClientException e) {
return OrganizationManagementEndpointUtil.handleClientErrorResponse(e, LOG);
Expand All @@ -485,7 +487,7 @@ public Response getOrganizationsDiscoveryAttributes(String filter, Integer offse
handleNotImplementedCapabilities(filter, offset, limit);
try {
Map<String, List<OrgDiscoveryAttribute>> organizationsDiscoveryAttributes =
getOrganizationDiscoveryManager().getOrganizationsDiscoveryAttributes();
organizationDiscoveryManager.getOrganizationsDiscoveryAttributes();
OrganizationsDiscoveryResponse response = new OrganizationsDiscoveryResponse();
organizationsDiscoveryAttributes.forEach((key, value) -> {
OrganizationDiscoveryResponse organizationDiscoveryResponse = new OrganizationDiscoveryResponse();
Expand Down Expand Up @@ -517,7 +519,7 @@ public Response isDiscoveryAttributeAvailable(OrganizationDiscoveryCheckPOSTRequ
organizationDiscoveryCheckPOSTRequest) {

try {
boolean discoveryAttributeValueAvailable = getOrganizationDiscoveryManager()
boolean discoveryAttributeValueAvailable = organizationDiscoveryManager
.isDiscoveryAttributeValueAvailable(organizationDiscoveryCheckPOSTRequest.getType(),
organizationDiscoveryCheckPOSTRequest.getValue());
OrganizationDiscoveryCheckPOSTResponse organizationDiscoveryCheckPOSTResponse =
Expand All @@ -540,7 +542,7 @@ public Response getOrganizationMetadata() {

try {
Organization organization = getOrganizationManager().getOrganization(getOrganizationId(), false, true);
List<OrgDiscoveryAttribute> organizationDiscoveryAttributes = getOrganizationDiscoveryManager()
List<OrgDiscoveryAttribute> organizationDiscoveryAttributes = organizationDiscoveryManager
.getOrganizationDiscoveryAttributes(getOrganizationId(), false);
return Response.ok().entity(getOrganizationMetadataResponse(organization, organizationDiscoveryAttributes))
.build();
Expand Down Expand Up @@ -946,9 +948,4 @@ private OrgApplicationManager getOrgApplicationManager() {

return OrganizationManagementServiceHolder.getInstance().getOrgApplicationManager();
}

private OrganizationDiscoveryManager getOrganizationDiscoveryManager() {

return OrganizationManagementServiceHolder.getInstance().getOrganizationDiscoveryManager();
}
}

0 comments on commit 6223a56

Please sign in to comment.