Search in sources :

Example 1 with UpgradeUnit

use of org.apache.cayenne.project.upgrade.UpgradeUnit in project cayenne by apache.

the class CompatibilityUpgradeService method upgradeDataMap.

public Resource upgradeDataMap(Resource resource) {
    List<UpgradeHandler> handlerList = getHandlersForVersion(loadProjectVersion(resource));
    Document document = Util.readDocument(resource.getURL());
    UpgradeUnit upgradeUnit = new UpgradeUnit(resource, document);
    for (UpgradeHandler handler : handlerList) {
        handler.processDataMapDom(upgradeUnit);
    }
    documentProvider.putDocument(upgradeUnit.getResource().getURL(), upgradeUnit.getDocument());
    return upgradeUnit.getResource();
}
Also used : UpgradeUnit(org.apache.cayenne.project.upgrade.UpgradeUnit) Document(org.w3c.dom.Document) UpgradeHandler(org.apache.cayenne.project.upgrade.handlers.UpgradeHandler)

Example 2 with UpgradeUnit

use of org.apache.cayenne.project.upgrade.UpgradeUnit in project cayenne by apache.

the class BaseUpgradeHandlerTest method processDataMapDom.

Document processDataMapDom(String xmlResourceName) throws Exception {
    UpgradeUnit unit = new UpgradeUnit(new URLResource(getClass().getResource(xmlResourceName)), documentFromResource(xmlResourceName));
    handler.processDataMapDom(unit);
    return unit.getDocument();
}
Also used : URLResource(org.apache.cayenne.resource.URLResource) UpgradeUnit(org.apache.cayenne.project.upgrade.UpgradeUnit)

Example 3 with UpgradeUnit

use of org.apache.cayenne.project.upgrade.UpgradeUnit in project cayenne by apache.

the class BaseUpgradeHandlerTest method processProjectDom.

Document processProjectDom(String xmlResourceName) throws Exception {
    UpgradeUnit unit = new UpgradeUnit(new URLResource(getClass().getResource(xmlResourceName)), documentFromResource(xmlResourceName));
    handler.processProjectDom(unit);
    return unit.getDocument();
}
Also used : URLResource(org.apache.cayenne.resource.URLResource) UpgradeUnit(org.apache.cayenne.project.upgrade.UpgradeUnit)

Example 4 with UpgradeUnit

use of org.apache.cayenne.project.upgrade.UpgradeUnit in project cayenne by apache.

the class CompatibilityUpgradeService method upgradeProject.

@Override
public Resource upgradeProject(Resource resource) {
    List<UpgradeHandler> handlerList = getHandlersForVersion(loadProjectVersion(resource));
    List<UpgradeUnit> upgradeUnits = upgradeDOM(resource, handlerList);
    for (UpgradeUnit unit : upgradeUnits) {
        documentProvider.putDocument(unit.getResource().getURL(), unit.getDocument());
    }
    return resource;
}
Also used : UpgradeUnit(org.apache.cayenne.project.upgrade.UpgradeUnit) UpgradeHandler(org.apache.cayenne.project.upgrade.handlers.UpgradeHandler)

Aggregations

UpgradeUnit (org.apache.cayenne.project.upgrade.UpgradeUnit)4 UpgradeHandler (org.apache.cayenne.project.upgrade.handlers.UpgradeHandler)2 URLResource (org.apache.cayenne.resource.URLResource)2 Document (org.w3c.dom.Document)1