Examples of Memento


Examples of org.apache.isis.applib.services.memento.MementoService.Memento

        return mementoService.create()
                .set("path", fs.getParentPath())
                .asString();
    }
    void initOf(final String mementoStr, final FixtureScript fs) {
        Memento memento = mementoService.parse(mementoStr);
        fs.setParentPath(memento.get("path", String.class));
    }
View Full Code Here

Examples of org.apache.isis.applib.services.memento.MementoService.Memento

        public void hintsToPageParameters(Map<String,String> hints, PageParameters pageParameters) {
            if(hints.isEmpty()) {
                return;
            }
            MementoServiceDefault vms = new MementoServiceDefault();
            Memento memento = vms.create();
            Set<String> hintKeys = hints.keySet();
            for (String key : hintKeys) {
                String safeKey = key.replace(':', '_');
                Serializable value = hints.get(key);
                memento.set(safeKey, value);
            }
            String serializedHints = memento.asString();
            PageParameterNames.ANCHOR.addStringTo(pageParameters, serializedHints);
        }
View Full Code Here

Examples of org.apache.isis.applib.services.memento.MementoService.Memento

        public void pageParametersToHints(final PageParameters pageParameters, Map<String,String> hints) {
            String hintsStr = PageParameterNames.ANCHOR.getStringFrom(pageParameters);
            if(hintsStr != null) {
                try {
                    Memento memento = new MementoServiceDefault().parse(hintsStr);
                    Set<String> keys = memento.keySet();
                    for (String safeKey : keys) {
                        String value = memento.get(safeKey, String.class);
                        String key = safeKey.replace('_', ':');
                        hints.put(key, value);
                    }
                } catch(RuntimeException ex) {
                    // fail gracefully, ie ignore.
View Full Code Here

Examples of org.apache.isis.core.runtime.memento.Memento

            return;
        }
       
        final RootOid oid = (RootOid) adapter.getOid();
        if (oid.isTransient()) {
            transientMemento = new Memento(adapter);
            type = Type.TRANSIENT;
            return;
        }
       
        persistentOidStr = oid.enString(getOidMarshaller());
View Full Code Here

Examples of org.apache.isis.core.runtime.memento.Memento

    public TransientRootAdapterMapping(final ObjectAdapter adapter) {
        oid = (RootOid) adapter.getOid();
        Assert.assertTrue("OID is for persistent", oid.isTransient());
        Assert.assertTrue("adapter is for persistent", adapter.isTransient());
        memento = new Memento(adapter);
    }
View Full Code Here

Examples of org.apache.isis.core.runtime.memento.Memento

        memento.recreateObject();
    }

    @Override
    public void update() {
        memento = new Memento(getObject());
    }
View Full Code Here

Examples of org.apache.isis.core.runtime.memento.Memento

    public TransientRootAdapterMapping(final ObjectAdapter adapter) {
        super(adapter);
        Assert.assertFalse("OID is for persistent", !adapter.getOid().isTransient());
        Assert.assertFalse("adapter is for persistent", !adapter.isTransient());
        memento = new Memento(adapter);
    }
View Full Code Here

Examples of org.apache.isis.core.runtime.memento.Memento

    // to perform object-level validation, we must apply the changes first
    // contrast this with ActionPanel (for validating actionarguments) where
    // we do the validation prior to the execution of the action
    private boolean applyFormChangesElse() {
        final ObjectAdapter adapter = getEntityModel().getObject();
        final Memento snapshotToRollbackToIfInvalid = new Memento(adapter);

        getEntityModel().apply();
        final String invalidReasonIfAny = getEntityModel().getReasonInvalidIfAny();
        if (invalidReasonIfAny != null) {
            error(invalidReasonIfAny);
            snapshotToRollbackToIfInvalid.recreateObject();
            toEditMode(null);
            return true;
        }
        return false;
    }
View Full Code Here

Examples of org.apache.isis.core.runtime.memento.Memento

    // to perform object-level validation, we must apply the changes first
    // contrast this with ActionPanel (for validating actionarguments) where
    // we do the validation prior to the execution of the action
    private boolean applyFormChangesElse() {
        final ObjectAdapter adapter = getEntityModel().getObject();
        final Memento snapshotToRollbackToIfInvalid = new Memento(adapter);

        getEntityModel().apply();
        final String invalidReasonIfAny = getEntityModel().getReasonInvalidIfAny();
        if (invalidReasonIfAny != null) {
            error(invalidReasonIfAny);
            snapshotToRollbackToIfInvalid.recreateObject();
            toEditMode(null);
            return true;
        }
        return false;
    }
View Full Code Here

Examples of org.apache.isis.core.runtime.memento.Memento

                    // stay in edit mode
                    return;
                }
               
                final ObjectAdapter object = getEntityModel().getObject();
                final Memento snapshotToRollbackToIfInvalid = new Memento(object);
                // to perform object-level validation, we must apply the
                // changes first
                // contrast this with ActionPanel (for validating action
                // arguments) where
                // we do the validation prior to the execution of the
                // action
                getEntityModel().apply();
                final String invalidReasonIfAny = getEntityModel().getReasonInvalidIfAny();
                if (invalidReasonIfAny != null) {
                    getForm().error(invalidReasonIfAny);
                    snapshotToRollbackToIfInvalid.recreateObject();
                    toEditMode(null);
                    return;
                }
               
                try {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.