/** * @deprecated - see {@link #isSafeInNature()} (avoid any ambiguity) */ @Deprecated public boolean isSafe() { return isSafeInNature(); }
@Override protected void putExtensionsIsisProprietary() { getExtensions().mapPut("actionType", objectMember.getType().name().toLowerCase()); final ActionSemantics.Of semantics = objectMember.getSemantics(); getExtensions().mapPut("actionSemantics", semantics.getCamelCaseName()); }
/** * 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. * </p> */ 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); }
/** * 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 ActionSemantics.Of#isSafeInNature()} safe/request-cacheable} semantics * otherwise an error response is thrown. * </p> */ public Response invokeActionQueryOnly(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.isSafeInNature()) { throw RestfulObjectsApplicationException.createWithMessage(RestfulResponse.HttpStatusCode.METHOD_NOT_ALLOWED, "Method not allowed; action '%s' does not have safe semantics", action.getId()); } return invokeActionUsingAdapters(action, arguments, ActionResultReprRenderer.SelfLink.INCLUDED); }
Response invokeActionIdempotent(final String actionId, final InputStream body, Where where) { final ObjectAction action = getObjectActionThatIsVisibleAndUsable(actionId, Intent.MUTATE, where); final ActionSemantics.Of actionSemantics = action.getSemantics(); if (!actionSemantics.isIdempotentInNature()) { throw RestfulObjectsApplicationException.create(HttpStatusCode.METHOD_NOT_ALLOWED, "Method not allowed; action '%s' is not idempotent", action.getId()); } final String bodyAsString = asStringUtf8(body); final JsonRepresentation arguments = readAsMap(bodyAsString); return invokeActionUsingAdapters(action, arguments); }
/** * Bookmarkable if the {@link ObjectAction action} has a {@link BookmarkPolicyFacet bookmark} policy * of {@link BookmarkPolicy#AS_ROOT root}, and has safe {@link ObjectAction#getSemantics() semantics}. */ public boolean isBookmarkable() { final ObjectAction action = getActionMemento().getAction(getSpecificationLoader()); final BookmarkPolicyFacet bookmarkPolicy = action.getFacet(BookmarkPolicyFacet.class); final boolean safeSemantics = action.getSemantics().isSafeInNature(); return bookmarkPolicy.value() == BookmarkPolicy.AS_ROOT && safeSemantics; }
@Override protected void putExtensionsIsisProprietary() { getExtensions().mapPut("actionType", objectMember.getType().name().toLowerCase()); final ActionSemantics.Of semantics = objectMember.getSemantics(); getExtensions().mapPut("actionSemantics", semantics.getCamelCaseName()); }
@Override protected void putExtensionsIsisProprietary() { getExtensions().mapPut("actionType", objectMember.getType().name().toLowerCase()); final ActionSemantics.Of semantics = objectMember.getSemantics(); getExtensions().mapPut("actionSemantics", semantics.getCamelCaseName()); }
/** * Bookmarkable if the {@link ObjectAction action} has a {@link BookmarkPolicyFacet bookmark} policy * of {@link BookmarkPolicy#AS_ROOT root}, and has safe {@link ObjectAction#getSemantics() semantics}. */ public boolean isBookmarkable() { final ObjectAction action = getAction(); final BookmarkPolicyFacet bookmarkPolicy = action.getFacet(BookmarkPolicyFacet.class); final boolean safeSemantics = action.getSemantics().isSafeInNature(); return bookmarkPolicy.value() == BookmarkPolicy.AS_ROOT && safeSemantics; }
Response invokeActionIdempotent(final String actionId, final JsonRepresentation arguments, Where where) { final ObjectAction action = getObjectActionThatIsVisibleForIntent(actionId, Intent.MUTATE, where); final ActionSemantics.Of actionSemantics = action.getSemantics(); if (!actionSemantics.isIdempotentInNature()) { throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.METHOD_NOT_ALLOWED, "Method not allowed; action '%s' is not idempotent", action.getId()); } return invokeActionUsingAdapters(action, arguments, SelfLink.EXCLUDED); }