use of org.wso2.carbon.identity.application.common.model.xsd.ClaimMapping in project carbon-identity-framework by wso2.
the class ClaimAdminService method addNewClaimMapping.
/**
* @param
* @throws ClaimManagementException
*/
public void addNewClaimMapping(ClaimMappingDTO claimMappingDTO) throws ClaimManagementException {
/*Convert the simple structure of ClaimMapping received, to the complex structure
of ClaimMapping which is used in the back end. */
ClaimMapping claimMapping = convertClaimMappingDTOToClaimMapping(claimMappingDTO);
ClaimManagerHandler handler = ClaimManagerHandler.getInstance();
ClaimMapping currentMapping = handler.getClaimMapping(claimMapping.getClaim().getClaimUri());
if (currentMapping != null) {
throw new ClaimManagementException("Duplicate claim exist in the system. Please pick a different Claim Uri");
}
handler.addNewClaimMapping(claimMapping);
}
use of org.wso2.carbon.identity.application.common.model.xsd.ClaimMapping in project carbon-identity-framework by wso2.
the class ClaimAdminService method convertClaimMappingToClaimMappingDTO.
private ClaimMappingDTO convertClaimMappingToClaimMappingDTO(ClaimMapping claimMapping) {
ClaimMappingDTO claimMappingDTO = new ClaimMappingDTO();
claimMappingDTO.setClaim(convertClaimToClaimDTO(claimMapping.getClaim()));
claimMappingDTO.setMappedAttribute(claimMapping.getMappedAttribute());
Map<String, String> attributes = claimMapping.getMappedAttributes();
if (attributes != null) {
ClaimAttributeDTO[] attrDto = new ClaimAttributeDTO[attributes.size()];
int i = 0;
for (Map.Entry<String, String> entry : attributes.entrySet()) {
ClaimAttributeDTO dto = new ClaimAttributeDTO();
dto.setAttributeName(entry.getValue());
dto.setDomainName(entry.getKey());
attrDto[i++] = dto;
}
claimMappingDTO.setMappedAttributes(attrDto);
}
return claimMappingDTO;
}
use of org.wso2.carbon.identity.application.common.model.xsd.ClaimMapping in project carbon-identity-framework by wso2.
the class ClaimAdminService method convertClaimMappingDTOToClaimMapping.
private ClaimMapping convertClaimMappingDTOToClaimMapping(ClaimMappingDTO claimMappingDTO) {
ClaimMapping claimMapping = new ClaimMapping(convertClaimDTOToClaim(claimMappingDTO.getClaim()), claimMappingDTO.getMappedAttribute());
ClaimAttributeDTO[] attributes = claimMappingDTO.getMappedAttributes();
if (attributes != null) {
for (ClaimAttributeDTO attribute : attributes) {
if (attribute.getDomainName() != null) {
claimMapping.setMappedAttribute(attribute.getDomainName(), attribute.getAttributeName());
}
}
}
return claimMapping;
}
use of org.wso2.carbon.identity.application.common.model.xsd.ClaimMapping in project carbon-identity-framework by wso2.
the class ClaimAdminService method convertClaimMappingDTOArrayToClaimMappingArray.
private ClaimMapping[] convertClaimMappingDTOArrayToClaimMappingArray(ClaimMappingDTO[] claimMappingDTOs) {
List<ClaimMapping> claimMappings = new ArrayList<ClaimMapping>();
for (ClaimMappingDTO claimMappingDTO : claimMappingDTOs) {
ClaimMapping claimMapping = convertClaimMappingDTOToClaimMapping(claimMappingDTO);
claimMappings.add(claimMapping);
}
return claimMappings.toArray(new ClaimMapping[claimMappings.size()]);
}
use of org.wso2.carbon.identity.application.common.model.xsd.ClaimMapping in project carbon-identity-framework by wso2.
the class ClaimAdminService method convertClaimMappingArrayToClaimMappingDTOArray.
private ClaimMappingDTO[] convertClaimMappingArrayToClaimMappingDTOArray(ClaimMapping[] claimMappings) {
List<ClaimMappingDTO> claimMappingDTOList = new ArrayList<ClaimMappingDTO>();
for (ClaimMapping claimMapping : claimMappings) {
ClaimMappingDTO claimMappingDTO = convertClaimMappingToClaimMappingDTO(claimMapping);
claimMappingDTOList.add(claimMappingDTO);
}
return claimMappingDTOList.toArray(new ClaimMappingDTO[claimMappingDTOList.size()]);
}
Aggregations