use of org.talend.mdm.repository.model.mdmproperties.WSTransformerV2Item in project tmdm-studio-se by Talend.
the class NewProcessAction method createServerObject.
protected Item createServerObject(WSTransformerV2E process) {
WSTransformerV2Item item = MdmpropertiesFactory.eINSTANCE.createWSTransformerV2Item();
ItemState itemState = PropertiesFactory.eINSTANCE.createItemState();
item.setState(itemState);
//
item.setWsTransformerV2(process);
if (parentItem != null) {
String path = rebuildItemPath(process.getName());
item.getState().setPath(path);
RepositoryResourceUtil.createItem(item, process.getName());
}
return item;
}
use of org.talend.mdm.repository.model.mdmproperties.WSTransformerV2Item in project tmdm-studio-se by Talend.
the class NewProcessAction method createServerObject.
@Override
protected Item createServerObject(String key) {
WSTransformerV2Item item = MdmpropertiesFactory.eINSTANCE.createWSTransformerV2Item();
ItemState itemState = PropertiesFactory.eINSTANCE.createItemState();
item.setState(itemState);
//
WSTransformerV2E process = newProcess(key);
item.setWsTransformerV2(process);
if (parentItem != null) {
item.getState().setPath(parentItem.getState().getPath());
RepositoryResourceUtil.createItem(item, key);
}
return item;
}
use of org.talend.mdm.repository.model.mdmproperties.WSTransformerV2Item in project tmdm-studio-se by Talend.
the class GenerateJobTransformerAction method AttachToProcessView.
/**
* DOC jsxie Comment method "AttachToProcessView".
*
* @param filename
* @param transformer
*/
private void AttachToProcessView(String filename, WSTransformerV2E transformer) {
WSTransformerV2Item item = MdmpropertiesFactory.eINSTANCE.createWSTransformerV2Item();
ItemState itemState = PropertiesFactory.eINSTANCE.createItemState();
item.setState(itemState);
item.setWsTransformerV2(transformer);
item.getState().setPath(IPath.SEPARATOR + ITransformerV2NodeConsDef.PATH_OTHER);
RepositoryResourceUtil.createItem(item, PREFIX + filename);
getCommonViewer().refresh();
}
use of org.talend.mdm.repository.model.mdmproperties.WSTransformerV2Item in project tmdm-studio-se by Talend.
the class TransformerV2NodeResourceProvider method save.
@Override
public Resource save(Item item) throws PersistenceException {
if (item instanceof WSTransformerV2Item) {
Resource resource = xmiResourceManager.getItemResource(item);
resource.getContents().clear();
resource.getContents().add(((WSTransformerV2Item) item).getWsTransformerV2());
Resource eResource = ((WSTransformerV2Item) item).getWsTransformerV2().eResource();
return resource;
}
return null;
}
use of org.talend.mdm.repository.model.mdmproperties.WSTransformerV2Item in project tmdm-studio-se by Talend.
the class NewProcessActionTest 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));
NewProcessAction action = new NewProcessAction();
NewProcessAction 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("");
WSTransformerV2Item item = MdmpropertiesFactory.eINSTANCE.createWSTransformerV2Item();
WSTransformerV2Item spyTransformerV2Item = spy(item);
Resource mockResource = mock(Resource.class);
ResourceSet mockResourceSet = mock(ResourceSet.class);
when(mockResource.getResourceSet()).thenReturn(mockResourceSet);
when(spyTransformerV2Item.eResource()).thenReturn(mockResource);
PowerMockito.whenNew(WSTransformerV2ItemImpl.class).withNoArguments().thenReturn((WSTransformerV2ItemImpl) spyTransformerV2Item);
// run
// $NON-NLS-1$
Item addedItem = spyAction.createServerObject("abc");
assertThat(addedItem, notNullValue());
}
Aggregations