예제 #1
0
  private Response invokeActionUsingAdapters(
      final ObjectAction action,
      final JsonRepresentation arguments,
      final ActionResultReprRenderer.SelfLink selfLink) {

    final RepresentationService.Context rendererContext = representationServiceContext;
    final ObjectAdapter objectAdapter = this.objectAdapter;

    final ObjectActionArgHelper argHelper =
        new ObjectActionArgHelper(rendererContext, objectAdapter, action);

    final List<ObjectAdapter> argAdapters = argHelper.parseAndValidateArguments(arguments);

    // invoke
    final ObjectAdapter mixedInAdapter = null; // action will automatically fill in if a mixin
    final ObjectAdapter[] argAdapterArr =
        argAdapters.toArray(new ObjectAdapter[argAdapters.size()]);
    final ObjectAdapter returnedAdapter =
        action.execute(objectAdapter, mixedInAdapter, argAdapterArr, InteractionInitiatedBy.USER);

    final ObjectAndActionInvocation objectAndActionInvocation =
        new ObjectAndActionInvocation(objectAdapter, action, arguments, returnedAdapter, selfLink);

    // response
    transactionService.flushTransaction();
    return representationService.actionResult(
        representationServiceContext, objectAndActionInvocation, selfLink);
  }
예제 #2
0
  /**
   * 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));
  }
예제 #3
0
  /**
   * 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);
  }
예제 #4
0
  /**
   * 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);
  }
예제 #5
0
 /**
  * Simply delegates to the {@link
  * org.apache.isis.viewer.restfulobjects.rendering.service.RepresentationService} to render a
  * representation of the object.
  *
  * @deprecated - use {@link #objectRepresentation()}
  */
 @Deprecated
 public Response objectRepresentation(final RepresentationService.Intent intent) {
   transactionService.flushTransaction();
   return representationService.objectRepresentation(
       representationServiceContext, objectAdapter, intent);
 }
예제 #6
0
 /**
  * Simply delegates to the {@link
  * org.apache.isis.viewer.restfulobjects.rendering.service.RepresentationService} to render a
  * representation of the object.
  */
 public Response objectRepresentation() {
   transactionService.flushTransaction();
   return representationService.objectRepresentation(representationServiceContext, objectAdapter);
 }