Package org.apache.isis.viewer.scimpi.dispatcher

Examples of org.apache.isis.viewer.scimpi.dispatcher.ScimpiException


    public static void write(final Request request, final ObjectAdapter adapter, final String fieldName,
        final ObjectAdapter element, final String resultOverride, final String view, final String error,
        final String title, final String cssClass) {
        final ObjectAssociation field = adapter.getSpecification().getAssociation(fieldName);
        if (field == null) {
            throw new ScimpiException("No field " + fieldName + " in " + adapter.getSpecification().getFullIdentifier());
        }
        if (!field.isOneToManyAssociation()) {
            throw new ScimpiException("Field " + fieldName + " not a collection, in "
                + adapter.getSpecification().getFullIdentifier());
        }
        if (field.isVisible(IsisContext.getAuthenticationSession(), adapter).isVetoed()) {
            throw new ForbiddenException(field, ForbiddenException.VISIBLE);
        }
View Full Code Here


        ObjectSpecification elementSpec;
        if (field != null) {
            final String objectId = request.getOptionalProperty(OBJECT);
            final ObjectAdapter object = context.getMappedObjectOrResult(objectId);
            if (object == null) {
                throw new ScimpiException("No object for result or " + objectId);
            }
            final ObjectAssociation objectField = object.getSpecification().getAssociation(field);
            if (!objectField.isOneToManyAssociation()) {
                throw new ScimpiException("Field " + objectField.getId() + " is not a collection");
            }
            isFieldEditable = objectField.isUsable(IsisContext.getAuthenticationSession(), object).isAllowed();
            getPersistenceSession().resolveField(object, objectField);
            collection = objectField.get(object);
            final TypeOfFacet facet = objectField.getFacet(TypeOfFacet.class);
View Full Code Here

        // REVIEW this is common used code
        final String fieldName = request.getOptionalProperty(FIELD);
        if (fieldName != null) {
            final ObjectAssociation field = adapter.getSpecification().getAssociation(fieldName);
            if (field == null) {
                throw new ScimpiException("No field " + fieldName + " in "
                    + adapter.getSpecification().getFullIdentifier());
            }
            if (field.isVisible(IsisContext.getAuthenticationSession(), adapter).isVetoed()) {
                throw new ForbiddenException(field, ForbiddenException.VISIBLE);
            }
View Full Code Here

        if (id.equals("collection")) {
            return collection;
        }
        final ObjectAdapter object = mappedObject(id);
        if (object == null) {
            throw new ScimpiException("No object for " + id);
        } else {
            return object;
        }
    }
View Full Code Here

    public ObjectAdapter getMappedObjectOrVariable(String id, final String name) {
        if (id == null) {
            id = (String) getVariable(name);
            if (id == null) {
                throw new ScimpiException("No variable for " + name);
            }
        }
        if (id.equals("collection")) {
            return collection;
        }
View Full Code Here

    }

    public void addVariable(String name, final Object value, final Scope scope) {
        name = name != null ? name : RESULT;
        if (scope == Scope.SESSION && !(value instanceof Serializable)) {
            throw new ScimpiException("SESSION scoped variable (" + name + ") must be serializable: " + value);
        }
        removeExistingVariable(name);
        variables.get(scope).put(name, value);
    }
View Full Code Here

    // /////////////////////////////
    // Parameters
    // /////////////////////////////
    public void addParameter(final String name, final String parameter) {
        if (name == null) {
            throw new ScimpiException("Name must be specified for parameter " + parameter);
        }
        addVariable(name, parameter, Scope.REQUEST);
    }
View Full Code Here

            LOG.debug("requested file set = " + filePath);

        } else {
            final int lastSlash = filePath.lastIndexOf('/');
            if (lastSlash == -1) {
                throw new ScimpiException("No slash in request path: " + filePath);
            }
            final String path = filePath.substring(0, lastSlash + 1);
            LOG.debug("requested path set = " + path);
            this.requestedParentPath = path;
View Full Code Here

        return resourceParentPath;
    }

    public void setResourcePath(final String filePath) {
        if (filePath == null) {
            throw new ScimpiException("Path must be specified");
        } else {
            final int lastSlash = filePath.lastIndexOf('/');
            if (lastSlash == -1) {
                throw new ScimpiException("No slash in request path: " + filePath);
            }
            final String path = /* getContextPath() + */filePath.substring(0, lastSlash + 1);
            LOG.debug("resource path set = " + path);
            this.resourceParentPath = path;

View Full Code Here

        }
    }

    private void disallowSourceAndDefault(final Request request) {
        if (request.getOptionalProperty(DEFAULT) != null && request.getOptionalProperty(OBJECT) != null) {
            throw new ScimpiException("Cannot specify both " + OBJECT + " and " + DEFAULT + " for the " + getName()
                + " element");
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.viewer.scimpi.dispatcher.ScimpiException

Copyright © 2018 www.massapicom. 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.