class SubjectTypesResource implements CollectionResourceProvider {

    @Override
    public Promise<QueryResponse, ResourceException> queryCollection(Context context, QueryRequest request,
            QueryResourceHandler handler) {

        final Set<String> subjectTypeNames = new TreeSet<>();
        List<ResourceResponse> subjectTypes = new ArrayList<>();

        final String principalName = PrincipalRestUtils.getPrincipalNameFromServerContext(context);

        subjectTypeNames.addAll(entitlementRegistry.getSubjectsShortNames());

        for (String subjectTypeName : subjectTypeNames) {
            final Class<? extends EntitlementSubject> subjectClass =
                    entitlementRegistry.getSubjectType(subjectTypeName);

            if (subjectClass == null) {
                if (debug.warningEnabled()) {
                    debug.warning("SubjectTypesResource :: QUERY by " + principalName +
                            ": Listed subject short name not found: " + subjectTypeName);
                }
                continue;
            }

            final JsonValue json = jsonify(subjectClass, subjectTypeName,
                    LogicalSubject.class.isAssignableFrom(subjectClass));

            if (json != null) {
                String id = json.get(JSON_OBJ_TITLE).asString();
                subjectTypes.add(newResourceResponse(id, null, json));
            }
        }

        QueryResponsePresentation.enableDeprecatedRemainingQueryResponse(request);
        return QueryResponsePresentation.perform(handler, request, subjectTypes);
    }

    @Inject public  SubjectTypesResource(@Named("frRest") Debug debug, EntitlementRegistry entitlementRegistry);

}