use of org.talend.mdm.repository.model.mdmproperties.WSRoutingRuleItem in project tmdm-studio-se by Talend.
the class NewTriggerAction method createServerObject.
@Override
protected Item createServerObject(String key) {
WSRoutingRuleItem item = MdmpropertiesFactory.eINSTANCE.createWSRoutingRuleItem();
ItemState itemState = PropertiesFactory.eINSTANCE.createItemState();
item.setState(itemState);
WSRoutingRuleE routingRule = newRoutingRule(key);
item.setWsRoutingRule(routingRule);
if (parentItem != null) {
item.getState().setPath(parentItem.getState().getPath());
RepositoryResourceUtil.createItem(item, key);
}
return item;
}
use of org.talend.mdm.repository.model.mdmproperties.WSRoutingRuleItem in project tmdm-studio-se by Talend.
the class GenerateJobTriggerAction method AttachToTriggerView.
/**
* DOC jsxie Comment method "AttachToTriggerView".
*
* @param filename
* @param trigger
*/
private void AttachToTriggerView(String filename, WSRoutingRuleE trigger) {
WSRoutingRuleItem item = MdmpropertiesFactory.eINSTANCE.createWSRoutingRuleItem();
ItemState itemState = PropertiesFactory.eINSTANCE.createItemState();
item.setState(itemState);
item.setWsRoutingRule(trigger);
// $NON-NLS-1$
item.getState().setPath("");
RepositoryResourceUtil.createItem(item, PREFIX + filename);
getCommonViewer().refresh();
}
use of org.talend.mdm.repository.model.mdmproperties.WSRoutingRuleItem in project tmdm-studio-se by Talend.
the class NewTriggerActionTest method testCreateServerObject.
@Test
public void testCreateServerObject() throws Exception {
//
ContainerItem newItem = MdmpropertiesFactory.eINSTANCE.createContainerItem();
ContainerItem mockContainerItem = spy(newItem);
PowerMockito.mockStatic(MDMWorbenchPlugin.class);
when(MDMWorbenchPlugin.getImageDescriptor(anyString())).thenReturn(mock(ImageDescriptor.class));
NewTriggerAction action = new NewTriggerAction();
NewTriggerAction spyAction = spy(action);
// $NON-NLS-1$
Whitebox.setInternalState(spyAction, "parentItem", mockContainerItem);
ItemState itemState = mock(ItemState.class);
when(mockContainerItem.getState()).thenReturn(itemState);
// $NON-NLS-1$
when(mockContainerItem.getState().getPath()).thenReturn("");
WSRoutingRuleItem item = MdmpropertiesFactory.eINSTANCE.createWSRoutingRuleItem();
WSRoutingRuleItem spyRoutingRuleItem = spy(item);
Resource mockResource = mock(Resource.class);
ResourceSet mockResourceSet = mock(ResourceSet.class);
when(mockResource.getResourceSet()).thenReturn(mockResourceSet);
when(spyRoutingRuleItem.eResource()).thenReturn(mockResource);
PowerMockito.whenNew(WSRoutingRuleItemImpl.class).withNoArguments().thenReturn((WSRoutingRuleItemImpl) spyRoutingRuleItem);
// run
// $NON-NLS-1$
Item addedItem = spyAction.createServerObject("abc");
assertThat(addedItem, notNullValue());
}
use of org.talend.mdm.repository.model.mdmproperties.WSRoutingRuleItem in project tmdm-studio-se by Talend.
the class RoutingRuleNodeResourceProvider method save.
@Override
public Resource save(Item item) throws PersistenceException {
if (item instanceof WSRoutingRuleItem) {
Resource resource = xmiResourceManager.getItemResource(item);
resource.getContents().clear();
resource.getContents().add(((WSRoutingRuleItem) item).getWsRoutingRule());
Resource eResource = ((WSRoutingRuleItem) item).getWsRoutingRule().eResource();
return resource;
}
return null;
}
use of org.talend.mdm.repository.model.mdmproperties.WSRoutingRuleItem in project tmdm-studio-se by Talend.
the class TriggerDecorator method decorate.
public void decorate(Object element, IDecoration decoration) {
IRepositoryViewObject viewObj = (IRepositoryViewObject) element;
Item item = RepositoryResourceUtil.getItemFromRepViewObj(viewObj);
if (item != null && item instanceof WSRoutingRuleItem) {
WSRoutingRuleE routing = ((WSRoutingRuleItem) item).getWsRoutingRule();
if (routing.isDeactive()) {
decoration.addOverlay(IMG_TRIGGER_DEACTIVE, IDecoration.BOTTOM_LEFT);
}
}
}
Aggregations