Search in sources :

Example 1 with WSViewE

use of org.talend.mdm.repository.model.mdmserverobject.WSViewE 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 2 with WSViewE

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

the class WSViewItemImpl method setWsView.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setWsView(WSViewE newWsView) {
    WSViewE oldWsView = wsView;
    wsView = newWsView;
    if (eNotificationRequired()) {
        eNotify(new ENotificationImpl(this, Notification.SET, MdmpropertiesPackage.WS_VIEW_ITEM__WS_VIEW, oldWsView, wsView));
    }
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) WSViewE(org.talend.mdm.repository.model.mdmserverobject.WSViewE)

Example 3 with WSViewE

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

the class WSViewItemImpl method getWsView.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public WSViewE getWsView() {
    if (wsView != null && wsView.eIsProxy()) {
        InternalEObject oldWsView = (InternalEObject) wsView;
        wsView = (WSViewE) eResolveProxy(oldWsView);
        if (wsView.eResource() == null && eResource() != null) {
            URI uri = EcoreUtil.getURI(wsView);
            if (uri.hasFragment()) {
                uri = uri.trimFragment();
            }
            Resource resource = eResource().getResourceSet().getResource(uri, true);
            for (EObject object : resource.getContents()) {
                if (object instanceof WSViewE) {
                    wsView = (WSViewE) object;
                    break;
                }
            }
        }
        if (wsView != oldWsView) {
            if (eNotificationRequired()) {
                eNotify(new ENotificationImpl(this, Notification.RESOLVE, MdmpropertiesPackage.WS_VIEW_ITEM__WS_VIEW, oldWsView, wsView));
            }
        }
    }
    return wsView;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) EObject(org.eclipse.emf.ecore.EObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) Resource(org.eclipse.emf.ecore.resource.Resource) WSViewE(org.talend.mdm.repository.model.mdmserverobject.WSViewE) URI(org.eclipse.emf.common.util.URI) InternalEObject(org.eclipse.emf.ecore.InternalEObject)

Example 4 with WSViewE

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

the class BrowseViewAction method doRun.

@Override
protected void doRun() {
    Object obj = getSelectedObject().get(0);
    if (obj instanceof IRepositoryViewObject) {
        IRepositoryViewObject viewObject = (IRepositoryViewObject) obj;
        WSViewItem item = (WSViewItem) viewObject.getProperty().getItem();
        WSViewE wsView = item.getWsView();
        MDMServerDef lastServerDef = RepositoryResourceUtil.getLastServerDef(item);
        SelectServerDefDialog dlg = new SelectServerDefDialog(getShell());
        dlg.create();
        dlg.setSelectServer(lastServerDef);
        if (dlg.open() == IDialogConstants.OK_ID) {
            ViewBrowserInput input = new ViewBrowserInput(viewObject);
            input.setServerDef(dlg.getSelectedServerDef());
            if (page == null) {
                page = commonViewer.getCommonNavigator().getSite().getWorkbenchWindow().getActivePage();
            }
            try {
                IEditorPart oldEditor = page.findEditor(input);
                if (oldEditor != null) {
                    page.closeEditor(oldEditor, false);
                }
                page.openEditor(input, XObjectBrowser2.EDITOR_ID);
            } catch (PartInitException e) {
                log.error(e.getMessage(), e);
            }
        }
    }
}
Also used : WSViewItem(org.talend.mdm.repository.model.mdmproperties.WSViewItem) ViewBrowserInput(org.talend.mdm.repository.ui.editors.ViewBrowserInput) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) WSViewE(org.talend.mdm.repository.model.mdmserverobject.WSViewE) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 5 with WSViewE

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

the class NewViewAction method createServerObject.

@Override
protected Item createServerObject(String key) {
    WSViewItem item = MdmpropertiesFactory.eINSTANCE.createWSViewItem();
    ItemState itemState = PropertiesFactory.eINSTANCE.createItemState();
    item.setState(itemState);
    // 
    WSViewE view = newView(key);
    item.setWsView(view);
    int viewType = RepositoryTransformUtil.getInstance().getViewType(key);
    if (parentItem != null) {
        String path = parentItem.getState().getPath();
        if (path.isEmpty()) {
            if (viewType == TYPE_WEBFILTER) {
                path = IPath.SEPARATOR + PATH_WEBFILTER;
            } else {
                path = IPath.SEPARATOR + PATH_SEARCHFILTER;
            }
        }
        item.getState().setPath(path);
    } else {
        if (viewType == TYPE_WEBFILTER) {
            item.getState().setPath(IPath.SEPARATOR + PATH_WEBFILTER);
        } else {
            item.getState().setPath(IPath.SEPARATOR + PATH_SEARCHFILTER);
        }
    }
    RepositoryResourceUtil.createItem(item, key);
    return item;
}
Also used : WSViewItem(org.talend.mdm.repository.model.mdmproperties.WSViewItem) ItemState(org.talend.core.model.properties.ItemState) WSViewE(org.talend.mdm.repository.model.mdmserverobject.WSViewE) Point(org.eclipse.swt.graphics.Point)

Aggregations

WSViewE (org.talend.mdm.repository.model.mdmserverobject.WSViewE)8 WSViewItem (org.talend.mdm.repository.model.mdmproperties.WSViewItem)5 WSWhereConditionE (org.talend.mdm.repository.model.mdmserverobject.WSWhereConditionE)3 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 WSWhereOperatorE (org.talend.mdm.repository.model.mdmserverobject.WSWhereOperatorE)2 URI (org.eclipse.emf.common.util.URI)1 EObject (org.eclipse.emf.ecore.EObject)1 InternalEObject (org.eclipse.emf.ecore.InternalEObject)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 Point (org.eclipse.swt.graphics.Point)1 IEditorPart (org.eclipse.ui.IEditorPart)1 PartInitException (org.eclipse.ui.PartInitException)1 ValidationMessage (org.eclipse.wst.xml.core.internal.validation.core.ValidationMessage)1 Test (org.junit.Test)1 ItemState (org.talend.core.model.properties.ItemState)1 MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)1 WSBooleanE (org.talend.mdm.repository.model.mdmserverobject.WSBooleanE)1 ViewBrowserInput (org.talend.mdm.repository.ui.editors.ViewBrowserInput)1 SelectServerDefDialog (org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog)1