Search in sources :

Example 1 with WSWhereOperatorE

use of org.talend.mdm.repository.model.mdmserverobject.WSWhereOperatorE in project tmdm-studio-se by Talend.

the class WSWhereConditionEImpl method basicSetOperator.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetOperator(WSWhereOperatorE newOperator, NotificationChain msgs) {
    WSWhereOperatorE oldOperator = operator;
    operator = newOperator;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MdmserverobjectPackage.WS_WHERE_CONDITION_E__OPERATOR, oldOperator, newOperator);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : WSWhereOperatorE(org.talend.mdm.repository.model.mdmserverobject.WSWhereOperatorE) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 2 with WSWhereOperatorE

use of org.talend.mdm.repository.model.mdmserverobject.WSWhereOperatorE in project tmdm-studio-se by Talend.

the class ViewOperatorUpdatorTest method test.

@Test
public void test() {
    WSViewItem wsViewItem = MdmpropertiesFactory.eINSTANCE.createWSViewItem();
    WSViewE wsViewE = MdmserverobjectFactory.eINSTANCE.createWSViewE();
    wsViewItem.setWsView(wsViewE);
    // $NON-NLS-1$
    String customAppend = "_Customed";
    String customContianOperator = WSWhereOperator.CONTAINS.name() + customAppend;
    WSWhereConditionE conditionA = MdmserverobjectFactory.eINSTANCE.createWSWhereConditionE();
    wsViewE.getWhereConditions().add(conditionA);
    WSWhereOperatorE operatorA = MdmserverobjectFactory.eINSTANCE.createWSWhereOperatorE();
    operatorA.setValue(customContianOperator);
    conditionA.setOperator(operatorA);
    WSWhereConditionE conditionB = MdmserverobjectFactory.eINSTANCE.createWSWhereConditionE();
    wsViewE.getWhereConditions().add(conditionB);
    WSWhereOperatorE operatorB = MdmserverobjectFactory.eINSTANCE.createWSWhereOperatorE();
    operatorB.setValue(WSWhereOperator.JOIN.name());
    conditionB.setOperator(operatorB);
    boolean updated = new ViewOperatorUpdator().updateConditionOperator(wsViewItem);
    assertTrue(updated);
    assertEquals(WSWhereOperator.CONTAINS.name(), operatorA.getValue());
    assertEquals(WSWhereOperator.JOIN.name(), operatorB.getValue());
}
Also used : WSWhereOperatorE(org.talend.mdm.repository.model.mdmserverobject.WSWhereOperatorE) WSViewItem(org.talend.mdm.repository.model.mdmproperties.WSViewItem) WSViewE(org.talend.mdm.repository.model.mdmserverobject.WSViewE) WSWhereConditionE(org.talend.mdm.repository.model.mdmserverobject.WSWhereConditionE) Test(org.junit.Test)

Example 3 with WSWhereOperatorE

use of org.talend.mdm.repository.model.mdmserverobject.WSWhereOperatorE in project tmdm-studio-se by Talend.

the class ViewOperatorUpdator method updateConditionOperator.

public boolean updateConditionOperator(Item item) {
    boolean modified = false;
    List<String> opers = getOperators();
    if (item != null && item instanceof WSViewItem) {
        WSViewItem viewItem = (WSViewItem) item;
        WSViewE wsView = viewItem.getWsView();
        EList<WSWhereConditionE> whereConditions = wsView.getWhereConditions();
        if (whereConditions != null) {
            for (WSWhereConditionE whereConditionE : whereConditions) {
                WSWhereOperatorE operator = whereConditionE.getOperator();
                if (!opers.contains(operator.getValue())) {
                    operator.setValue(WSWhereOperator.CONTAINS.name());
                    modified = true;
                }
            }
        }
    }
    return modified;
}
Also used : WSWhereOperatorE(org.talend.mdm.repository.model.mdmserverobject.WSWhereOperatorE) WSViewItem(org.talend.mdm.repository.model.mdmproperties.WSViewItem) WSViewE(org.talend.mdm.repository.model.mdmserverobject.WSViewE) WSWhereConditionE(org.talend.mdm.repository.model.mdmserverobject.WSWhereConditionE)

Aggregations

WSWhereOperatorE (org.talend.mdm.repository.model.mdmserverobject.WSWhereOperatorE)3 WSViewItem (org.talend.mdm.repository.model.mdmproperties.WSViewItem)2 WSViewE (org.talend.mdm.repository.model.mdmserverobject.WSViewE)2 WSWhereConditionE (org.talend.mdm.repository.model.mdmserverobject.WSWhereConditionE)2 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1 Test (org.junit.Test)1