Package org.apache.isis.core.metamodel.spec

Examples of org.apache.isis.core.metamodel.spec.DomainModelException


        final CollectionFacet collectionFacet = collectionAdapter.getSpecification().getFacet(CollectionFacet.class);
       
        final StringBuilder buf = new StringBuilder();
        for (final ObjectAdapter elementAdapter : collectionFacet.iterable(collectionAdapter)) {
            if (elementAdapter.isParented()) {
                throw new DomainModelException("Can't store an aggregated object within a collection that is not expected aggregates: " + elementAdapter + " (" + collectionAdapter + ")");
            }
            buf.append(keyCreator.oidStrFor(elementAdapter)).append("|");
        }
        if (buf.length() > 0) {
            writer.writeField(association.getId(), buf.toString());
View Full Code Here


            writer.writeCollection(association.getId(), elements);
        } else {
            String refs = "";
            for (final ObjectAdapter element : collectionFacet.iterable(collection)) {
                if (element.isAggregated()) {
                    throw new DomainModelException("Can't store an aggregated object within a collection that is not exoected aggregates: " + element + " (" + collection + ")");
                }
                refs += keyCreator.reference(element) + "|";
            }
            if (refs.length() > 0) {
                writer.writeField(association.getId(), refs);
View Full Code Here

    @Override
    public Object[][] getChoices(final ObjectAdapter owningAdapter) {
        final Object invoke = AdapterInvokeUtils.invoke(method, owningAdapter);
        if (!(invoke instanceof Object[])) {
            throw new DomainModelException("Expected an array of collections (Object[]) containing choices for all parameters, but got " + invoke + " instead. Perhaps the parameter number is missing!");
        }
        final Object[] options = (Object[]) invoke;
        final Object[][] results = new Object[options.length][];
        for (int i = 0; i < results.length; i++) {
            if (options[i] == null) {
View Full Code Here

        final ActionDefaultsFacet facet = getFacet(ActionDefaultsFacet.class);
        if (!facet.isNoop()) {
            // use the old defaultXxx approach
            parameterDefaultPojos = facet.getDefaults(realTarget);
            if (parameterDefaultPojos.length != parameterCount) {
                throw new DomainModelException("Defaults array of incompatible size; expected " + parameterCount + " elements, but was " + parameterDefaultPojos.length + " for " + facet);
            }
            for (int i = 0; i < parameterCount; i++) {
                if (parameterDefaultPojos[i] != null) {
                    final ObjectSpecification componentSpec = getSpecificationLookup().loadSpecification(parameterDefaultPojos[i].getClass());
                    final ObjectSpecification parameterSpec = parameters.get(i).getSpecification();
                    if (!componentSpec.isOfType(parameterSpec)) {
                        throw new DomainModelException("Defaults type incompatible with parameter " + (i + 1) + " type; expected " + parameterSpec.getFullIdentifier() + ", but was " + componentSpec.getFullIdentifier());
                    }
                }
            }
        } else {
            // use the new defaultNXxx approach for each param in turn
View Full Code Here

            // if no options, or not the right number of pojos, then default
            if (parameterChoicesPojos == null) {
                parameterChoicesPojos = new Object[parameterCount][];
            } else if (parameterChoicesPojos.length != parameterCount) {
                throw new DomainModelException("Choices array of incompatible size; expected " + parameterCount + " elements, but was " + parameterChoicesPojos.length + " for " + facet);
            }
        } else {
            // use the new choicesNXxx approach for each param in turn
            // (the reflector will have made sure both aren't installed).
View Full Code Here

    protected static void checkChoicesType(final SpecificationLookup specificationLookup, final Object[] objects, final ObjectSpecification paramSpec) {
        for (final Object object : objects) {
            final ObjectSpecification componentSpec = specificationLookup.loadSpecification(object.getClass());
            if (!componentSpec.isOfType(paramSpec)) {
                throw new DomainModelException("Choice type incompatible with parameter type; expected " + paramSpec.getFullIdentifier() + ", but was " + componentSpec.getFullIdentifier());
            }
        }
    }
View Full Code Here

    @Override
    public Object[][] getChoices(final ObjectAdapter owningAdapter) {
        final Object invoke = AdapterInvokeUtils.invoke(method, owningAdapter);
        if (!(invoke instanceof Object[])) {
            throw new DomainModelException(
                "Expected an array of collections (Object[]) containing choices for all parameters, but got " + invoke
                    + " instead. Perhaps the parameter number is missing!");
        }
        final Object[] options = (Object[]) invoke;
        final Object[][] results = new Object[options.length][];
View Full Code Here

            writer.writeCollection(association.getId(), elements);
        } else {
            String refs = "";
            for (final ObjectAdapter element : collectionFacet.iterable(collection)) {
                if (element.isAggregated()) {
                    throw new DomainModelException(
                        "Can't store an aggregated object within a collection that is not exoected aggregates: "
                            + element + " (" + collection + ")");
                }
                refs += keyCreator.reference(element) + "|";
            }
View Full Code Here

    @Override
    public Object[][] getChoices(final ObjectAdapter owningAdapter) {
        final Object invoke = AdapterInvokeUtils.invoke(method, owningAdapter);
        if (!(invoke instanceof Object[])) {
            throw new DomainModelException("Expected an array of collections (Object[]) containing choices for all parameters, but got " + invoke + " instead. Perhaps the parameter number is missing!");
        }
        final Object[] options = (Object[]) invoke;
        final Object[][] results = new Object[options.length][];
        for (int i = 0; i < results.length; i++) {
            if (options[i] == null) {
View Full Code Here

        final ActionDefaultsFacet facet = getFacet(ActionDefaultsFacet.class);
        if (!facet.isNoop()) {
            // use the old defaultXxx approach
            parameterDefaultPojos = facet.getDefaults(target);
            if (parameterDefaultPojos.length != parameterCount) {
                throw new DomainModelException("Defaults array of incompatible size; expected " + parameterCount + " elements, but was " + parameterDefaultPojos.length + " for " + facet);
            }
            for (int i = 0; i < parameterCount; i++) {
                if (parameterDefaultPojos[i] != null) {
                    final ObjectSpecification componentSpec = getSpecificationLookup().loadSpecification(parameterDefaultPojos[i].getClass());
                    final ObjectSpecification parameterSpec = parameters.get(i).getSpecification();
                    if (!componentSpec.isOfType(parameterSpec)) {
                        throw new DomainModelException("Defaults type incompatible with parameter " + (i + 1) + " type; expected " + parameterSpec.getFullIdentifier() + ", but was " + componentSpec.getFullIdentifier());
                    }
                }
            }
        } else {
            // use the new defaultNXxx approach for each param in turn
View Full Code Here

TOP

Related Classes of org.apache.isis.core.metamodel.spec.DomainModelException

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.