Examples of ObjectPropertyRepresentation


Examples of org.apache.isis.viewer.json.applib.domainobjects.ObjectPropertyRepresentation

        final Response idPropertyResp = domainObjectResource.propertyDetails("OID:1", "id");
        final RestfulResponse<ObjectPropertyRepresentation> idPropertyJsonResp = RestfulResponse.ofT(idPropertyResp);
        assertThat(idPropertyJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));

        // then
        final ObjectPropertyRepresentation propertyDetailsRepr = idPropertyJsonResp.getEntity();

        // _self.link
        final LinkRepresentation selfLink = propertyDetailsRepr.getLink("_self.link");
        assertThat(selfLink.getRel(), is("member"));
        assertThat(selfLink.getHref(), matches(".+objects/OID:1/properties/id"));
        assertThat(selfLink.getHttpMethod(), is(HttpMethod.GET));

        // _self.object
        final LinkRepresentation selfObject = propertyDetailsRepr.getLink("_self.object");
        assertThat(selfObject.getRel(), is("object"));
        assertThat(selfObject.getHref(), matches(".+objects/OID:1"));
        assertThat(selfObject.getHttpMethod(), is(HttpMethod.GET));

        // type
        final LinkRepresentation type = propertyDetailsRepr.getLink("type");
        assertThat(type.getRel(), is("type"));
        assertThat(type.getHref(), matches(".+vnd\\.string\\+json"));
        assertThat(type.getHttpMethod(), is(HttpMethod.GET));

        assertThat(propertyDetailsRepr.getString("memberType"), is("property"));
        assertThat(propertyDetailsRepr.getString("value"), is(org.apache.isis.tck.objstore.dflt.scalars.ApplibValuedEntityRepositoryDefault.class.getName()));
        assertThat(propertyDetailsRepr.getString("disabledReason"), is(not(nullValue())));
    }
View Full Code Here

Examples of org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectPropertyRepresentation

        final Response idPropertyResp = domainObjectResource.propertyDetails("org.apache.isis.core.tck.dom.defaults.WithDefaultsEntity","68", "anInt");
        final RestfulResponse<ObjectPropertyRepresentation> idPropertyJsonResp = RestfulResponse.ofT(idPropertyResp);
        assertThat(idPropertyJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));

        // then
        final ObjectPropertyRepresentation propertyRepr = idPropertyJsonResp.getEntity();

        assertThat(propertyRepr.getString("memberType"), is("property"));

        // self link
        final LinkRepresentation selfLink = propertyRepr.getLinkWithRel(Rel.SELF);
        assertThat(selfLink, isLink(client)
                                .httpMethod(RestfulHttpMethod.GET)
                                .href(endsWith("/objects/org.apache.isis.core.tck.dom.defaults.WithDefaultsEntity/68/properties/anInt"))
                                .returning(HttpStatusCode.OK)
                                .build());

        // up link
        final LinkRepresentation upLink = propertyRepr.getLinkWithRel(Rel.UP);
        assertThat(upLink, isLink(client)
                                .httpMethod(RestfulHttpMethod.GET)
                                .href(endsWith("/objects/org.apache.isis.core.tck.dom.defaults.WithDefaultsEntity/68"))
                                .returning(HttpStatusCode.OK)
                                .type(RepresentationType.DOMAIN_OBJECT.getMediaType())
                                .title("default-name")
                                .build());

        //modify link
        final LinkRepresentation modifyLink = propertyRepr.getLinkWithRel(Rel.MODIFY);
        assertThat(modifyLink, isLink(client)
                                .httpMethod(RestfulHttpMethod.PUT)
                                .type(RepresentationType.OBJECT_PROPERTY.getMediaType())
                                .href(endsWith("/objects/org.apache.isis.core.tck.dom.defaults.WithDefaultsEntity/68/properties/anInt"))
                                .build());

        assertThat(modifyLink.getArguments(), is(not(nullValue())));
        assertThat(modifyLink.getArguments().isArray(), is(false));
        assertThat(modifyLink.getArguments().size(), is(1));

        //clear link
        final LinkRepresentation clearLink = propertyRepr.getLinkWithRel(Rel.CLEAR);
        assertThat(clearLink, isLink(client)
                                .httpMethod(RestfulHttpMethod.DELETE)
                                .type(RepresentationType.OBJECT_PROPERTY.getMediaType())
                                .href(endsWith("/objects/org.apache.isis.core.tck.dom.defaults.WithDefaultsEntity/68/properties/anInt"))
                                .build());

        // described by link
        final LinkRepresentation describedByLink = propertyRepr.getLinkWithRel(Rel.DESCRIBEDBY);
        assertThat(describedByLink, isLink(client)
                                .returning(HttpStatusCode.OK)
                                .responseEntityWithSelfHref(describedByLink.getHref())
                                .build());

        assertThat(propertyRepr.getInt("value"), is(42));
        assertThat(propertyRepr.getString("format"),is("int"));
        assertThat(propertyRepr.getString("extensions.x-isis-format"), is("int"));
        assertThat(propertyRepr.getExtensions(), isMap());
        assertThat(propertyRepr.getExtensions().getArray("changed").isArray(), is(true));
        assertThat(propertyRepr.getExtensions().getArray("disposed").isArray(), is(true));
    }
View Full Code Here

Examples of org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectPropertyRepresentation

    private ObjectPropertyRepresentation getObjectPropertyRepr(final String domainType, final String instanceId, String propertyId) throws JsonParseException, JsonMappingException, IOException {
        final Response domainObjectResp = domainObjectResource.propertyDetails(domainType, instanceId, propertyId);
        final RestfulResponse<ObjectPropertyRepresentation> domainObjectJsonResp = RestfulResponse.ofT(domainObjectResp);
        assertThat(domainObjectJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));

        final ObjectPropertyRepresentation repr = domainObjectJsonResp.getEntity();
        return repr;
    }
View Full Code Here

Examples of org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectPropertyRepresentation

        final ObjectPropertyRepresentation repr = domainObjectJsonResp.getEntity();
        return repr;
    }

    private LinkRepresentation getObjectPropertyReprModifyLink(String domainType, String instanceId, String propertyId) throws JsonParseException, JsonMappingException, IOException {
        ObjectPropertyRepresentation objectPropertyRepr = getObjectPropertyRepr(domainType, instanceId, propertyId);
        return objectPropertyRepr.getLinkWithRel(Rel.MODIFY);
    }
View Full Code Here

Examples of org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectPropertyRepresentation

        final int i = 999999;
        final Response domainObjectResp = domainObjectResource.propertyDetails("PRMV", "43", "intProperty");
        final RestfulResponse<ObjectPropertyRepresentation> domainObjectJsonResp = RestfulResponse.ofT(domainObjectResp);
        assertThat(domainObjectJsonResp.getStatus().getFamily(), is(Response.Status.Family.SUCCESSFUL));

        ObjectPropertyRepresentation objectPropertyRepr = domainObjectJsonResp.getEntity();

        // when
        modifyLink = objectPropertyRepr.getLinkWithRel(Rel.MODIFY);
        argRepr = modifyLink.getArguments().mapPut("value", i);
        RestfulResponse<JsonRepresentation> result = client.follow(modifyLink, argRepr);

        // then
        assertThat(result.getStatus(), is(RestfulResponse.HttpStatusCode.OK));
View Full Code Here

Examples of org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectPropertyRepresentation

    private ObjectPropertyRepresentation getObjectPropertyRepr(final String domainType, final String instanceId, String propertyId) throws JsonParseException, JsonMappingException, IOException {
        final Response domainObjectResp = domainObjectResource.propertyDetails(domainType, instanceId, propertyId);
        final RestfulResponse<ObjectPropertyRepresentation> domainObjectJsonResp = RestfulResponse.ofT(domainObjectResp);
        assertThat(domainObjectJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));

        final ObjectPropertyRepresentation repr = domainObjectJsonResp.getEntity();
        return repr;
    }
View Full Code Here

Examples of org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectPropertyRepresentation

        final ObjectPropertyRepresentation repr = domainObjectJsonResp.getEntity();
        return repr;
    }

    private LinkRepresentation getObjectPropertyReprModifyLink(String domainType, String instanceId, String propertyId) throws JsonParseException, JsonMappingException, IOException {
        ObjectPropertyRepresentation objectPropertyRepr = getObjectPropertyRepr(domainType, instanceId, propertyId);
        return objectPropertyRepr.getLinkWithRel(Rel.MODIFY);
    }
View Full Code Here

Examples of org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectPropertyRepresentation

    public void representation() throws Exception {

        // given
        final Response idPropertyResp = domainObjectResource.propertyDetails("org.apache.isis.core.tck.dom.defaults.WithDefaultsEntity","68", "anInt");
        final RestfulResponse<ObjectPropertyRepresentation> idPropertyJsonResp = RestfulResponse.ofT(idPropertyResp);
        final ObjectPropertyRepresentation propertyRepr = idPropertyJsonResp.getEntity();
        final LinkRepresentation selfLink = propertyRepr.getLinkWithRel(Rel.SELF);
        final LinkRepresentation postLink = selfLink.withMethod(RestfulHttpMethod.POST);

        // when
        final RestfulResponse<JsonRepresentation> restfulResponse = client.follow(postLink);
View Full Code Here

Examples of org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectPropertyRepresentation

    private ObjectPropertyRepresentation getObjectPropertyRepr(final String domainType, final String instanceId, String propertyId) throws JsonParseException, JsonMappingException, IOException {
        final Response domainObjectResp = domainObjectResource.propertyDetails(domainType, instanceId, propertyId);
        final RestfulResponse<ObjectPropertyRepresentation> domainObjectJsonResp = RestfulResponse.ofT(domainObjectResp);
        assertThat(domainObjectJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));

        final ObjectPropertyRepresentation repr = domainObjectJsonResp.getEntity();
        return repr;
    }
View Full Code Here

Examples of org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectPropertyRepresentation

        final ObjectPropertyRepresentation repr = domainObjectJsonResp.getEntity();
        return repr;
    }

    private LinkRepresentation getObjectPropertyReprModifyLink(String domainType, String instanceId, String propertyId) throws JsonParseException, JsonMappingException, IOException {
        ObjectPropertyRepresentation objectPropertyRepr = getObjectPropertyRepr(domainType, instanceId, propertyId);
        return objectPropertyRepr.getLinkWithRel(Rel.MODIFY);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.