use of org.talend.core.model.process.ILookupMode in project tdi-studio-se by Talend.
the class XmlMapComponent method getHashConfiguration.
@Override
public IHashConfiguration getHashConfiguration(String connectionName) {
IHashConfiguration hashConfigurationForMapper = null;
XmlMapData externalData = (XmlMapData) getExternalEmfData();
List<InputXmlTree> inputTables = externalData.getInputTrees();
List<IHashableColumn> hashableColumns = new ArrayList<IHashableColumn>();
for (InputXmlTree inputTable : inputTables) {
if (inputTable.getName().equals(connectionName)) {
List<TreeNode> metadataTableEntries = inputTable.getNodes();
if (metadataTableEntries != null) {
int metadataTableEntriesListSize = metadataTableEntries.size();
for (int i = 0; i < metadataTableEntriesListSize; i++) {
TreeNode entry = metadataTableEntries.get(i);
if (entry.getExpression() != null && !entry.getExpression().trim().equals("")) {
//$NON-NLS-1$
hashableColumns.add(new HashableColumn(entry.getName(), i));
}
}
}
IMatchingMode matchingMode = MATCHING_MODE.parse(inputTable.getMatchingMode());
if (matchingMode == null) {
matchingMode = MATCHING_MODE.UNIQUE_MATCH;
}
ILookupMode lookupMode = org.talend.designer.xmlmap.model.tree.LOOKUP_MODE.parse(inputTable.getLookupMode());
if (lookupMode == null) {
lookupMode = org.talend.designer.xmlmap.model.tree.LOOKUP_MODE.LOAD_ONCE;
}
//$NON-NLS-1$
IElementParameter tempFolderElem = getElementParameter("TEMPORARY_DATA_DIRECTORY");
String tempFolder = null;
if (tempFolderElem != null) {
tempFolder = (String) tempFolderElem.getValue();
}
if (("").equals(tempFolder)) {
//$NON-NLS-1$ //$NON-NLS-2$
tempFolder = (String) this.getProcess().getElementParameter("COMP_DEFAULT_FILE_DIR").getValue() + "/temp";
tempFolder = TalendTextUtils.addQuotes(tempFolder);
}
//$NON-NLS-1$
IElementParameter rowsBufferSizeElem = getElementParameter("ROWS_BUFFER_SIZE");
String rowsBufferSize = null;
if (rowsBufferSizeElem != null) {
rowsBufferSize = (String) rowsBufferSizeElem.getValue();
}
hashConfigurationForMapper = new HashConfiguration(hashableColumns, matchingMode, inputTable.isPersistent(), tempFolder, rowsBufferSize);
break;
}
}
return hashConfigurationForMapper;
}
use of org.talend.core.model.process.ILookupMode in project tdi-studio-se by Talend.
the class MapperComponent method getHashConfiguration.
/*
* (non-Javadoc)
*
* @see org.talend.core.model.process.IHashableInputConnections#getHashConfiguration(java.lang.String)
*/
public IHashConfiguration getHashConfiguration(String connectionName) {
IHashConfiguration hashConfigurationForMapper = null;
ExternalMapperData externalData = (ExternalMapperData) getExternalData();
List<ExternalMapperTable> inputTables = externalData.getInputTables();
List<IHashableColumn> hashableColumns = new ArrayList<IHashableColumn>();
for (ExternalMapperTable inputTable : inputTables) {
if (inputTable.getName().equals(connectionName)) {
List<ExternalMapperTableEntry> metadataTableEntries = inputTable.getMetadataTableEntries();
if (metadataTableEntries != null) {
int metadataTableEntriesListSize = metadataTableEntries.size();
for (int i = 0; i < metadataTableEntriesListSize; i++) {
ExternalMapperTableEntry entry = metadataTableEntries.get(i);
if (entry.getExpression() != null && !entry.getExpression().trim().equals("")) {
//$NON-NLS-1$
hashableColumns.add(new HashableColumn(entry.getName(), i));
}
}
}
IMatchingMode matchingMode = MATCHING_MODE.parse(inputTable.getMatchingMode());
if (matchingMode == null) {
matchingMode = MATCHING_MODE.UNIQUE_MATCH;
}
ILookupMode lookupMode = LOOKUP_MODE.parse(inputTable.getLookupMode());
if (lookupMode == null) {
lookupMode = LOOKUP_MODE.LOAD_ONCE;
}
//$NON-NLS-1$
IElementParameter tempFolderElem = getElementParameter("TEMPORARY_DATA_DIRECTORY");
// modified by wzhang to fix 7824
String tempFolder = null;
if (tempFolderElem != null) {
tempFolder = (String) tempFolderElem.getValue();
}
if (("").equals(tempFolder)) {
//$NON-NLS-1$ //$NON-NLS-2$
tempFolder = (String) this.getProcess().getElementParameter("COMP_DEFAULT_FILE_DIR").getValue() + "/temp";
tempFolder = TalendTextUtils.addQuotes(tempFolder);
}
//$NON-NLS-1$
IElementParameter rowsBufferSizeElem = getElementParameter("ROWS_BUFFER_SIZE");
String rowsBufferSize = null;
if (rowsBufferSizeElem != null) {
rowsBufferSize = (String) rowsBufferSizeElem.getValue();
}
hashConfigurationForMapper = new HashConfiguration(hashableColumns, matchingMode, inputTable.isPersistent(), tempFolder, rowsBufferSize);
break;
}
}
return hashConfigurationForMapper;
}
Aggregations