Search in sources :

Example 1 with Feature

use of orgomg.cwm.objectmodel.core.Feature in project tdq-studio-se by Talend.

the class UpdateRelationalSwitch method caseForeignKey.

@Override
public Boolean caseForeignKey(ForeignKey object) {
    ColumnSet columnSet = (ColumnSet) object.eContainer();
    if (columnSet == null) {
        return Boolean.FALSE;
    }
    ForeignKey rightColumn = null;
    if (rightElement instanceof ForeignKey) {
        rightColumn = (ForeignKey) rightElement;
    } else {
        return Boolean.FALSE;
    }
    object.setName(rightColumn.getName());
    object.getFeature().clear();
    List<StructuralFeature> refColumns = new ArrayList<StructuralFeature>();
    for (StructuralFeature newColumn : rightColumn.getFeature()) {
        for (Feature column : columnSet.getFeature()) {
            if (column.getName().equalsIgnoreCase(newColumn.getName())) {
                refColumns.add((StructuralFeature) column);
                break;
            }
        }
    }
    object.getFeature().addAll(refColumns);
    return Boolean.TRUE;
}
Also used : StructuralFeature(orgomg.cwm.objectmodel.core.StructuralFeature) ArrayList(java.util.ArrayList) ColumnSet(orgomg.cwm.resource.relational.ColumnSet) ForeignKey(orgomg.cwm.resource.relational.ForeignKey) Feature(orgomg.cwm.objectmodel.core.Feature) StructuralFeature(orgomg.cwm.objectmodel.core.StructuralFeature)

Example 2 with Feature

use of orgomg.cwm.objectmodel.core.Feature in project tdq-studio-se by Talend.

the class TableViewComparisonLevel method resetTaggedValues.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.cwm.compare.factory.comparisonlevel.AbstractComparisonLevel#resetTaggedValues()
     */
@Override
protected void resetTaggedValues() throws ReloadCompareException {
    super.resetTaggedValues();
    if (PluginChecker.isTDQLoaded()) {
        ColumnSet selectedColumnSet = getCurrentColumnSet();
        ColumnSet oldColumnSet = DQStructureComparer.findMatchedColumnSet(selectedColumnSet, oldDataProvider);
        // reset table's taggedvalues "CONCEPT_NAME".
        TaggedValueHelper.setTaggedValue(oldColumnSet, TaggedValueHelper.CONCEPT_NAME, tmpConceptName);
        EList<Feature> oldFeatures = oldColumnSet.getFeature();
        for (Feature fea : oldFeatures) {
            // reset the column's tagged values "SEMATIC_NAME", "Content Type".
            String[] strings = tmpTaggedValuesMap.get(fea.getName());
            if (strings != null) {
                TaggedValueHelper.setTaggedValue(fea, TaggedValueHelper.SEMANTIC_NAME, strings[0]);
                TaggedValueHelper.setTaggedValue(fea, TaggedValueHelper.CONTENT_TYPE, strings[1]);
            }
        }
    }
}
Also used : ColumnSet(orgomg.cwm.resource.relational.ColumnSet) Feature(orgomg.cwm.objectmodel.core.Feature)

Example 3 with Feature

use of orgomg.cwm.objectmodel.core.Feature in project tdq-studio-se by Talend.

the class TableViewComparisonLevel method getSavedReloadObject.

@Override
protected EObject getSavedReloadObject() throws ReloadCompareException {
    ColumnSet selectedColumnSet = getCurrentColumnSet();
    ColumnSet toReloadcolumnSet = DQStructureComparer.findMatchedColumnSet(selectedColumnSet, tempReloadProvider);
    // ADD TDQ-11146 msjian: to save the TaggedValues before clear
    if (PluginChecker.isTDQLoaded()) {
        tmpConceptName = TaggedValueHelper.getValueString(TaggedValueHelper.CONCEPT_NAME, toReloadcolumnSet);
        EList<Feature> feature = toReloadcolumnSet.getFeature();
        tmpTaggedValuesMap = new HashMap<String, String[]>();
        for (Feature fea : feature) {
            String[] values = new String[] { StringUtils.EMPTY, StringUtils.EMPTY };
            values[0] = TaggedValueHelper.getValueString(TaggedValueHelper.SEMANTIC_NAME, fea);
            values[1] = TaggedValueHelper.getValueString(TaggedValueHelper.CONTENT_TYPE, fea);
            if (StringUtils.isNotBlank(values[0]) || StringUtils.isNotBlank(values[1])) {
                tmpTaggedValuesMap.put(fea.getName(), values);
            }
        }
    }
    // TDQ-11146~
    // MOD scorreia 2009-01-29 clear content of findMatchedColumnSet
    ColumnSetHelper.setColumns(toReloadcolumnSet, EMPTY_COLUMN_LIST);
    toReloadcolumnSet.getOwnedElement().clear();
    try {
        DqRepositoryViewService.getColumns(tempReloadProvider, toReloadcolumnSet, true);
        // MOD mzhao 2009-11-12 save to resoure after reload.
        util.saveResource(toReloadcolumnSet.eResource());
    } catch (Exception e1) {
        throw new ReloadCompareException(e1);
    }
    // ColumnSetHelper.setColumns(toReloadcolumnSet, columns);
    return toReloadcolumnSet;
}
Also used : ReloadCompareException(org.talend.cwm.compare.exception.ReloadCompareException) ColumnSet(orgomg.cwm.resource.relational.ColumnSet) Feature(orgomg.cwm.objectmodel.core.Feature) ReloadCompareException(org.talend.cwm.compare.exception.ReloadCompareException)

Aggregations

Feature (orgomg.cwm.objectmodel.core.Feature)3 ColumnSet (orgomg.cwm.resource.relational.ColumnSet)3 ArrayList (java.util.ArrayList)1 ReloadCompareException (org.talend.cwm.compare.exception.ReloadCompareException)1 StructuralFeature (orgomg.cwm.objectmodel.core.StructuralFeature)1 ForeignKey (orgomg.cwm.resource.relational.ForeignKey)1