use of org.talend.designer.core.model.utils.emf.talendfile.MetadataType in project tdi-studio-se by Talend.
the class MetadataEmfFactoryTest method testOriginalLengthValue.
@Test
public void testOriginalLengthValue() {
// OriginalLength of column is null.
IMetadataTable table = createTestTable();
factory.setMetadataTable(table);
MetadataType metadataType = factory.getMetadataType();
ColumnType col1 = (ColumnType) metadataType.getColumn().get(0);
assertEquals(-1, col1.getOriginalLength());
// OriginalLength of column is not null.
table = createTestTable();
table.getListColumns().get(0).setOriginalLength(10);
factory.setMetadataTable(table);
metadataType = factory.getMetadataType();
col1 = (ColumnType) metadataType.getColumn().get(0);
assertEquals(10, col1.getOriginalLength());
}
use of org.talend.designer.core.model.utils.emf.talendfile.MetadataType in project tdi-studio-se by Talend.
the class RenametStandardizePhoneNumberColumnName method changeCustomerColumn.
private void changeCustomerColumn(Item item) throws PersistenceException {
ProcessType processType = getProcessType(item);
if (processType == null) {
return;
}
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
boolean modified = false;
for (Object o : processType.getNode()) {
NodeType node = (NodeType) o;
if ("tStandardizePhoneNumber".equalsIgnoreCase(node.getComponentName())) {
for (Object o2 : node.getMetadata()) {
MetadataType metadata = (MetadataType) o2;
for (Object o3 : metadata.getColumn()) {
ColumnType column = (ColumnType) o3;
if ("IsPossiblePhoneNumber ".equals(column.getName())) {
column.setName("IsPossiblePhoneNumber");
modified = true;
break;
}
}
}
}
}
if (modified) {
factory.save(item, true);
}
}
use of org.talend.designer.core.model.utils.emf.talendfile.MetadataType in project tesb-studio-se by Talend.
the class FormContentTypeMigrationTask method changeDefaultFormContentType.
private void changeDefaultFormContentType(Item item) throws PersistenceException {
if (!(item instanceof ProcessItem)) {
return;
}
boolean needSave = false;
for (Object o : ((ProcessItem) item).getProcess().getNode()) {
if (!(o instanceof NodeType)) {
continue;
}
NodeType currentNode = (NodeType) o;
if ("tRESTRequest".equals(currentNode.getComponentName())) {
for (Object m : currentNode.getMetadata()) {
MetadataType metadataType = (MetadataType) m;
if ("WRONG_CALLS".equals(metadataType.getConnector())) {
continue;
}
needSave |= updateFormContentTypeOf(metadataType, currentNode);
}
// assume only one tRESTRequest inside
break;
}
}
if (needSave) {
FACTORY.save(item, true);
}
}
use of org.talend.designer.core.model.utils.emf.talendfile.MetadataType in project tesb-studio-se by Talend.
the class RestRequestWrongCallMigrationTask method addMoreWrongCallInfo.
private void addMoreWrongCallInfo(Item item) throws PersistenceException {
if (item instanceof ProcessItem) {
boolean needSave = false;
for (Object o : ((ProcessItem) item).getProcess().getNode()) {
if (o instanceof NodeType) {
NodeType currentNode = (NodeType) o;
if ("tRESTRequest".equals(currentNode.getComponentName())) {
Iterator iterator = currentNode.getMetadata().iterator();
while (iterator.hasNext()) {
MetadataType metadataType = (MetadataType) iterator.next();
if ("WRONG_CALLS".equals(metadataType.getConnector())) {
addColumn(metadataType.getColumn(), httpMethod);
needSave = true;
}
}
}
}
}
if (needSave) {
FACTORY.save(item, true);
}
}
}
Aggregations