Examples of ObjectAdapter

  • net.sf.myway.ui.ObjectAdapter
    @author Andreas Beckers @version $Revision$
  • org.apache.isis.core.metamodel.adapter.ObjectAdapter
    Adapters to domain objects, where the application is written in terms of domain objects and those objects are represented within the NOF through these adapter, and not directly.
  • org.apache.isis.metamodel.adapter.ObjectAdapter
  • org.apache.isis.noa.adapter.ObjectAdapter
  • org.apache.isis.object.ObjectAdapter

  • Examples of org.apache.isis.core.metamodel.adapter.ObjectAdapter

        @Consumes({ MediaType.WILDCARD })
        @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ERROR })
        public Response addToList(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("collectionId") final String collectionId, final InputStream body) {
            init(Where.PARENTED_TABLES);

            final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, instanceId);
            final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);

            final OneToManyAssociation collection = helper.getCollectionThatIsVisibleForIntent(collectionId, Intent.MUTATE, getResourceContext().getWhere());

            if (!collection.getCollectionSemantics().isListOrArray()) {
                throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.METHOD_NOT_ALLOWED, "Collection '%s' does not have list or array semantics", collectionId);
            }

            final ObjectSpecification collectionSpec = collection.getSpecification();
            final String bodyAsString = DomainResourceHelper.asStringUtf8(body);
            final ObjectAdapter argAdapter = helper.parseAsMapWithSingleValue(collectionSpec, bodyAsString);

            final Consent consent = collection.isValidToAdd(objectAdapter, argAdapter);
            if (consent.isVetoed()) {
                throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.UNAUTHORIZED, consent.getReason());
            }
    View Full Code Here

    Examples of org.apache.isis.core.metamodel.adapter.ObjectAdapter

        @Path("/{domainType}/{instanceId}/collections/{collectionId}")
        @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ERROR })
        public Response removeFromCollection(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("collectionId") final String collectionId) {
            init(Where.PARENTED_TABLES);

            final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, instanceId);
            final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);

            final OneToManyAssociation collection = helper.getCollectionThatIsVisibleForIntent(collectionId, Intent.MUTATE, getResourceContext().getWhere());

            final ObjectSpecification collectionSpec = collection.getSpecification();
            final ObjectAdapter argAdapter = helper.parseAsMapWithSingleValue(collectionSpec, getResourceContext().getQueryString());

            final Consent consent = collection.isValidToRemove(objectAdapter, argAdapter);
            if (consent.isVetoed()) {
                throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.UNAUTHORIZED, consent.getReason());
            }
    View Full Code Here

    Examples of org.apache.isis.core.metamodel.adapter.ObjectAdapter

        @Path("/{domainType}/{instanceId}/actions/{actionId}")
        @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_OBJECT_ACTION, RestfulMediaType.APPLICATION_JSON_ERROR })
        public Response actionPrompt(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("actionId") final String actionId) {
            init(RepresentationType.OBJECT_ACTION, Where.OBJECT_FORMS);

            final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, instanceId);
            final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);

            return helper.actionPrompt(actionId, getResourceContext().getWhere());
        }
    View Full Code Here

    Examples of org.apache.isis.core.metamodel.adapter.ObjectAdapter

        public Response invokeActionQueryOnly(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("actionId") final String actionId, @QueryParam("x-isis-querystring") final String xIsisQueryString) {
            init(RepresentationType.ACTION_RESULT, Where.STANDALONE_TABLES, xIsisQueryString);

            final JsonRepresentation arguments = getResourceContext().getQueryStringAsJsonRepr();

            final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, instanceId);
            final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);

            return helper.invokeActionQueryOnly(actionId, arguments, getResourceContext().getWhere());
        }
    View Full Code Here

    Examples of org.apache.isis.core.metamodel.adapter.ObjectAdapter

        public Response invokeActionIdempotent(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("actionId") final String actionId, final InputStream body) {
            init(RepresentationType.ACTION_RESULT, Where.STANDALONE_TABLES, body);

            final JsonRepresentation arguments = getResourceContext().getQueryStringAsJsonRepr();
           
            final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, instanceId);
            final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);

            return helper.invokeActionIdempotent(actionId, arguments, getResourceContext().getWhere());
        }
    View Full Code Here

    Examples of org.apache.isis.core.metamodel.adapter.ObjectAdapter

        public Response invokeAction(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("actionId") final String actionId, final InputStream body) {
            init(RepresentationType.ACTION_RESULT, Where.STANDALONE_TABLES, body);

            final JsonRepresentation arguments = getResourceContext().getQueryStringAsJsonRepr();
           
            final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, instanceId);
            final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);

            return helper.invokeAction(actionId, arguments, getResourceContext().getWhere());
        }
    View Full Code Here

    Examples of org.apache.isis.core.metamodel.adapter.ObjectAdapter

                        allOk = false;
                        continue;
                    }
                   
                    // ok, we have a value, and the property is not invisible, and is not disabled
                    final ObjectAdapter valueAdapter;
                    try {
                        valueAdapter = objectAdapterFor(resourceContext, propertySpec, propertyRepr);
                    } catch(IllegalArgumentException ex) {
                        propertyRepr.mapPut("invalidReason", ex.getMessage());
                        allOk = false;
    View Full Code Here

    Examples of org.apache.isis.core.metamodel.adapter.ObjectAdapter

            final List<ObjectAdapter> argAdapters = parseAndValidateArguments(action, arguments);

            // invoke
            final ObjectAdapter[] argArray2 = argAdapters.toArray(new ObjectAdapter[0]);
            final ObjectAdapter returnedAdapter = action.execute(objectAdapter, argArray2);

            // response (void)
            final ActionResultReprRenderer renderer = new ActionResultReprRenderer(resourceContext, null, selfLink, JsonRepresentation.newMap());

            renderer.with(new ObjectAndActionInvocation(objectAdapter, action, arguments, returnedAdapter)).using(adapterLinkTo);
    View Full Code Here

    Examples of org.apache.isis.core.metamodel.adapter.ObjectAdapter

                final String reason = "Could not parse 'href' to identify the object's OID";
                argRepr.mapPut("invalidReason", reason);
                throw new IllegalArgumentException(reason);
            }

            final ObjectAdapter objectAdapter = OidUtils.getObjectAdapterElseNull(resourceContext, oidFromHref);
            if (objectAdapter == null) {
                final String reason = "'href' does not reference a known entity";
                argRepr.mapPut("invalidReason", reason);
                throw new IllegalArgumentException(reason);
            }
    View Full Code Here

    Examples of org.apache.isis.core.metamodel.adapter.ObjectAdapter

            boolean valid = true;
            for (int i = 0; i < argList.size(); i++) {
                final JsonRepresentation argRepr = argList.get(i);
                final ObjectSpecification paramSpec = parameters.get(i).getSpecification();
                try {
                    final ObjectAdapter argAdapter = objectAdapterFor(resourceContext, paramSpec, argRepr);
                    argAdapters.add(argAdapter);

                    // validate individual arg
                    final ObjectActionParameter parameter = parameters.get(i);
                    final Object argPojo = argAdapter!=null?argAdapter.getObject():null;
                    final String reasonNotValid = parameter.isValid(objectAdapter, argPojo, null);
                    if (reasonNotValid != null) {
                        argRepr.mapPut("invalidReason", reasonNotValid);
                        valid = false;
                    }
    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.