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

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


    }

    private void testForProcessorForTag(final Lexer lexer, final String tagName) {
        final ElementProcessor elementProcessor = processors.getFor(tagName);
        if (elementProcessor == null) {
            throw new ScimpiException("No processor for tag " + tagName.toLowerCase());
        }
    }
View Full Code Here


        try {
            final List<ObjectAdapter> savedObject = Lists.newArrayList();
            final JSONObject data = encodeTransientData(adapter, savedObject);
            return RequestContext.TRANSIENT_OBJECT_OID_MARKER + data.toString(4);
        } catch (final JSONException e) {
            throw new ScimpiException(e);
        }
    }
View Full Code Here

        if(oid instanceof RootOid) {
            return data;
        }

        if (!(oid instanceof AggregatedOid)) {
            throw new ScimpiException("Unsupported OID type " + oid);
        }
        return data;
    }
View Full Code Here

            return requestTransients;
        }
        if (scope == Scope.INTERACTION || scope == Scope.SESSION) {
            return sessionTransients;
        }
        throw new ScimpiException("Can't hold globally transient object");
    }
View Full Code Here

        try {
            final JSONObject jsonObject = new JSONObject(objectData);
            return restoreTransientObject(jsonObject);
        } catch (final JSONException e) {
            throw new ScimpiException("Problem reading data: " + jsonObjectData, e);
        }
    }
View Full Code Here

        final ObjectAction action = MethodsUtils.findAction(object, parameterObject.methodName);
        // TODO how do we distinguish between overloaded methods?

        // REVIEW Is this useful?
        if (action.getParameterCount() == 0) {
            throw new ScimpiException("Action form can only be used for actions with parameters");
        }
        if (parameterObject.showMessage && MethodsUtils.isVisible(object, action, where)) {
            final String notUsable = MethodsUtils.isUsable(object, action, where);
            if (notUsable != null) {
                if (!withoutProcessing) {
View Full Code Here

        return runMethod(context, action, target, parameters, null, null);
    }

    public static ObjectAction findAction(final ObjectAdapter object, final String methodName) {
        if (object == null) {
            throw new ScimpiException("Object not specified when looking for " + methodName);
        }

        final List<ObjectAction> actions = object.getSpecification().getObjectActions(Contributed.INCLUDED);
        final ObjectAction action = findAction(actions, methodName);
        /*
 
View Full Code Here

                final ObjectAction loginAction = MethodsUtils.findAction(object, loginMethodName);
                final int parameterCount = loginAction.getParameterCount();
                final ObjectAdapter[] parameters = new ObjectAdapter[parameterCount];
                List<ObjectActionParameter> parameters2 = loginAction.getParameters();
                if (parameters.length != 2) {
                    throw new ScimpiException("Expected two parameters for the log-on method: " + loginMethodName);
                }

                Localization localization = IsisContext.getLocalization();
                ParseableFacet facet = parameters2.get(0).getSpecification().getFacet(ParseableFacet.class);
                parameters[0] = facet.parseTextEntry(null, username, localization);
                facet = parameters2.get(1).getSpecification().getFacet(ParseableFacet.class);
                parameters[1] = facet.parseTextEntry(null, password, localization);
                final ObjectAdapter result = loginAction.execute(object, parameters);
                isValid = result != null;
                if (isValid) {
                    ObjectSpecification specification = result.getSpecification();
                    ObjectAssociation association = specification.getAssociation(roleFieldName);
                    if (association == null) {
                        throw new ScimpiException("Expected a role name field called: " + roleFieldName);
                    }
                    ObjectAdapter role = association.get(result);
                    List<String> roles = new ArrayList<String>();
                    if (role != null) {
                        String[] split = role.titleString().split("\\|");
View Full Code Here

        if (field != null) {
            final String id = request.getOptionalProperty(OBJECT);
            final ObjectAdapter object = context.getMappedObjectOrResult(id);
            final ObjectAssociation objectField = object.getSpecification().getAssociation(field);
            if (!objectField.isOneToManyAssociation()) {
                throw new ScimpiException("Field " + objectField.getId() + " is not a collection");
            }
            IsisContext.getPersistenceSession().resolveField(object, objectField);
            collection = objectField.get(object);
        } else {
            final String id = request.getOptionalProperty(COLLECTION);
View Full Code Here

        final String id = request.getOptionalProperty(OBJECT);
        final String fieldName = request.getRequiredProperty(FIELD);
        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
        final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
        if (field == null) {
            throw new ScimpiException("No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
        }
        if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
            throw new ForbiddenException(field, ForbiddenException.VISIBLE);
        }
        final boolean isIconShowing = request.isRequested(SHOW_ICON, showIconByDefault());
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.