use of org.wso2.carbon.identity.configuration.mgt.core.model.ResourceType in project carbon-identity-framework by wso2.
the class ConfigurationEndpointUtils method getResourceLinkList.
private static List<LinkDTO> getResourceLinkList(String resourceType, List<Resource> resources) {
List<LinkDTO> linkDTOList = new ArrayList<>();
for (Resource resource : resources) {
LinkDTO linkDTO = new LinkDTO();
linkDTO.setHref(getResourceURI(resourceType, resource));
linkDTO.setRel("resource");
linkDTOList.add(linkDTO);
}
return linkDTOList;
}
use of org.wso2.carbon.identity.configuration.mgt.core.model.ResourceType in project carbon-identity-framework by wso2.
the class ConfigurationEndpointUtils method getResourceTypeDTO.
public static ResourceTypeDTO getResourceTypeDTO(ResourceType resourceType) throws ConfigurationManagementException {
ResourceTypeDTO resourceTypeDTO = new ResourceTypeDTO();
resourceTypeDTO.setName(resourceType.getName());
resourceTypeDTO.setId(resourceType.getId());
resourceTypeDTO.setDescription(resourceType.getDescription());
resourceTypeDTO.setLinks(getResourceLinkList(resourceType.getName(), getConfigurationManager().getResourcesByType(resourceType.getName()).getResources()));
return resourceTypeDTO;
}
use of org.wso2.carbon.identity.configuration.mgt.core.model.ResourceType in project carbon-identity-framework by wso2.
the class ConfigurationManagerImpl method getResourcesByType.
/**
* {@inheritDoc}
*/
public Resources getResourcesByType(String resourceTypeName) throws ConfigurationManagementException {
validateResourcesRetrieveRequest(resourceTypeName);
ResourceType resourceType = getResourceType(resourceTypeName);
List<Resource> resourceList = this.getConfigurationDAO().getResourcesByType(getTenantId(), resourceType.getId());
if (resourceList == null) {
if (log.isDebugEnabled()) {
log.debug("No resource found for the resourceTypeName: " + resourceTypeName);
}
throw handleClientException(ErrorMessages.ERROR_CODE_RESOURCES_DOES_NOT_EXISTS, resourceTypeName, null);
}
return new Resources(resourceList);
}
use of org.wso2.carbon.identity.configuration.mgt.core.model.ResourceType in project carbon-identity-framework by wso2.
the class ConfigurationManagerImpl method addResourceType.
/**
* {@inheritDoc}
*/
public ResourceType addResourceType(ResourceTypeAdd resourceTypeAdd) throws ConfigurationManagementException {
validateResourceTypeCreateRequest(resourceTypeAdd);
String resourceTypeID = generateUniqueID();
if (log.isDebugEnabled()) {
log.debug("Resource type id generated: " + resourceTypeID);
}
ResourceType resourceType = generateResourceTypeFromRequest(resourceTypeAdd, resourceTypeID);
getConfigurationDAO().addResourceType(resourceType);
if (log.isDebugEnabled()) {
log.debug("Resource type: " + resourceType.getName() + " successfully created with the id: " + resourceType.getId());
}
return new ResourceType(resourceType.getName(), resourceType.getId(), resourceType.getDescription());
}
use of org.wso2.carbon.identity.configuration.mgt.core.model.ResourceType in project carbon-identity-framework by wso2.
the class ConfigurationManagerImpl method deleteResource.
/**
* {@inheritDoc}
*/
public void deleteResource(String resourceTypeName, String resourceName) throws ConfigurationManagementException {
validateResourceDeleteRequest(resourceTypeName, resourceName);
ResourceType resourceType = getResourceType(resourceTypeName);
this.getConfigurationDAO().deleteResourceByName(getTenantId(), resourceType.getId(), resourceName);
if (log.isDebugEnabled()) {
log.debug("Resource: " + resourceName + " is deleted successfully.");
}
}
Aggregations