use of org.talend.mdm.repository.core.IRepositoryNodeConfiguration in project tmdm-studio-se by Talend.
the class RepositoryResourceUtil method getCategoryViewObjects.
public static IRepositoryViewObject[] getCategoryViewObjects() {
if (categoryViewObjects == null) {
List<IRepositoryNodeConfiguration> configurations = RepositoryNodeConfigurationManager.getConfigurations();
List<IRepositoryViewObject> results = new LinkedList<IRepositoryViewObject>();
for (IRepositoryNodeConfiguration conf : configurations) {
if (conf.getContentProvider().isShownInRoot()) {
IRepositoryViewObject categoryViewObject = getCategoryViewObject(conf);
if (categoryViewObject != null) {
results.add(categoryViewObject);
}
}
}
categoryViewObjects = results.toArray(new IRepositoryViewObject[0]);
}
return categoryViewObjects;
}
use of org.talend.mdm.repository.core.IRepositoryNodeConfiguration in project tmdm-studio-se by Talend.
the class EventManagerContentProvider method getViewObjFromSystemFolder.
@Override
protected List<IRepositoryViewObject> getViewObjFromSystemFolder(Item parentItem) {
if (result == null) {
result = new LinkedList<IRepositoryViewObject>();
IRepositoryNodeConfiguration processConf = RepositoryNodeConfigurationManager.getConfiguration(IServerObjectRepositoryType.TYPE_TRANSFORMERV2);
IRepositoryNodeConfiguration triggerConf = RepositoryNodeConfigurationManager.getConfiguration(IServerObjectRepositoryType.TYPE_ROUTINGRULE);
//
addCategoryViewObject(result, processConf);
addCategoryViewObject(result, triggerConf);
}
return result;
}
use of org.talend.mdm.repository.core.IRepositoryNodeConfiguration in project tmdm-studio-se by Talend.
the class RecycleBinLabelProvider method getImage.
@Override
public Image getImage(Object element) {
if (element instanceof IRepositoryViewObject) {
IRepositoryViewObject viewObj = (IRepositoryViewObject) element;
ERepositoryObjectType type = viewObj.getRepositoryObjectType();
if (type == IServerObjectRepositoryType.TYPE_RECYCLE_BIN) {
if (viewObj instanceof FolderRepositoryObject) {
return ((FolderRepositoryObject) viewObj).getChildren().isEmpty() ? EMPTY_IMG : FULL_IMG;
}
}
IRepositoryNodeConfiguration configuration = RepositoryNodeConfigurationManager.getConfiguration(type);
if (configuration != null) {
IRepositoryNodeLabelProvider labelProvider = configuration.getLabelProvider();
return labelProvider.getImage(element);
}
}
return null;
}
use of org.talend.mdm.repository.core.IRepositoryNodeConfiguration in project tmdm-studio-se by Talend.
the class MDMRepositoryContentProvider method getContentProvider.
private IRepositoryNodeContentProvider getContentProvider(Object element) {
if (element instanceof IRepositoryViewObject) {
Property property = ((IRepositoryViewObject) element).getProperty();
if (property != null) {
Item item = property.getItem();
IRepositoryNodeConfiguration conf = RepositoryNodeConfigurationManager.getConfiguration(item);
if (conf != null) {
return conf.getContentProvider();
}
}
}
return null;
}
use of org.talend.mdm.repository.core.IRepositoryNodeConfiguration in project tmdm-studio-se by Talend.
the class AbstractSimpleAddActionTest method setUp.
@Before
public void setUp() throws Exception {
ResourceBundle rb = mock(ResourceBundle.class);
// $NON-NLS-1$
stub(method(ResourceBundle.class, "getBundle", String.class)).toReturn(rb);
PowerMockito.mockStatic(JFaceResources.class);
ImageRegistry registry = mock(ImageRegistry.class);
when(JFaceResources.getImageRegistry()).thenReturn(registry);
PowerMockito.mockStatic(CoreRuntimePlugin.class);
CoreRuntimePlugin coreRuntimePlugin = mock(CoreRuntimePlugin.class);
when(CoreRuntimePlugin.getInstance()).thenReturn(coreRuntimePlugin);
IProxyRepositoryFactory repositoryFactory = mock(IProxyRepositoryFactory.class);
when(CoreRuntimePlugin.getInstance().getProxyRepositoryFactory()).thenReturn(repositoryFactory);
RepositoryContext ontextMock = mock(RepositoryContext.class);
when(repositoryFactory.getRepositoryContext()).thenReturn(ontextMock);
PowerMockito.mockStatic(ProjectManager.class);
ProjectManager pmMock = mock(ProjectManager.class);
Project pMock = mock(Project.class);
User userMock = mock(User.class);
// $NON-NLS-1$
when(userMock.getLogin()).thenReturn("a@b.cn");
when(pMock.getAuthor()).thenReturn(userMock);
when(pmMock.getCurrentProject()).thenReturn(pMock);
when(ProjectManager.getInstance()).thenReturn(pmMock);
when(ontextMock.getUser()).thenReturn(userMock);
IRepositoryResourceUtilExAdapter mockAdapter = PowerMockito.mock(IRepositoryResourceUtilExAdapter.class);
PowerMockito.mockStatic(ExAdapterManager.class);
PowerMockito.when(ExAdapterManager.getAdapter(new RepositoryResourceUtil(), IRepositoryResourceUtilExAdapter.class)).thenReturn(mockAdapter);
RecycleBinNodeConfiguration recycleBinNodeConfiguration = mock(RecycleBinNodeConfiguration.class);
PowerMockito.whenNew(RecycleBinNodeConfiguration.class).withNoArguments().thenReturn(recycleBinNodeConfiguration);
PowerMockito.mockStatic(ProxyRepositoryFactory.class);
ProxyRepositoryFactory proxyRepositoryFactory = mock(ProxyRepositoryFactory.class);
when(ProxyRepositoryFactory.getInstance()).thenReturn(proxyRepositoryFactory);
IRepositoryFactory repositoryFactoryMock = mock(IRepositoryFactory.class);
when(proxyRepositoryFactory.getRepositoryFactoryFromProvider()).thenReturn(repositoryFactoryMock);
XmiResourceManager xmiResourceManager = mock(XmiResourceManager.class);
when(repositoryFactoryMock.getResourceManager()).thenReturn(xmiResourceManager);
PowerMockito.mockStatic(RepositoryNodeConfigurationManager.class);
IRepositoryNodeConfiguration rncMock = mock(IRepositoryNodeConfiguration.class);
when(RepositoryNodeConfigurationManager.getConfiguration((Item) anyObject())).thenReturn(rncMock);
IRepositoryNodeResourceProvider resourceProviderM = mock(IRepositoryNodeResourceProvider.class);
when(rncMock.getResourceProvider()).thenReturn(resourceProviderM);
when(resourceProviderM.needSaveReferenceFile()).thenReturn(true);
when(repositoryFactory.isEditableAndLockIfPossible((Item) anyObject())).thenReturn(true);
}
Aggregations