use of com.twinsoft.convertigo.beans.core.Project in project convertigo by convertigo.
the class NgxPickerContentProvider method addSequences.
private void addSequences(Map<String, Set<String>> map, TVObject tvs, Object object, boolean isReferenced) {
if (object != null) {
if (object instanceof Project) {
Project project = (Project) object;
for (Sequence s : project.getSequencesList()) {
String label = isReferenced ? s.getQName() : s.getName();
SourceData sd = null;
try {
sd = Filter.Sequence.toSourceData(new JSONObject().put("sequence", s.getQName()));
} catch (JSONException e) {
e.printStackTrace();
}
tvs.add(new TVObject(label, s, sd));
Set<String> infos = map.get(s.getQName());
if (infos != null) {
for (String info : infos) {
try {
JSONObject jsonInfo = new JSONObject(info);
if (jsonInfo.has("marker")) {
String marker = jsonInfo.getString("marker");
if (!marker.isEmpty()) {
sd = Filter.Sequence.toSourceData(new JSONObject().put("sequence", s.getQName()).put("marker", marker));
tvs.add(new TVObject(label + "#" + marker, s, sd, jsonInfo));
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}
}
}
}
use of com.twinsoft.convertigo.beans.core.Project in project convertigo by convertigo.
the class OpenApiUtils method parse.
public static OpenAPI parse(String requestUrl, UrlMapper urlMapper, boolean useExternalRef) {
Project project = urlMapper.getProject();
String projectName = project.getName();
File targetDir = new File(Engine.PROJECTS_PATH + "/" + projectName + "/" + jsonSchemaDirectory);
File yamlFile = new File(targetDir, projectName + ".yaml");
// generate yaml file if needed
if (Engine.isStudioMode() || !yamlFile.exists()) {
try {
writeOpenApiToFile(requestUrl, urlMapper, yamlFile, useExternalRef);
} catch (Exception e) {
e.printStackTrace();
Engine.logEngine.error("Unexpected exception while generating project YAML file", e);
}
}
OpenAPI openAPI = null;
// read generated yaml file
try {
openAPI = readOpenApiFromFile(yamlFile);
} catch (Exception e) {
e.printStackTrace();
Engine.logEngine.error("Unexpected exception while reading project YAML file", e);
}
return openAPI;
}
use of com.twinsoft.convertigo.beans.core.Project in project convertigo by convertigo.
the class TransactionStep method getTransactionNames.
public String[] getTransactionNames() {
try {
if (!projectName.equals("") && !connectorName.equals("")) {
Project p = getTargetProject(projectName);
Connector connector = p.getConnectorByName(connectorName);
List<Transaction> v = new ArrayList<Transaction>(connector.getTransactionsList());
v = GenericUtils.cast(sort((Vector<?>) v, true));
String[] transactionNames = new String[v.size() + 1];
transactionNames[0] = "";
int i = 0;
for (Transaction transaction : v) {
transactionNames[i + 1] = transaction.getName();
i++;
}
return transactionNames;
}
} catch (EngineException e) {
}
return new String[] {};
}
use of com.twinsoft.convertigo.beans.core.Project in project convertigo by convertigo.
the class TransactionStep method getTagsForProperty.
@Override
public String[] getTagsForProperty(String propertyName) {
if (propertyName.equals("sourceTransaction")) {
List<String> transactionsList = new ArrayList<String>();
try {
List<String> projectNames = Engine.theApp.databaseObjectsManager.getAllProjectNamesList();
for (String projectName : projectNames) {
Project project = Engine.theApp.databaseObjectsManager.getProjectByName(projectName);
List<Connector> connectors = project.getConnectorsList();
for (Connector connector : connectors) {
String connectorName = connector.getName();
List<Transaction> transactions = connector.getTransactionsList();
for (Transaction transaction : transactions) {
transactionsList.add(projectName + SOURCE_SEPARATOR + connectorName + SOURCE_SEPARATOR + transaction.getName());
}
}
}
} catch (EngineException e) {
// Just ignore, should never happen
}
return transactionsList.toArray(new String[] {});
}
return super.getTagsForProperty(propertyName);
}
use of com.twinsoft.convertigo.beans.core.Project in project convertigo by convertigo.
the class SequenceExecuteSelectedAction method openEditors.
private void openEditors(/*ProjectExplorerView explorerView, */
List<Step> steps, Set<SequenceStep> alreadyOpened) {
for (Step step : steps) {
if (step.isEnabled()) {
if (step instanceof SequenceStep) {
SequenceStep sequenceStep = (SequenceStep) step;
String projectName = sequenceStep.getProjectName();
// load project if necessary
if (!step.getSequence().getProject().getName().equals(projectName)) {
// loadProject(explorerView, projectName);
}
if (alreadyOpened.contains(sequenceStep)) {
// avoid sequence recursion
return;
}
alreadyOpened.add(sequenceStep);
try {
// ProjectTreeObject projectTreeObject = (ProjectTreeObject)explorerView.getProjectRootObject(projectName);
Project p = step.getProject();
Sequence subSequence = p.getSequenceByName(sequenceStep.getSequenceName());
SequenceView subSequenceTreeObject = (SequenceView) Studio.getViewFromDbo(subSequence, studio);
// recurse on sequence
openEditors(/*explorerView, */
subSequenceTreeObject, alreadyOpened);
} catch (EngineException e) {
}
} else if (step instanceof TransactionStep) {
TransactionStep transactionStep = (TransactionStep) step;
String projectName = transactionStep.getProjectName();
if (!step.getSequence().getProject().getName().equals(projectName)) {
// loadProject(explorerView, projectName); // load project if necessary
}
try {
// ProjectTreeObject projectTreeObject = (ProjectTreeObject)explorerView.getProjectRootObject(projectName);
Project project = Engine.theApp.databaseObjectsManager.getProjectByName(projectName);
ProjectView projectTreeObject = new ProjectView(project, studio);
Connector connector = projectTreeObject.getObject().getConnectorByName(transactionStep.getConnectorName());
ConnectorView connectorTreeObject = new ConnectorView(connector, studio);
// open connector editor
connectorTreeObject.openConnectorEditor();
} catch (EngineException e) {
}
} else if (step instanceof StepWithExpressions) {
openEditors(/*explorerView, */
((StepWithExpressions) step).getSteps(), alreadyOpened);
}
}
}
}
Aggregations