Search in sources :

Example 1 with ProjectSchemaReference

use of com.twinsoft.convertigo.beans.references.ProjectSchemaReference in project convertigo by convertigo.

the class ReferenceTreeObject method treeObjectPropertyChanged.

@Override
public void treeObjectPropertyChanged(TreeObjectEvent treeObjectEvent) {
    super.treeObjectPropertyChanged(treeObjectEvent);
    TreeObject treeObject = (TreeObject) treeObjectEvent.getSource();
    if (treeObject instanceof DatabaseObjectTreeObject) {
        DatabaseObject databaseObject = (DatabaseObject) treeObject.getObject();
        String propertyName = treeObjectEvent.propertyName;
        propertyName = ((propertyName == null) ? "" : propertyName);
        // If a bean name has changed
        if (propertyName.equals("name")) {
            handlesBeanNameChanged(treeObjectEvent);
        } else {
            // If a referenced project has changed, clear current project schema
            if (getObject() instanceof ProjectSchemaReference) {
                ProjectSchemaReference reference = (ProjectSchemaReference) getObject();
                if (databaseObject.getProject().getName().equals(reference.getParser().getProjectName())) {
                    Engine.theApp.schemaManager.clearCache(reference.getProject().getName());
                }
            }
        }
    }
}
Also used : ProjectSchemaReference(com.twinsoft.convertigo.beans.references.ProjectSchemaReference) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject)

Example 2 with ProjectSchemaReference

use of com.twinsoft.convertigo.beans.references.ProjectSchemaReference in project convertigo by convertigo.

the class ProjectSchemaWizardPage method dialogChanged.

private void dialogChanged() {
    if (projectName == null) {
        updateStatus("Please select a project");
        return;
    }
    try {
        DatabaseObject dbo = ((ObjectExplorerWizardPage) getWizard().getPage("ObjectExplorerWizardPage")).getCreatedBean();
        if (dbo != null) {
            if (dbo instanceof ProjectSchemaReference) {
                projectName = ProjectUrlParser.getUrl(projectName);
                ((ProjectSchemaReference) dbo).setProjectName(projectName);
            }
        }
    } catch (NullPointerException e) {
        updateStatus("New Bean has not been instantiated");
        return;
    }
    updateStatus(null);
}
Also used : ProjectSchemaReference(com.twinsoft.convertigo.beans.references.ProjectSchemaReference) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) ObjectExplorerWizardPage(com.twinsoft.convertigo.eclipse.wizards.new_object.ObjectExplorerWizardPage)

Example 3 with ProjectSchemaReference

use of com.twinsoft.convertigo.beans.references.ProjectSchemaReference in project convertigo by convertigo.

the class Migration7_0_0 method addReferenceToMap.

private static void addReferenceToMap(Map<String, Reference> referenceMap, String namespaceURI, String location) throws EngineException {
    if (!referenceMap.containsKey(namespaceURI)) {
        // c8o project reference
        if (location.startsWith("../")) {
            String targetProjectName = location.substring(3, location.indexOf("/", 3));
            ProjectSchemaReference reference = new ProjectSchemaReference();
            reference.setProjectName(targetProjectName);
            reference.setName(targetProjectName + "_reference");
            referenceMap.put(namespaceURI, reference);
        } else // other reference
        {
            ImportXsdSchemaReference reference = new ImportXsdSchemaReference();
            reference.setName(StringUtils.normalize(location));
            reference.setFilepath(".//xsd/" + location);
            referenceMap.put(namespaceURI, reference);
        }
    }
}
Also used : ProjectSchemaReference(com.twinsoft.convertigo.beans.references.ProjectSchemaReference) ImportXsdSchemaReference(com.twinsoft.convertigo.beans.references.ImportXsdSchemaReference)

Example 4 with ProjectSchemaReference

use of com.twinsoft.convertigo.beans.references.ProjectSchemaReference in project convertigo by convertigo.

the class CLI method generateMobileBuilder.

public void generateMobileBuilder(Project project, String mode) throws Exception {
    MobileBuilder mb = project.getMobileBuilder();
    MobileBuilderBuildMode bm = MobileBuilderBuildMode.production;
    try {
        bm = MobileBuilderBuildMode.valueOf(mode);
    } catch (Exception e) {
    }
    mb.setAppBuildMode(bm);
    List<Project> projects = new ArrayList<>();
    projects.add(project);
    int i = 0;
    do {
        for (Reference ref : projects.get(i).getReferenceList()) {
            if (ref instanceof ProjectSchemaReference) {
                ProjectSchemaReference pref = (ProjectSchemaReference) ref;
                Project p = Engine.theApp.referencedProjectManager.importProject(pref.getParser());
                if (p == null) {
                    Engine.logConvertigo.warn("Failed to import project reference: " + pref.getProjectName() + " (ignored)");
                } else if (!projects.contains(p)) {
                    projects.add(p);
                }
            }
        }
    } while (++i < projects.size());
    Collections.reverse(projects);
    for (Project p : projects) {
        MobileBuilder.initBuilder(p, true);
    }
    Collections.reverse(projects);
    for (Project p : projects) {
        MobileBuilder.releaseBuilder(p, true);
    }
}
Also used : Project(com.twinsoft.convertigo.beans.core.Project) ProjectSchemaReference(com.twinsoft.convertigo.beans.references.ProjectSchemaReference) MobileBuilder(com.twinsoft.convertigo.engine.mobile.MobileBuilder) ProjectSchemaReference(com.twinsoft.convertigo.beans.references.ProjectSchemaReference) Reference(com.twinsoft.convertigo.beans.core.Reference) ArrayList(java.util.ArrayList) MobileBuilderBuildMode(com.twinsoft.convertigo.engine.enums.MobileBuilderBuildMode) IOException(java.io.IOException)

Example 5 with ProjectSchemaReference

use of com.twinsoft.convertigo.beans.references.ProjectSchemaReference in project convertigo by convertigo.

the class SchemaManager method getProjectReferences.

protected static void getProjectReferences(List<String> refs, String projectName) {
    if (refs == null)
        return;
    try {
        Project p = Engine.theApp.databaseObjectsManager.getOriginalProjectByName(projectName);
        if (p != null) {
            if (!refs.contains(projectName)) {
                refs.add(projectName);
                for (Reference ref : p.getReferenceList()) {
                    if (ref instanceof ProjectSchemaReference) {
                        ProjectSchemaReference psr = (ProjectSchemaReference) ref;
                        getProjectReferences(refs, psr.getParser().getProjectName());
                    }
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : Project(com.twinsoft.convertigo.beans.core.Project) ProjectSchemaReference(com.twinsoft.convertigo.beans.references.ProjectSchemaReference) ProjectSchemaReference(com.twinsoft.convertigo.beans.references.ProjectSchemaReference) Reference(com.twinsoft.convertigo.beans.core.Reference) SAXException(org.xml.sax.SAXException)

Aggregations

ProjectSchemaReference (com.twinsoft.convertigo.beans.references.ProjectSchemaReference)16 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)9 Reference (com.twinsoft.convertigo.beans.core.Reference)9 Project (com.twinsoft.convertigo.beans.core.Project)8 RequestableStep (com.twinsoft.convertigo.beans.core.RequestableStep)4 Sequence (com.twinsoft.convertigo.beans.core.Sequence)4 Transaction (com.twinsoft.convertigo.beans.core.Transaction)4 ArrayList (java.util.ArrayList)4 Step (com.twinsoft.convertigo.beans.core.Step)3 SequenceStep (com.twinsoft.convertigo.beans.steps.SequenceStep)3 TransactionStep (com.twinsoft.convertigo.beans.steps.TransactionStep)3 EngineException (com.twinsoft.convertigo.engine.EngineException)3 CouchDbConnector (com.twinsoft.convertigo.beans.connectors.CouchDbConnector)2 Connector (com.twinsoft.convertigo.beans.core.Connector)2 ISchemaGenerator (com.twinsoft.convertigo.beans.core.ISchemaGenerator)2 ISchemaImportGenerator (com.twinsoft.convertigo.beans.core.ISchemaImportGenerator)2 XMLCopyStep (com.twinsoft.convertigo.beans.steps.XMLCopyStep)2 ConvertigoException (com.twinsoft.convertigo.engine.ConvertigoException)2 ProjectUrlParser (com.twinsoft.convertigo.engine.util.ProjectUrlParser)2 Iterator (java.util.Iterator)2