use of org.talend.designer.core.model.utils.emf.talendfile.TalendFileFactory in project tdi-studio-se by Talend.
the class ReplaceMultiFlowBytReplicateMigrationTask method addtReplicateComponent.
/**
* DOC nrousseau Comment method "addtReplicateComponent".
*
* @param processType
* @param replicatePos
* @param connections
*/
private void addtReplicateComponent(ProcessType processType, Point replicatePos, NodeType nodeTypeSource, String sourceName, INodeConnector nodeConnector, List<ConnectionType> connections) {
TalendFileFactory fileFact = TalendFileFactory.eINSTANCE;
// create the node
String uniqueName = createNodeType(processType, replicatePos, nodeTypeSource, sourceName, nodeConnector, connections, fileFact);
// create the connection from source component to tReplicate
createConnectionType(processType, sourceName, nodeConnector, fileFact, uniqueName);
}
use of org.talend.designer.core.model.utils.emf.talendfile.TalendFileFactory in project tdi-studio-se by Talend.
the class ElementParameter2ParameterType method loadElementParameters.
/**
*
* load project settings to no-opened process
*
* @param elemParam
* @param projectPaType
*/
public static void loadElementParameters(ParametersType processType, ParametersType projectPaType, EParameterName paramName) {
EList listParamType = projectPaType.getElementParameter();
for (int j = 0; j < listParamType.size(); j++) {
ElementParameterType pType = (ElementParameterType) listParamType.get(j);
EList processParameters = processType.getElementParameter();
ElementParameterType processParam = null;
for (int i = 0; i < processParameters.size(); i++) {
ElementParameterType paramType = (ElementParameterType) processParameters.get(i);
if (paramType.getName().equals(pType.getName()) && paramType.getField() != null && paramType.getField().equals(pType.getField())) {
processParam = paramType;
} else if (pType.getName().contains(":")) {
//$NON-NLS-1$
StringTokenizer token = new StringTokenizer(pType.getName(), ":");
String parentId = token.nextToken();
String childId = token.nextToken();
String[] split = paramType.getName().split(":");
if (split.length != 2) {
continue;
}
String complexName = paramName + ":" + childId;
if (complexName.equals(paramType.getName())) {
processParam = paramType;
}
}
if (processParam != null) {
break;
}
}
if (processParam != null) {
processParam.setValue(pType.getValue());
} else {
TalendFileFactory fileFact = TalendFileFactory.eINSTANCE;
ElementParameterType processTypes = fileFact.createElementParameterType();
processTypes.setName(pType.getName());
processTypes.setField(pType.getField());
processTypes.setValue(pType.getValue());
processType.getElementParameter().add(processTypes);
}
}
}
use of org.talend.designer.core.model.utils.emf.talendfile.TalendFileFactory in project tdi-studio-se by Talend.
the class ProjectSettingManager method loadImplicitContextLoadPreferenceToProject.
/**
*
* Load ImplicitContextLoad Preference setting to Project only Load Once
*
* @param pro
*/
private static void loadImplicitContextLoadPreferenceToProject(Project pro) {
TalendFileFactory talendF = TalendFileFactory.eINSTANCE;
ImplicitContextSettings implicit = PropertiesFactory.eINSTANCE.createImplicitContextSettings();
pro.getEmfProject().setImplicitContextSettings(implicit);
implicit.setParameters(talendF.createParametersType());
ParametersType pType = implicit.getParameters();
IElement elem = pro.getInitialContextLoad();
if (elem == null) {
elem = new ImplicitContextLoadElement();
ProjectSettingManager.createImplicitContextLoadParameters((ImplicitContextLoadElement) elem);
pro.setInitialContextLoad(elem);
}
ElementParameter2ParameterType.saveElementParameters((Element) elem, pType);
}
use of org.talend.designer.core.model.utils.emf.talendfile.TalendFileFactory in project tdi-studio-se by Talend.
the class MetadataEmfFactory method setMetadataTable.
@SuppressWarnings("unchecked")
public void setMetadataTable(final IMetadataTable metadataTable) {
this.metadataTable = metadataTable;
TalendFileFactory fileFact = TalendFileFactory.eINSTANCE;
metadataType = fileFact.createMetadataType();
IMetadataColumn metaCol;
ColumnType colType;
EList listColType;
metadataType.setComment(metadataTable.getComment());
metadataType.setName(metadataTable.getTableName());
metadataType.setLabel(metadataTable.getLabel());
metadataType.setConnector(metadataTable.getAttachedConnector());
metadataType.setType(metadataTable.getTableType());
metadataType.getAdditionalProperties().putAll(metadataTable.getAdditionalProperties());
listColType = metadataType.getColumn();
if (metadataTable.getListColumns(true) != null) {
for (int i = 0; i < metadataTable.getListColumns(true).size(); i++) {
metaCol = metadataTable.getListColumns(true).get(i);
colType = fileFact.createColumnType();
colType.setComment(metaCol.getComment());
colType.setKey(metaCol.isKey());
colType.setNullable(metaCol.isNullable());
if (metaCol.getLength() == null || metaCol.getLength().intValue() < 0) {
colType.setLength(-1);
// colType.unsetLength();
} else {
colType.setLength(metaCol.getLength());
}
if (metaCol.getOriginalLength() != null) {
colType.setOriginalLength(metaCol.getOriginalLength());
} else {
colType.setOriginalLength(-1);
}
if (metaCol.getAdditionalField().size() > 0) {
for (String key : metaCol.getAdditionalField().keySet()) {
colType.getAdditionalField().put(key, metaCol.getAdditionalField().get(key));
}
}
colType.setName(metaCol.getLabel());
if (metaCol.getPrecision() == null || metaCol.getPrecision().intValue() < 0) {
colType.setPrecision(-1);
// colType.unsetPrecision();
} else {
colType.setPrecision(metaCol.getPrecision());
}
if (!metaCol.getLabel().equals(metaCol.getOriginalDbColumnName())) {
colType.setOriginalDbColumnName(metaCol.getOriginalDbColumnName());
}
colType.setType(metaCol.getTalendType());
colType.setSourceType(metaCol.getType());
colType.setPattern(metaCol.getPattern());
colType.setDefaultValue(metaCol.getDefault());
if (PluginChecker.isDatacertPluginLoaded()) {
colType.setRelatedEntity(metaCol.getRelatedEntity());
colType.setRelationshipType(metaCol.getRelationshipType());
}
colType.setUsefulColumn(metaCol.isUsefulColumn());
listColType.add(colType);
}
}
}
use of org.talend.designer.core.model.utils.emf.talendfile.TalendFileFactory in project tdi-studio-se by Talend.
the class StatsAndLogsHelper method loadPreferenceToProject.
/**
*
* Load StatsAndLogs Preference setting to Project Only load Once
*
* @param pro
*/
static void loadPreferenceToProject(Project pro) {
TalendFileFactory talendF = TalendFileFactory.eINSTANCE;
StatAndLogsSettings stats = PropertiesFactory.eINSTANCE.createStatAndLogsSettings();
pro.getEmfProject().setStatAndLogsSettings(stats);
stats.setParameters(talendF.createParametersType());
ParametersType pType = stats.getParameters();
StatsAndLogsElement elem = new StatsAndLogsElement();
pro.setStatsAndLog(elem);
StatsAndLogsHelper.createStatsAndLogsParameters(elem);
ElementParameter2ParameterType.saveElementParameters(elem, pType);
}
Aggregations