Package org.eclipse.emf.ecore.change

Examples of org.eclipse.emf.ecore.change.ChangeDescription


         *  input: changeSummary output: createdDataObjects, deletedDataObjects & modifiedDataObjects
         *  implement: careful if compute from changeSummary.getChangedDataObjects() since it also includes children of deleted objects (thank Frank)
         */
        if (changeSummary.isLogging())
            ((ChangeSummaryImpl) changeSummary).summarize();
        ChangeDescription changeDescription = (ChangeDescription) changeSummary;
        Iterator createdDataObjects = changeDescription.getObjectsToDetach().iterator();
        deletedDataObjects = changeDescription.getObjectsToAttach();
        EMap objectChanges = changeDescription.getObjectChanges();
        modifiedDataObjects = objectChanges.keySet(); // may contain DO(s) from createdDataObjects and/or deletedDataObjects

        /*
         * 6-2. Prepare to compute (X)Path
         *  input: changeSummary
         *  output: rootResource
         */
        /*not to support DataGraph 3-3
        Object dataGraph = changeSummary.getDataGraph();
        if (dataGraph == null) {
            DataObject rootObject = changeSummary.getRootObject();
            // assert rootObject != null;
            rootResource = rootObject.getContainer() == null ? ((EObject) rootObject).eResource() // Can be null since this *StAX* writer does NOT
                    // require rootObject contained by an *EMF* Resource
                    : null; // eResource() direct content may not necessarily always be the XML document
        } else
            // assert dataGraph instanceof DataGraphImpl;
            rootResource = ((org.apache.tuscany.sdo.impl.DataGraphImpl) dataGraph).getRootResource(); */

        /*
         * 6-2. Start ChangeSummary element
         *  input: writer, options, elementCS, changeSummary & changeDescription (6-1)
         */
        nsPrefixSuffix = 0;
        this.writer = writer;
        this.options = options;
        lineBreak = "";
        indent = margin = pathRootObject = STRING_OPTION;
        nest = 0;
        changeSummaryElementNS = changeSummaryElement.getNamespaceURI();
        changeSummaryElementName = changeSummaryElement.getLocalPart();
        writeStartElement(changeSummaryElement.getPrefix(), changeSummaryElementNS, changeSummaryElementName);
        lineBreak = STRING_OPTION;
        rootObject = changeSummary.getRootObject();
        extendedMetaData = (ExtendedMetaData) options.get(XMLResource.OPTION_EXTENDED_META_DATA);
        if (extendedMetaData == null)
        {
            extendedMetaData = ExtendedMetaData.INSTANCE;
            xsdHelper = XSDHelper.INSTANCE;
        }
        else{
          xsdHelper = (new HelperContextImpl(extendedMetaData, false)).getXSDHelper();
        }
        Property declaration = changeSummaryElementNS == null
                             ? rootObject.getType().getProperty(changeSummaryElementName)
                             : xsdHelper.getGlobalProperty(changeSummaryElementNS, changeSummaryElementName, true);
        if (declaration != null)
        {
            EClassifier type = changeDescription.eClass();
            if (type != declaration.getType() && type != CHANGE_SUMMARY)
                writeGlobalAttribute(ExtendedMetaData.XSI_PREFIX, ExtendedMetaData.XSI_URI, XMLResource.TYPE, new StringBuffer(prefix(extendedMetaData.getNamespace(type), null))
                        .append(':').append(extendedMetaData.getName(type)).toString());
        }
       
View Full Code Here


                rootObject.set(csp, changeSummary);
                changeSummary.setDataObject(rootObject);
            }
        } else
            getChangeSummary(rootObject);
        ChangeDescription changeDescription = (ChangeDescription) changeSummary;

        /*
         * 3-2. "logging" attribute input: reader output: logging
         */
        logging = Boolean.valueOf(reader.getAttributeValue(null, "logging")).booleanValue();

        /*
         * 3-3. Modified DataObjects input: changeDescription
         */
        if (forwardReferences != null)
            forwardReferences.clear();
        if (objectChangesCollection != null)
            objectChangesCollection.clear();
        if (START_ELEMENT == reader.nextTag()) {
            objectMapChanges = changeDescription.getObjectChanges();
            deletedDataObjects = changeDescription.getObjectsToAttach();
            Object factory = changeDescription.eClass().getEPackage().getEFactoryInstance();
            changeFactory = factory instanceof ChangeFactory ? (ChangeFactory) factory : ChangeFactory.eINSTANCE;
            changeSettingFactory = factory instanceof SDOFactory ? (SDOFactory) factory : null;
            do {
                /*
                 * Modified DataObject
View Full Code Here

         *  input: changeSummary output: createdDataObjects, deletedDataObjects & modifiedDataObjects
         *  implement: careful if compute from changeSummary.getChangedDataObjects() since it also includes children of deleted objects (thank Frank)
         */
        if (changeSummary.isLogging())
            ((ChangeSummaryImpl) changeSummary).summarize();
        ChangeDescription changeDescription = (ChangeDescription) changeSummary;
        Iterator createdDataObjects = changeDescription.getObjectsToDetach().iterator();
        deletedDataObjects = changeDescription.getObjectsToAttach();
        EMap objectChanges = changeDescription.getObjectChanges();
        modifiedDataObjects = objectChanges.keySet(); // may contain DO(s) from createdDataObjects and/or deletedDataObjects

        /*
         * 6-2. Prepare to compute (X)Path
         *  input: changeSummary
         *  output: rootResource
         */
        /*not to support DataGraph 3-3
        Object dataGraph = changeSummary.getDataGraph();
        if (dataGraph == null) {
            DataObject rootObject = changeSummary.getRootObject();
            // assert rootObject != null;
            rootResource = rootObject.getContainer() == null ? ((EObject) rootObject).eResource() // Can be null since this *StAX* writer does NOT
                    // require rootObject contained by an *EMF* Resource
                    : null; // eResource() direct content may not necessarily always be the XML document
        } else
            // assert dataGraph instanceof DataGraphImpl;
            rootResource = ((org.apache.tuscany.sdo.impl.DataGraphImpl) dataGraph).getRootResource(); */

        /*
         * 6-2. Start ChangeSummary element
         *  input: writer, options, elementCS, changeSummary & changeDescription (6-1)
         */
        nsPrefixSuffix = 0;
        this.writer = writer;
        this.options = options;
        lineBreak = "";
        indent = margin = pathRootObject = STRING_OPTION;
        nest = 0;
        changeSummaryElementNS = changeSummaryElement.getNamespaceURI();
        changeSummaryElementName = changeSummaryElement.getLocalPart();
        writeStartElement(changeSummaryElement.getPrefix(), changeSummaryElementNS, changeSummaryElementName);
        lineBreak = STRING_OPTION;
        rootObject = changeSummary.getRootObject();
        extendedMetaData = (ExtendedMetaData) options.get(XMLResource.OPTION_EXTENDED_META_DATA);
        if (extendedMetaData == null)
        {
            extendedMetaData = ExtendedMetaData.INSTANCE;
            xsdHelper = XSDHelper.INSTANCE;
        }
        else
            xsdHelper = new XSDHelperImpl(extendedMetaData, null);
        Property declaration = changeSummaryElementNS == null
                             ? rootObject.getType().getProperty(changeSummaryElementName)
                             : xsdHelper.getGlobalProperty(changeSummaryElementNS, changeSummaryElementName, true);
        if (declaration != null)
        {
            EClassifier type = changeDescription.eClass();
            if (type != declaration.getType() && type != CHANGE_SUMMARY)
                writeGlobalAttribute(ExtendedMetaData.XSI_PREFIX, ExtendedMetaData.XSI_URI, XMLResource.TYPE, new StringBuffer(prefix(extendedMetaData.getNamespace(type), null))
                        .append(':').append(extendedMetaData.getName(type)).toString());
        }
       
View Full Code Here

            Object o1 = eFeature.eGet(eAttribute);
            System.out.println("2: " + o1);
            Object o2 = eFeature.eGet(eAttribute);
            System.out.println("2: " + o2);
            eFeature.eSet(eAttribute, v);
            ChangeDescription c = r.endRecording();
            c.applyAndReverse();
            c.apply();
        } catch (Exception e) {
            LOGGER.log(Level.SEVERE, e.getMessage(), e);
            fail(e);
        }
       
View Full Code Here

TOP

Related Classes of org.eclipse.emf.ecore.change.ChangeDescription

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.