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());
}
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));
}
}
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;
}
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);
}
}
}
}
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;
}
Aggregations