Package org.apache.isis.core.commons.exceptions

Examples of org.apache.isis.core.commons.exceptions.IsisException


    @Override
    public void removeView(final View view) {
        if (allowSubviewsToBeAdded) {
            subviews.remove(view);
        } else {
            throw new IsisException("Can't remove view. Do you need to set the allowSubviewsToBeAdded flag?");
        }
    }
View Full Code Here


        if (referencedAdapter == null) {
            throw new IllegalArgumentException("Can't use null to add an item to a collection");
        }
        if (readWrite()) {
            if (ownerAdapter.representsPersistent() && referencedAdapter.isTransient()) {
                throw new IsisException("can't set a reference to a transient object from a persistent one: " + ownerAdapter.titleString() + " (persistent) -> " + referencedAdapter.titleString() + " (transient)");
            }
            final CollectionAddToFacet facet = getFacet(CollectionAddToFacet.class);
            facet.add(ownerAdapter, referencedAdapter);
        }
    }
View Full Code Here

    }

    private View createFieldView(final View view, final ParameterContent parameter, final int sequence) {
        final View fieldView = subviewDesign.createView(parameter, null, sequence);
        if (fieldView == null) {
            throw new IsisException("All parameters must be shown");
        }
        return fieldView;
    }
View Full Code Here

            setRoles(authContext, request, username);
            return true;
        } catch (final AuthenticationException e) {
            return false;
        } catch (final NamingException e) {
            throw new IsisException("Failed to authenticate using LDAP", e);
        } finally {
            try {
                if (authContext != null) {
                    authContext.close();
                }
            } catch (final NamingException e) {
                throw new IsisException("Failed to authenticate using LDAP", e);
            }
        }
    }
View Full Code Here

    private String unknownImageFile;

    public void setImageDirectory(final String imageDirectory) {
        this.imageDirectory = new File(imageDirectory);
        if (!this.imageDirectory.exists()) {
            throw new IsisException("No image directory found: " + imageDirectory);
        }
        unknownImageFile = imageFile(UNKNOWN_IMAGE);
    }
View Full Code Here

    private File imageDirectory;

    public void setImageDirectory(final String imageDirectory) {
        this.imageDirectory = new File(imageDirectory);
        if (!this.imageDirectory.exists()) {
            throw new IsisException("No image directory found: " + imageDirectory);
        }
    }
View Full Code Here

    }

    @Override
    public void unindent() {
        if (indent == 0) {
            throw new IsisException();
        }
        indent--;
    }
View Full Code Here

        final Oid oid = adapter.getOid();

        if(!pojo.jdoIsPersistent()) {
            // make sure the adapter is transient
            if (!adapter.getResolveState().isTransient()) {
                throw new IsisException(MessageFormat.format("adapter oid={0} has resolve state in invalid state; should be transient but is {1}; pojo: {2}", oid, adapter.getResolveState(), pojo));
            }

            // make sure the oid is transient
            if (!oid.isTransient()) {
                throw new IsisException(MessageFormat.format("adapter oid={0} has oid in invalid state; should be transient; pojo: {1}", oid, pojo));
            }

        } else if(pojo.jdoIsDeleted()) {
           
            // make sure the adapter is destroyed
            if (!adapter.getResolveState().isDestroyed()) {
                throw new IsisException(MessageFormat.format("adapter oid={0} has resolve state in invalid state; should be destroyed but is {1}; pojo: {2}", oid, adapter.getResolveState(), pojo));
            }
           
        } else {
           
           
           
            // make sure the adapter is persistent
            if (!adapter.getResolveState().representsPersistent()) {
                throw new IsisException(MessageFormat.format("adapter oid={0} has resolve state in invalid state; should be in a persistent but is {1}; pojo: {2}", oid, adapter.getResolveState(), pojo));
            }

            // make sure the oid is persistent
            if (oid.isTransient()) {
                throw new IsisException(MessageFormat.format("adapter oid={0} has oid in invalid state; should be persistent; pojo: {1}", oid, pojo));
            }
        }
    }
View Full Code Here

    // make sure the entity is known to Isis and is a root
    // TODO: will probably need to handle aggregated entities at some point...
    void ensureRootObject(final PersistenceCapable pojo) {
        final Oid oid = getAdapterManager().adapterFor(pojo).getOid();
        if (!(oid instanceof RootOid)) {
            throw new IsisException(MessageFormat.format("Not a RootOid: oid={0}, for {1}", oid, pojo));
        }
    }
View Full Code Here

    @SuppressWarnings("unused")
    private void ensureObjectNotLoaded(final PersistenceCapable pojo) {
        final ObjectAdapter adapter = getAdapterManager().getAdapterFor(pojo);
        if(adapter != null) {
            final Oid oid = adapter.getOid();
            throw new IsisException(MessageFormat.format("Object is already mapped in Isis: oid={0}, for {1}", oid, pojo));
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.core.commons.exceptions.IsisException

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.