/** * Invokes the action for the object (checking it is visible) and then delegates to the {@link * org.apache.isis.viewer.restfulobjects.rendering.service.RepresentationService} to render a * representation of the result of that action. */ public Response invokeAction(final String actionId, final JsonRepresentation arguments) { ObjectAdapterAccessHelper accessHelper = new ObjectAdapterAccessHelper(representationServiceContext, objectAdapter); final ObjectAction action = accessHelper.getObjectActionThatIsVisibleForIntent( actionId, ObjectAdapterAccessHelper.Intent.MUTATE); return invokeActionUsingAdapters(action, arguments, ActionResultReprRenderer.SelfLink.EXCLUDED); }
/** * Obtains the action details (arguments etc), checking it is visible, of the object and then * delegates to the {@link * org.apache.isis.viewer.restfulobjects.rendering.service.RepresentationService} to render a * representation of that object's action (arguments). */ public Response actionPrompt(final String actionId) { ObjectAdapterAccessHelper accessHelper = new ObjectAdapterAccessHelper(representationServiceContext, objectAdapter); final ObjectAction action = accessHelper.getObjectActionThatIsVisibleForIntent( actionId, ObjectAdapterAccessHelper.Intent.ACCESS); transactionService.flushTransaction(); return representationService.actionPrompt( representationServiceContext, new ObjectAndAction(objectAdapter, action)); }
/** * Obtains the collection (checking it is visible) of the object and then delegates to the {@link * org.apache.isis.viewer.restfulobjects.rendering.service.RepresentationService} to render a * representation of that collection. */ public Response collectionDetails(final String collectionId, final MemberReprMode memberMode) { ObjectAdapterAccessHelper accessHelper = new ObjectAdapterAccessHelper(representationServiceContext, objectAdapter); final OneToManyAssociation collection = accessHelper.getCollectionThatIsVisibleForIntent( collectionId, ObjectAdapterAccessHelper.Intent.ACCESS); transactionService.flushTransaction(); return representationService.collectionDetails( representationServiceContext, new ObjectAndCollection2(objectAdapter, collection, memberMode), memberMode); }
/** * Obtains the property (checking it is visible) of the object and then delegates to the {@link * org.apache.isis.viewer.restfulobjects.rendering.service.RepresentationService} to render a * representation of that property. */ public Response propertyDetails(final String propertyId, final MemberReprMode memberMode) { ObjectAdapterAccessHelper accessHelper = new ObjectAdapterAccessHelper(representationServiceContext, objectAdapter); final OneToOneAssociation property = accessHelper.getPropertyThatIsVisibleForIntent( propertyId, ObjectAdapterAccessHelper.Intent.ACCESS); transactionService.flushTransaction(); return representationService.propertyDetails( representationServiceContext, new ObjectAndProperty2(objectAdapter, property, memberMode), memberMode); }
/** * Invokes the action for the object (checking it is visible) and then delegates to the {@link * org.apache.isis.viewer.restfulobjects.rendering.service.RepresentationService} to render a * representation of the result of that action. * * <p>The action must have {@link org.apache.isis.applib.annotation.ActionSemantics.Of#IDEMPOTENT * idempotent} semantics otherwise an error response is thrown. */ public Response invokeActionIdempotent( final String actionId, final JsonRepresentation arguments) { final ObjectAdapterAccessHelper accessHelper = new ObjectAdapterAccessHelper(representationServiceContext, objectAdapter); final ObjectAction action = accessHelper.getObjectActionThatIsVisibleForIntent( actionId, ObjectAdapterAccessHelper.Intent.MUTATE); final ActionSemantics.Of actionSemantics = action.getSemantics(); if (!actionSemantics.isIdempotentInNature()) { throw RestfulObjectsApplicationException.createWithMessage( RestfulResponse.HttpStatusCode.METHOD_NOT_ALLOWED, "Method not allowed; action '%s' is not idempotent", action.getId()); } return invokeActionUsingAdapters(action, arguments, ActionResultReprRenderer.SelfLink.EXCLUDED); }