Skip to content

Commit

Permalink
Add error constants related to add org discovery attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
dewniMW committed Sep 26, 2023
1 parent 22b8f35 commit 7928340
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ public String getParentOrganizationId(String organizationId) throws Organization
@Override
public boolean isPrimaryOrganization(String organizationId) throws OrganizationManagementServerException {

return Utils.getSubOrgStartLevel() == getOrganizationDepthInHierarchy(organizationId);
return Utils.getSubOrgStartLevel() - 1 == getOrganizationDepthInHierarchy(organizationId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,21 @@ public enum ErrorMessages {
"Application cannot be created for the sub-organization with id: %s."),
ERROR_CODE_NO_PARENT_ORG("60079", "No parent organization.",
"No parent organization is available for the give organization id: %s."),
ERROR_CODE_DISCOVERY_CONFIG_DISABLED("60080", "Can't add organization discovery attribute.",
"The organization discovery configuration is disabled in the root organization with ID: %s."),
ERROR_CODE_UNAUTHORIZED_ORG_ADDS_DISCOVERY_ATTRIBUTE("60081", "Can't add organization discovery " +
"attribute.", "Only the root organization is allowed to add the organization discovery " +
"attribute mappings."),
ERROR_CODE_DUPLICATE_DISCOVERY_ATTRIBUTE_TYPES("60082", "Invalid request body.", "The discovery " +
"attribute type: %s is duplicated."),
ERROR_CODE_DISCOVERY_ATTRIBUTE_TAKEN("60083", "Discovery attribute is already mapped in the " +
"organization hierarchy.", "The provided discovery attribute value is already associated with a " +
"different organization's discovery attribute of type %s."),
ERROR_CODE_UNSUPPORTED_DISCOVERY_ATTRIBUTE("60084", "Unsupported discovery attribute.",
"The discovery attribute type: %s is unsupported."),
ERROR_CODE_DISCOVERY_ATTRIBUTE_ALREADY_ADDED_FOR_ORGANIZATION("60085", "Discovery attribute(s) are " +
"already added for the organization.", "Discovery attribute(s) are already added for the " +
"organization with ID: %s."),

// Server errors.
ERROR_CODE_UNEXPECTED("65001", "Unexpected processing error",
Expand Down Expand Up @@ -598,7 +613,19 @@ public enum ErrorMessages {
"initializing SubOrganizationTenantDeletionHandler. Value not found for : %s."),
ERROR_CODE_GET_ANCESTOR_IN_DEPTH("65114", "Unable to retrieve the ancestor organization in depth.",
"Server encountered an error while retrieving the ancestor organization in depth %s for organization " +
"id: %s."),;
"id: %s."),
ERROR_CODE_ERROR_ADDING_ORGANIZATION_DISCOVERY_ATTRIBUTE("65115", "Unable to add organization " +
"discovery attribute.", "Server encountered an error while adding organization discovery " +
"attribute for organization with id: %s."),
ERROR_CODE_ERROR_CHECKING_ORGANIZATION_DISCOVERY_ATTRIBUTE_EXIST_IN_HIERARCHY("65116", "Error " +
"while checking if the organization discovery attribute exists.", "Server encountered an error" +
" while checking if the organization discovery attribute exists within the hierarchy."),
ERROR_CODE_ERROR_CHECKING_DISCOVERY_ATTRIBUTE_ADDED_IN_ORGANIZATION("65117", "Error while checking " +
"if the organization already has discovery attributes", "Server encountered an error while " +
"checking if the organization with ID: %s already has discovery attribute(s) added."),
ERROR_CODE_ERROR_RETRIEVING_DISCOVERY_CONFIGURATION("65118", "Error while retrieving discovery " +
"configuration.", "Server encountered an error while retrieving discovery configuration for " +
"the root organization with ID: %s.");

private final String code;
private final String message;
Expand Down

0 comments on commit 7928340

Please sign in to comment.