use of org.wso2.carbon.identity.rest.api.server.claim.management.v1.dto.ClaimDialectResDTO in project identity-api-server by wso2.
the class ServerClaimManagementService method getClaimDialectResDTO.
private ClaimDialectResDTO getClaimDialectResDTO(ClaimDialect claimDialect) {
ClaimDialectResDTO claimDialectResDTO = new ClaimDialectResDTO();
String dialectId;
if (StringUtils.equals(claimDialect.getClaimDialectURI(), LOCAL_DIALECT)) {
dialectId = LOCAL_DIALECT_PATH;
} else {
dialectId = base64EncodeId(claimDialect.getClaimDialectURI());
}
claimDialectResDTO.setId(dialectId);
claimDialectResDTO.setDialectURI(claimDialect.getClaimDialectURI());
LinkDTO linkDTO = new LinkDTO();
linkDTO.setRel(REL_CLAIMS);
linkDTO.setHref(buildURIForBody(String.format(V1_API_PATH_COMPONENT + CMT_PATH_COMPONENT + "/%s/claims", dialectId)).toString());
claimDialectResDTO.setLink(linkDTO);
return claimDialectResDTO;
}
use of org.wso2.carbon.identity.rest.api.server.claim.management.v1.dto.ClaimDialectResDTO in project identity-api-server by wso2.
the class ServerClaimManagementService method getClaimDialect.
/**
* Retrieve a claim dialect.
*
* @param dialectId dialectId.
* @return Claim dialect.
*/
public ClaimDialectResDTO getClaimDialect(String dialectId) {
try {
List<ClaimDialect> claimDialectList = getClaimMetadataManagementService().getClaimDialects(ContextLoader.getTenantDomainFromContext());
String decodedDialectId;
if (StringUtils.equals(dialectId, LOCAL_DIALECT_PATH)) {
decodedDialectId = LOCAL_DIALECT;
} else {
decodedDialectId = base64DecodeId(dialectId);
}
ClaimDialect claimDialect = extractDialectFromDialectList(decodedDialectId, claimDialectList);
if (claimDialect == null) {
throw handleClaimManagementClientError(ERROR_CODE_DIALECT_NOT_FOUND, NOT_FOUND, dialectId);
}
return getClaimDialectResDTO(claimDialect);
} catch (ClaimMetadataException e) {
throw handleClaimManagementException(e, ERROR_CODE_ERROR_RETRIEVING_DIALECT, dialectId);
}
}
Aggregations