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;
}
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;
}
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);
}
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();
}
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;
}
Aggregations