Package org.locationtech.udig.project.memento

Examples of org.locationtech.udig.project.memento.UdigMemento


     * @generated NO MORE
     */
    public IGenericProjectElement createIGenericProjectElementFromString(EDataType eDataType,
            String initialValue) {
        try {
            UdigMemento memento = UdigMemento.readString(initialValue);
            IGenericProjectElement backingObject = createGenericProjectElement(
                    IGenericProjectElement.class, memento.getString(EXTENSION_POINT_ID_KEY));
            backingObject.init(memento);
            return backingObject;
        } catch (IOException e) {
            ProjectPlugin.log("Error parsing memento data for IGenericProject Element", e); //$NON-NLS-1$
            return null;
View Full Code Here


     * Uses the IMemento pattern to obtain persistence data from the object
     * @generated NO MORE
     */
    public String convertIGenericProjectElementToString(EDataType eDataType, Object instanceValue) {
        IGenericProjectElement elem = (IGenericProjectElement) instanceValue;
        UdigMemento memento = new UdigMemento();
        elem.save(memento);
        memento.putString(EXTENSION_POINT_ID_KEY, elem.getExtensionId());
        return memento.toString();
    }
View Full Code Here

    // tests
   
    @Test
    public void testWrite() throws IOException {
        UdigMemento memento = createTestMemento();
       
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        memento.write(out, 0);
       
        System.out.println(new String(out.toByteArray()));
       
        UdigMemento readIn = UdigMemento.read(new ByteArrayInputStream(out.toByteArray()));
       
        assertMementoEquals(memento, readIn,true);
    }
View Full Code Here

        assertMementoEquals(memento, readIn,true);
    }
   
    @Test
    public void testPutMemento() throws Exception {
        UdigMemento expected = createTestMemento();
        UdigMemento actual = new UdigMemento();
        actual.putMemento(expected);
       
        assertMementoEquals(expected, actual,false);
    }
View Full Code Here

        assertMementoEquals(expected, actual,false);
    }

    @Test
    public void testAtSymbol() throws IOException{
      UdigMemento mem = new UdigMemento();
      String value = "org.locationtech.udig.project.test";
    String key = "@ElementFactoryImpl.ExtensionPointId.key@";
    mem.putString(key, value);
      String persisted = mem.toString();
      UdigMemento mem2 = UdigMemento.readString(persisted);
     
      assertEquals(value, mem2.getString(key));
    }
View Full Code Here

        assertDataEquals(memento.findChild(TYPE, ID1), childID, true);
        assertDataEquals(memento.findChild(null, null), childNullType, true);
    }

    private UdigMemento createTestMemento() {
        UdigMemento memento = new UdigMemento();
        fill(memento);
        fill(memento.createChild(TYPE));
        fill(memento.createChild(TYPE,ID1));
        fill(memento.createChild(null));
        return memento;
    }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.memento.UdigMemento

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.