use of org.wso2.carbon.identity.claim.metadata.mgt.model.ClaimDialect in project carbon-identity-framework by wso2.
the class ApplicationManagementServiceImpl method getAllLocalClaimUris.
@Override
public String[] getAllLocalClaimUris(String tenantDomain) throws IdentityApplicationManagementException {
try {
startTenantFlow(tenantDomain);
String claimDialect = ApplicationMgtSystemConfig.getInstance().getClaimDialect();
List<String> claimUris = new ArrayList<>();
if (UserCoreConstants.DEFAULT_CARBON_DIALECT.equalsIgnoreCase(claimDialect)) {
// Local claims are retrieved via ClaimMetadataManagement service for consistency.
List<LocalClaim> localClaims = ApplicationManagementServiceComponentHolder.getInstance().getClaimMetadataManagementService().getLocalClaims(tenantDomain);
claimUris = getLocalClaimURIs(localClaims);
} else {
ClaimMapping[] claimMappings = CarbonContext.getThreadLocalCarbonContext().getUserRealm().getClaimManager().getAllClaimMappings(claimDialect);
for (ClaimMapping claimMap : claimMappings) {
claimUris.add(claimMap.getClaim().getClaimUri());
}
}
String[] allLocalClaimUris = (claimUris.toArray(new String[claimUris.size()]));
if (ArrayUtils.isNotEmpty(allLocalClaimUris)) {
Arrays.sort(allLocalClaimUris);
}
return allLocalClaimUris;
} catch (Exception e) {
String error = "Error while reading system claims" + ". " + e.getMessage();
throw new IdentityApplicationManagementException(error, e);
} finally {
endTenantFlow();
}
}
use of org.wso2.carbon.identity.claim.metadata.mgt.model.ClaimDialect in project carbon-identity-framework by wso2.
the class ClaimMetadataManagementAdminService method renameClaimDialect.
@SuppressWarnings("unused")
public void renameClaimDialect(ClaimDialectDTO oldClaimDialect, ClaimDialectDTO newClaimDialect) throws ClaimMetadataException {
try {
ClaimDialect oldDialect = ClaimMetadataUtils.convertClaimDialectDTOToClaimDialect(oldClaimDialect);
ClaimDialect newDialect = ClaimMetadataUtils.convertClaimDialectDTOToClaimDialect(newClaimDialect);
String tenantDomain = CarbonContext.getThreadLocalCarbonContext().getTenantDomain();
IdentityClaimManagementServiceDataHolder.getInstance().getClaimManagementService().renameClaimDialect(oldDialect, newDialect, tenantDomain);
} catch (Throwable e) {
log.error(e.getMessage(), e);
throw new ClaimMetadataException(e.getMessage(), e);
}
}
use of org.wso2.carbon.identity.claim.metadata.mgt.model.ClaimDialect in project carbon-identity-framework by wso2.
the class ClaimMetadataManagementAdminService method removeClaimDialect.
@SuppressWarnings("unused")
public void removeClaimDialect(ClaimDialectDTO claimDialect) throws ClaimMetadataException {
try {
ClaimDialect dialect = ClaimMetadataUtils.convertClaimDialectDTOToClaimDialect(claimDialect);
String tenantDomain = CarbonContext.getThreadLocalCarbonContext().getTenantDomain();
IdentityClaimManagementServiceDataHolder.getInstance().getClaimManagementService().removeClaimDialect(dialect, tenantDomain);
} catch (Throwable e) {
log.error(e.getMessage(), e);
throw new ClaimMetadataException(e.getMessage(), e);
}
}
use of org.wso2.carbon.identity.claim.metadata.mgt.model.ClaimDialect in project carbon-identity-framework by wso2.
the class ClaimDialectDAO method renameClaimDialect.
public void renameClaimDialect(ClaimDialect oldClaimDialect, ClaimDialect newClaimDialect, int tenantId) throws ClaimMetadataException {
Connection connection = IdentityDatabaseUtil.getDBConnection();
PreparedStatement prepStmt = null;
String query = SQLConstants.UPDATE_CLAIM_DIALECT;
try {
prepStmt = connection.prepareStatement(query);
prepStmt.setString(1, newClaimDialect.getClaimDialectURI());
prepStmt.setString(2, oldClaimDialect.getClaimDialectURI());
prepStmt.setInt(3, tenantId);
prepStmt.executeUpdate();
IdentityDatabaseUtil.commitTransaction(connection);
} catch (SQLException e) {
IdentityDatabaseUtil.rollbackTransaction(connection);
throw new ClaimMetadataException("Error while renaming claim dialect " + oldClaimDialect.getClaimDialectURI(), e);
} finally {
IdentityDatabaseUtil.closeStatement(prepStmt);
IdentityDatabaseUtil.closeConnection(connection);
}
}
use of org.wso2.carbon.identity.claim.metadata.mgt.model.ClaimDialect in project carbon-identity-framework by wso2.
the class ClaimMetadataEventPublisherProxy method publishPreDeleteClaimDialect.
public void publishPreDeleteClaimDialect(int tenantId, ClaimDialect claimDialect) {
Map<String, Object> eventProperties = new HashMap<>();
eventProperties.put(IdentityEventConstants.EventProperty.TENANT_ID, tenantId);
eventProperties.put(IdentityEventConstants.EventProperty.CLAIM_DIALECT_URI, claimDialect.getClaimDialectURI());
Event event = createEvent(eventProperties, IdentityEventConstants.Event.PRE_DELETE_CLAIM_DIALECT);
doPublishEvent(event);
}
Aggregations