Package org.apache.isis.viewer.json.applib

Examples of org.apache.isis.viewer.json.applib.JsonRepresentation$HasExtensions


        getLinks().arrayAdd(link);
    }

    private void addLinkToDomainTypes() {

        final JsonRepresentation link = LinkBuilder.newBuilder(getResourceContext(), Rel.TYPES, RepresentationType.TYPE_LIST, "domainTypes").build();

        final LinkFollower linkFollower = getLinkFollower().follow("links[rel=types]");
        if (linkFollower.matches(link)) {

            final RendererFactory factory = RendererFactoryRegistry.instance.find(RepresentationType.TYPE_LIST);

            final TypeListReprRenderer renderer = (TypeListReprRenderer) factory.newRenderer(getResourceContext(), linkFollower, JsonRepresentation.newMap());

            final Collection<ObjectSpecification> specifications = getResourceContext().getSpecificationLookup().allSpecifications();

            renderer.withSelf("domainTypes").with(specifications);

            link.mapPut("value", renderer.render());
        }

        getLinks().arrayAdd(link);
    }
View Full Code Here


        addLinkToReturnTypeIfAny();
        addLinkToElementTypeIfAny();
    }

    private void addParameters() {
        final JsonRepresentation parameterList = JsonRepresentation.newArray();
        final List<ObjectActionParameter> parameters = getObjectFeature().getParameters();
        for (final ObjectActionParameter parameter : parameters) {
            final LinkBuilder linkBuilder = ActionParameterDescriptionReprRenderer.newLinkToBuilder(getResourceContext(), Rel.ACTION_PARAM, objectSpecification, parameter);
            parameterList.arrayAdd(linkBuilder.build());
        }

        representation.mapPut("parameters", parameterList);
    }
View Full Code Here

    /**
     * Will lazily create links array as required
     */
    protected JsonRepresentation getLinks() {
        JsonRepresentation links = representation.getArray("links");
        if (links == null) {
            links = JsonRepresentation.newArray();
            representation.mapPut("links", links);
        }
        return links;
View Full Code Here

    /**
     * Will lazily create extensions map as required
     */
    protected JsonRepresentation getExtensions() {
        JsonRepresentation extensions = representation.getMap("extensions");
        if (extensions == null) {
            extensions = JsonRepresentation.newMap();
            representation.mapPut("extensions", extensions);
        }
        return extensions;
View Full Code Here

        addToExtensions("changed", updateNotifier.getChangedObjects());
        addToExtensions("disposed", updateNotifier.getDisposedObjects());
    }

    private void addToExtensions(final String key, final List<ObjectAdapter> adapters) {
        final JsonRepresentation adapterList = JsonRepresentation.newArray();
        getExtensions().mapPut(key, adapterList);
        for (final ObjectAdapter adapter : adapters) {
            adapterList.arrayAdd(DomainObjectReprRenderer.newLinkToBuilder(getResourceContext(), Rel.OBJECT, adapter).build());
        }
    }
View Full Code Here

    }

    @Override
    public UserReprRenderer with(final AuthenticationSession authenticationSession) {
        representation.mapPut("userName", authenticationSession.getUserName());
        final JsonRepresentation roles = JsonRepresentation.newArray();
        for (final String role : authenticationSession.getRoles()) {
            roles.arrayAdd(role);
        }
        representation.mapPut("roles", roles);
        return this;
    }
View Full Code Here

        // self
        if (includesSelf) {
            withSelf("domainTypes");
        }

        final JsonRepresentation specList = JsonRepresentation.newArray();
        for (final ObjectSpecification objectSpec : specifications) {
            final LinkBuilder linkBuilder = LinkBuilder.newBuilder(getResourceContext(), Rel.DOMAIN_TYPE, RepresentationType.DOMAIN_TYPE, "domainTypes/%s", objectSpec.getFullIdentifier());
            specList.arrayAdd(linkBuilder.build());
        }

        representation.mapPut("values", specList);

        getExtensions(); // empty
View Full Code Here

TOP

Related Classes of org.apache.isis.viewer.json.applib.JsonRepresentation$HasExtensions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.