Search in sources :

Example 61 with Sequence

use of com.twinsoft.convertigo.beans.core.Sequence in project convertigo by convertigo.

the class CreateEmptyStubAction method getXML.

public Document getXML(TreeObject treeObject) throws Exception {
    Document dom = XMLUtils.createDom("java");
    Element documentElement = (Element) dom.createElement("document");
    Object requestable = treeObject.getObject();
    if (requestable instanceof Transaction) {
        Transaction transaction = (Transaction) requestable;
        documentElement.setAttribute("connector", transaction.getParent().getName());
        documentElement.setAttribute("fromcache", "false");
        documentElement.setAttribute("generated", Calendar.getInstance(Locale.getDefault()).getTime().toString());
        documentElement.setAttribute("project", transaction.getProject().getName());
        documentElement.setAttribute("sequence", "");
        documentElement.setAttribute("transaction", transaction.getName());
    } else if (requestable instanceof Sequence) {
        Sequence sequence = (Sequence) requestable;
        documentElement.setAttribute("connector", "");
        documentElement.setAttribute("fromcache", "false");
        documentElement.setAttribute("generated", Calendar.getInstance(Locale.getDefault()).getTime().toString());
        documentElement.setAttribute("project", sequence.getProject().getName());
        documentElement.setAttribute("sequence", sequence.getName());
        documentElement.setAttribute("transaction", "");
    }
    dom.appendChild(documentElement);
    return dom;
}
Also used : Transaction(com.twinsoft.convertigo.beans.core.Transaction) Element(org.w3c.dom.Element) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) Sequence(com.twinsoft.convertigo.beans.core.Sequence) Document(org.w3c.dom.Document)

Example 62 with Sequence

use of com.twinsoft.convertigo.beans.core.Sequence in project convertigo by convertigo.

the class ProjectExplorerView method loadedProjectsHaveReferences.

private boolean loadedProjectsHaveReferences() {
    ViewContentProvider provider = (ViewContentProvider) viewer.getContentProvider();
    if (provider != null) {
        Object[] objects = provider.getChildren(provider.getTreeRoot());
        for (int i = 0; i < objects.length; i++) {
            TreeObject treeObject = (TreeObject) objects[i];
            if (treeObject instanceof ProjectTreeObject) {
                // Check for references on projects
                ProjectTreeObject projectTreeObject = (ProjectTreeObject) treeObject;
                List<Reference> references = ((Project) projectTreeObject.getObject()).getReferenceList();
                if (references.size() > 0) {
                    for (Reference reference : references) {
                        if (reference instanceof ProjectSchemaReference) {
                            return true;
                        }
                    }
                }
                // Check for sequences (potential call steps)
                List<Sequence> sequences = ((Project) projectTreeObject.getObject()).getSequencesList();
                if (sequences.size() > 0) {
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : IProject(org.eclipse.core.resources.IProject) Project(com.twinsoft.convertigo.beans.core.Project) ProjectSchemaReference(com.twinsoft.convertigo.beans.references.ProjectSchemaReference) ProjectSchemaReference(com.twinsoft.convertigo.beans.references.ProjectSchemaReference) IEditorReference(org.eclipse.ui.IEditorReference) Reference(com.twinsoft.convertigo.beans.core.Reference) UrlMappingParameterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingParameterTreeObject) MobileApplicationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileApplicationTreeObject) IClosableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IClosableTreeObject) XMLRecordDescriptionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.XMLRecordDescriptionTreeObject) DesignDocumentValidateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentValidateTreeObject) UrlMappingTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingTreeObject) DesignDocumentUpdateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject) DesignDocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject) MobileApplicationComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileApplicationComponentTreeObject) UrlMappingOperationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingOperationTreeObject) ReferenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ReferenceTreeObject) HandlersDeclarationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.HandlersDeclarationTreeObject) UrlMappingResponseTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingResponseTreeObject) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) NgxUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject) MobileUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject) CriteriaTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.CriteriaTreeObject) IPropertyTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IPropertyTreeObject) UrlAuthenticationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlAuthenticationTreeObject) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) MobileRouteActionComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteActionComponentTreeObject) ListenerTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ListenerTreeObject) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject) FullSyncListenerTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FullSyncListenerTreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) IDesignTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IDesignTreeObject) ScreenClassTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ScreenClassTreeObject) StatementTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StatementTreeObject) NgxApplicationComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxApplicationComponentTreeObject) MobileRouteEventComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteEventComponentTreeObject) PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) IEditableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IEditableTreeObject) XMLTableDescriptionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.XMLTableDescriptionTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) DesignDocumentViewTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject) TemplateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TemplateTreeObject) TestCaseTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TestCaseTreeObject) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) PropertyTableColumnTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject) DesignDocumentFilterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject) VariableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.VariableTreeObject) DesignDocumentFunctionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject) MobilePlatformTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobilePlatformTreeObject) ExtractionRuleTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ExtractionRuleTreeObject) MobileRouteComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteComponentTreeObject) SheetTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SheetTreeObject) UrlMapperTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMapperTreeObject) StepTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject) NgxPageComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxPageComponentTreeObject) MobilePageComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobilePageComponentTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) TraceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TraceTreeObject) DocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DocumentTreeObject) UrlMappingParameterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingParameterTreeObject) MobileApplicationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileApplicationTreeObject) IClosableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IClosableTreeObject) XMLRecordDescriptionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.XMLRecordDescriptionTreeObject) DesignDocumentValidateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentValidateTreeObject) UrlMappingTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingTreeObject) DesignDocumentUpdateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject) DesignDocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject) MobileApplicationComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileApplicationComponentTreeObject) UrlMappingOperationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingOperationTreeObject) ReferenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ReferenceTreeObject) HandlersDeclarationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.HandlersDeclarationTreeObject) UrlMappingResponseTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingResponseTreeObject) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) NgxUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject) MobileUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject) CriteriaTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.CriteriaTreeObject) IPropertyTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IPropertyTreeObject) UrlAuthenticationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlAuthenticationTreeObject) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) MobileRouteActionComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteActionComponentTreeObject) ListenerTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ListenerTreeObject) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject) FullSyncListenerTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FullSyncListenerTreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) IDesignTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IDesignTreeObject) ScreenClassTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ScreenClassTreeObject) StatementTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StatementTreeObject) NgxApplicationComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxApplicationComponentTreeObject) MobileRouteEventComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteEventComponentTreeObject) PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) IEditableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IEditableTreeObject) XMLTableDescriptionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.XMLTableDescriptionTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) DesignDocumentViewTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject) TemplateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TemplateTreeObject) TestCaseTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TestCaseTreeObject) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) PropertyTableColumnTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject) DesignDocumentFilterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject) VariableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.VariableTreeObject) DesignDocumentFunctionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject) MobilePlatformTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobilePlatformTreeObject) ExtractionRuleTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ExtractionRuleTreeObject) MobileRouteComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteComponentTreeObject) SheetTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SheetTreeObject) UrlMapperTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMapperTreeObject) StepTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject) NgxPageComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxPageComponentTreeObject) MobilePageComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobilePageComponentTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) TraceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TraceTreeObject) DocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DocumentTreeObject) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) Sequence(com.twinsoft.convertigo.beans.core.Sequence) Point(org.eclipse.swt.graphics.Point)

Example 63 with Sequence

use of com.twinsoft.convertigo.beans.core.Sequence in project convertigo by convertigo.

the class ClipboardManager method appendDndData.

private void appendDndData(Element element, DatabaseObject databaseObject) {
    Element dnd = clipboardDocument.createElement("dnd");
    Element e;
    try {
        if (databaseObject instanceof Sequence) {
            Sequence sequence = (Sequence) databaseObject;
            e = clipboardDocument.createElement("project");
            e.setAttribute("name", sequence.getProject().getName());
            dnd.appendChild(e);
        } else if (databaseObject instanceof Transaction) {
            Transaction transaction = (Transaction) databaseObject;
            e = clipboardDocument.createElement("project");
            e.setAttribute("name", transaction.getProject().getName());
            dnd.appendChild(e);
            e = clipboardDocument.createElement("connector");
            e.setAttribute("name", transaction.getConnector().getName());
            dnd.appendChild(e);
        } else if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.UIComponent) {
            com.twinsoft.convertigo.beans.mobile.components.UIComponent uic = GenericUtils.cast(databaseObject);
            e = clipboardDocument.createElement("project");
            e.setAttribute("name", uic.getProject().getName());
            dnd.appendChild(e);
            e = clipboardDocument.createElement("mobileapplication");
            e.setAttribute("name", uic.getApplication().getParent().getName());
            dnd.appendChild(e);
            e = clipboardDocument.createElement("application");
            e.setAttribute("name", uic.getApplication().getName());
            dnd.appendChild(e);
        } else if (databaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.UIComponent) {
            com.twinsoft.convertigo.beans.ngx.components.UIComponent uic = GenericUtils.cast(databaseObject);
            e = clipboardDocument.createElement("project");
            e.setAttribute("name", uic.getProject().getName());
            dnd.appendChild(e);
            e = clipboardDocument.createElement("mobileapplication");
            e.setAttribute("name", uic.getApplication().getParent().getName());
            dnd.appendChild(e);
            e = clipboardDocument.createElement("application");
            e.setAttribute("name", uic.getApplication().getName());
            dnd.appendChild(e);
        }
    } catch (Exception ex) {
    }
    element.appendChild(dnd);
}
Also used : Element(org.w3c.dom.Element) Sequence(com.twinsoft.convertigo.beans.core.Sequence) SAXException(org.xml.sax.SAXException) EngineException(com.twinsoft.convertigo.engine.EngineException) ConvertigoException(com.twinsoft.convertigo.engine.ConvertigoException) IOException(java.io.IOException) JSONException(org.codehaus.jettison.json.JSONException) InvalidOperationException(com.twinsoft.convertigo.engine.InvalidOperationException) ObjectWithSameNameException(com.twinsoft.convertigo.engine.ObjectWithSameNameException) Transaction(com.twinsoft.convertigo.beans.core.Transaction) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction)

Example 64 with Sequence

use of com.twinsoft.convertigo.beans.core.Sequence in project convertigo by convertigo.

the class ViewLabelProvider method getText.

@Override
public String getText(Object obj) {
    if (obj instanceof DatabaseObjectTreeObject) {
        DatabaseObject dbo = ((DatabaseObjectTreeObject) obj).getObject();
        if (dbo.isSymbolError() || (dbo instanceof Project && ((Project) dbo).undefinedGlobalSymbols)) {
            return obj.toString() + " (! undefined symbol !)";
        }
        String osname = System.getProperty("os.name");
        String version = System.getProperty("os.version");
        boolean notShownSpecialChar = osname.toLowerCase().startsWith("windows") && Double.parseDouble(version) < 6.2;
        boolean isMac = osname.toLowerCase().startsWith("mac");
        if (dbo instanceof RequestableObject && !notShownSpecialChar) {
            return (((RequestableObject) dbo).getAccessibility() == Accessibility.Private ? "🔒 " : (((RequestableObject) dbo).getAccessibility() == Accessibility.Hidden ? "👓 " : (isMac ? "🚪 " : " 🚪  "))) + (dbo instanceof Sequence ? (((Sequence) dbo).isAutoStart() ? "💡 " : "") : "") + obj.toString();
        }
    }
    return obj.toString();
}
Also used : Project(com.twinsoft.convertigo.beans.core.Project) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) RequestableObject(com.twinsoft.convertigo.beans.core.RequestableObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) Sequence(com.twinsoft.convertigo.beans.core.Sequence)

Example 65 with Sequence

use of com.twinsoft.convertigo.beans.core.Sequence in project convertigo by convertigo.

the class MobileSmartSource method getDatabaseObject.

public DatabaseObject getDatabaseObject(String rootDboName) {
    List<String> sourceData = getSources();
    String sourceInput = sourceData.size() > 0 ? sourceData.get(0) : null;
    if (sourceInput != null) {
        if (Filter.Action.equals(getFilter())) {
            Matcher m = actionPattern.matcher(sourceInput);
            if (m.find()) {
                String stack = m.group(1);
                try {
                    String p = stack.replaceFirst("stack\\[", "").replaceFirst("\\]", "");
                    // ignore quotes
                    p = p.substring(1, p.length() - 1);
                    long priority = Long.valueOf(p, 10);
                    return findDatabaseObject(rootDboName, priority);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        } else if (Filter.Shared.equals(getFilter())) {
            Matcher m = sharedPattern.matcher(sourceInput);
            if (m.find()) {
                String shared = m.group(1);
                try {
                    long priority = Long.valueOf(shared.replaceFirst("comp", ""), 10);
                    return findDatabaseObject(rootDboName, priority);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        } else if (Filter.Iteration.equals(getFilter())) {
            Matcher m = directivePattern.matcher(sourceInput);
            if (m.find()) {
                String item = m.group(1);
                try {
                    long priority = Long.valueOf(item.replaceFirst("item", ""), 10);
                    return findDatabaseObject(rootDboName, priority);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        } else if (Filter.Form.equals(getFilter())) {
            Matcher m = formPattern.matcher(sourceInput);
            if (m.find()) {
                String form = m.group(1);
                try {
                    long priority = Long.valueOf(form.replaceFirst("form", ""), 10);
                    return findDatabaseObject(rootDboName, priority);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        } else if (Filter.Global.equals(getFilter())) {
            Matcher m = globalPattern.matcher(sourceInput);
            if (m.find()) {
                try {
                    String projectName = getProjectName();
                    Project project = Engine.theApp.databaseObjectsManager.getOriginalProjectByName(projectName);
                    DatabaseObject dbo = (ApplicationComponent) project.getMobileApplication().getApplicationComponent();
                    return dbo;
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        } else if (Filter.Database.equals(getFilter())) {
            Matcher m = cafPattern.matcher(sourceInput);
            if (m.find()) {
                try {
                    String name = m.group(1);
                    name = name.replaceFirst("fs://", "");
                    name = name.replaceFirst("\\.view", "");
                    name = name.replaceFirst("\\.get", "");
                    int i = name.indexOf('#');
                    if (i != -1) {
                        name = name.substring(0, i);
                    }
                    int index = name.indexOf('.');
                    String projectName = index != -1 ? name.substring(0, index) : getProjectName();
                    String dbName = index != -1 ? name.substring(index + 1) : name;
                    Project project = Engine.theApp.databaseObjectsManager.getOriginalProjectByName(projectName);
                    FullSyncConnector connector = (FullSyncConnector) project.getConnectorByName(dbName);
                    String documentName = getParameters().get("ddoc");
                    DesignDocument ddoc = (DesignDocument) connector.getDocumentByName(documentName);
                    return ddoc;
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        } else if (Filter.Sequence.equals(getFilter())) {
            Matcher m = cafPattern.matcher(sourceInput);
            if (m.find()) {
                try {
                    String name = m.group(1);
                    int i = name.indexOf('#');
                    if (i != -1) {
                        name = name.substring(0, i);
                    }
                    int index = name.indexOf('.');
                    String projectName = index != -1 ? name.substring(0, index) : getProjectName();
                    projectName = projectName.isEmpty() ? getProjectName() : projectName;
                    String sequenceName = index != -1 ? name.substring(index + 1) : name;
                    Project project = Engine.theApp.databaseObjectsManager.getOriginalProjectByName(projectName);
                    Sequence sequence = project.getSequenceByName(sequenceName);
                    return sequence;
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }
    return null;
}
Also used : Project(com.twinsoft.convertigo.beans.core.Project) Matcher(java.util.regex.Matcher) DesignDocument(com.twinsoft.convertigo.beans.couchdb.DesignDocument) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) FullSyncConnector(com.twinsoft.convertigo.beans.connectors.FullSyncConnector) Sequence(com.twinsoft.convertigo.beans.core.Sequence) InvalidSourceException(com.twinsoft.convertigo.engine.InvalidSourceException) JSONException(org.codehaus.jettison.json.JSONException)

Aggregations

Sequence (com.twinsoft.convertigo.beans.core.Sequence)94 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)47 EngineException (com.twinsoft.convertigo.engine.EngineException)42 Step (com.twinsoft.convertigo.beans.core.Step)38 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)37 Project (com.twinsoft.convertigo.beans.core.Project)34 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)34 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)32 Transaction (com.twinsoft.convertigo.beans.core.Transaction)29 Cursor (org.eclipse.swt.graphics.Cursor)29 Display (org.eclipse.swt.widgets.Display)29 Shell (org.eclipse.swt.widgets.Shell)29 StepWithExpressions (com.twinsoft.convertigo.beans.core.StepWithExpressions)27 Connector (com.twinsoft.convertigo.beans.core.Connector)21 StepTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject)20 ThenStep (com.twinsoft.convertigo.beans.steps.ThenStep)19 TransactionStep (com.twinsoft.convertigo.beans.steps.TransactionStep)18 SequenceStep (com.twinsoft.convertigo.beans.steps.SequenceStep)17 TreeParent (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent)17 RequestableStep (com.twinsoft.convertigo.beans.core.RequestableStep)16