Package org.apache.isis.applib

Examples of org.apache.isis.applib.PersistFailedException


    @Override
    public void persist(final Object domainObject) {
        final ObjectAdapter adapter = getAdapterManager().adapterFor(domainObject);

        if(adapter == null) {
            throw new PersistFailedException("Object not known to framework; instantiate using newTransientInstance(...) rather than simply new'ing up.");
        }
        if (adapter.isParented()) {
            // TODO check aggregation is supported
            return;
        }
        if (isPersistent(domainObject)) {
            throw new PersistFailedException("Object already persistent; OID=" + adapter.getOid());
        }
        getObjectPersistor().makePersistent(adapter);
    }
View Full Code Here


    @Override
    public void persist(final Object domainObject) {
        final ObjectAdapter adapter = getAdapterManager().adapterFor(unwrapped(domainObject));

        if(adapter == null) {
            throw new PersistFailedException("Object not known to framework; instantiate using newTransientInstance(...) rather than simply new'ing up.");
        }
        if (adapter.isParented()) {
            // TODO check aggregation is supported
            return;
        }
        if (isPersistent(domainObject)) {
            throw new PersistFailedException("Object already persistent; OID=" + adapter.getOid());
        }
        getObjectPersistor().makePersistent(adapter);
    }
View Full Code Here

                return ((Money) o).doubleValue();
            } else {
                return ((Money) o).getCurrency();
            }
        } else {
            throw new PersistFailedException("Invalid object type " + o.getClass().getCanonicalName() + " for MoneyValueMapper");
        }
    }
View Full Code Here

        if (correspondingClass == DateTime.class) {
            final java.sql.Timestamp o = (java.sql.Timestamp) results.getObject(columnName);
            final DateTime timeValue = new DateTime(o.getTime());
            restoredValue = IsisContext.getPersistenceSession().getAdapterManager().adapterFor(timeValue);
        } else {
            throw new PersistFailedException("Unhandled time type: " + correspondingClass.getCanonicalName());
        }
        return restoredValue;
    }
View Full Code Here

                return "Image";
            } else {
                return getOutputStreamFromImage((Image) o);
            }
        } else {
            throw new PersistFailedException("Invalid object type " + o.getClass().getCanonicalName()
                + " for JdbcImageValueMapper");
        }
    }
View Full Code Here

        if (correspondingClass == TimeStamp.class) {
            final java.sql.Timestamp o = (java.sql.Timestamp) results.getObject(columnName);
            final TimeStamp timeValue = new TimeStamp(o.getTime());
            restoredValue = IsisContext.getPersistenceSession().getAdapterManager().adapterFor(timeValue);
        } else {
            throw new PersistFailedException("Unhandled time type: " + correspondingClass.getCanonicalName());
        }
        return restoredValue;
    }
View Full Code Here

            // 2010-03-05 = 1267747200000
            Date dateValue;
            dateValue = new Date(javaDateValue);
            restoredValue = getAdapterManager().adapterFor(dateValue);
        } else {
            throw new PersistFailedException("Unhandled date type: " + correspondingClass.getCanonicalName());
        }
        return restoredValue;
    }
View Full Code Here

        final Class<?> correspondingClass = field.getSpecification().getCorrespondingClass();
        if (correspondingClass == Time.class) {
            final Time timeValue = results.getTime(columnName);
            restoredValue = IsisContext.getPersistenceSession().getAdapterManager().adapterFor(timeValue);
        } else {
            throw new PersistFailedException("Unhandled time type: " + correspondingClass.getCanonicalName());
        }
        return restoredValue;

    }
View Full Code Here

        // TODO check aggregation is supported
        if (adapter.isAggregated()) {
            return;
        }
        if (isPersistent(transientObject)) {
            throw new PersistFailedException("Object already persistent: " + adapter);
        }
        getObjectPersistor().makePersistent(adapter);
    }
View Full Code Here

            // 2010-03-05 = 1267747200000
            Date dateValue;
            dateValue = new Date(javaDateValue);
            restoredValue = adapterManager.adapterFor(dateValue);
        } else {
            throw new PersistFailedException("Unhandled date type: " + correspondingClass.getCanonicalName());
        }
        return restoredValue;
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.applib.PersistFailedException

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.