class ResourceTypesResource extends RealmAwareResource {

    @Override
    public Promise<ResourceResponse, ResourceException> updateInstance(Context context, String resourceId,
            UpdateRequest request) {

        String principalName = "unknown";
        try {
            final Subject subject = getSubject(context);
            principalName = PrincipalRestUtils.getPrincipalNameFromSubject(subject);
            final JsonResourceType jsonWrapper = createJsonResourceType(request.getContent());

            ensureResourceIdMatch(jsonWrapper, resourceId);

            if (isEmpty(jsonWrapper.getName())) {
                throw new EntitlementException(MISSING_RESOURCE_TYPE_NAME);
            }

            final ResourceType updatedResourceType = resourceTypeService.updateResourceType(subject, getRealm(context),
                    jsonWrapper.getResourceType(false));

            logger.message("ResourceTypeResource :: UPDATE by {}: for Resource Type: {}", principalName,
                    jsonWrapper.getName());

            return newResultPromise(newResourceResponse(updatedResourceType.getUUID(), null,
                    new JsonResourceType(updatedResourceType).toJsonValue()));

        } catch (EntitlementException e) {
            logger.error("ResourceTypeResource :: UPDATE by {}: Resource Type update failed. ", principalName, e);
            return exceptionMappingHandler.handleError(context, request, e).asPromise();
        }
    }

    @Inject public  ResourceTypesResource(
            @Named("frRest") Debug logger,
            ExceptionMappingHandler<EntitlementException, ResourceException> exceptionMappingHandler,
            ResourceTypeService resourceTypeService);

}