Search in sources :

Example 6 with IRepositoryNodeConfiguration

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;
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryNodeConfiguration(org.talend.mdm.repository.core.IRepositoryNodeConfiguration) LinkedList(java.util.LinkedList)

Example 7 with IRepositoryNodeConfiguration

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;
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryNodeConfiguration(org.talend.mdm.repository.core.IRepositoryNodeConfiguration)

Example 8 with IRepositoryNodeConfiguration

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;
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryNodeConfiguration(org.talend.mdm.repository.core.IRepositoryNodeConfiguration) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) IRepositoryNodeLabelProvider(org.talend.mdm.repository.core.IRepositoryNodeLabelProvider) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject)

Example 9 with IRepositoryNodeConfiguration

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;
}
Also used : Item(org.talend.core.model.properties.Item) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryNodeConfiguration(org.talend.mdm.repository.core.IRepositoryNodeConfiguration) Property(org.talend.core.model.properties.Property)

Example 10 with IRepositoryNodeConfiguration

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);
}
Also used : RepositoryContext(org.talend.core.context.RepositoryContext) IRepositoryFactory(org.talend.core.repository.model.IRepositoryFactory) User(org.talend.core.model.properties.User) RecycleBinNodeConfiguration(org.talend.mdm.repository.core.impl.recyclebin.RecycleBinNodeConfiguration) IRepositoryResourceUtilExAdapter(org.talend.mdm.repository.utils.IRepositoryResourceUtilExAdapter) XmiResourceManager(org.talend.core.repository.utils.XmiResourceManager) ProjectManager(org.talend.repository.ProjectManager) Project(org.talend.core.model.general.Project) ImageRegistry(org.eclipse.jface.resource.ImageRegistry) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory) ProxyRepositoryFactory(org.talend.core.repository.model.ProxyRepositoryFactory) IRepositoryNodeResourceProvider(org.talend.mdm.repository.core.IRepositoryNodeResourceProvider) IRepositoryNodeConfiguration(org.talend.mdm.repository.core.IRepositoryNodeConfiguration) ResourceBundle(java.util.ResourceBundle) RepositoryResourceUtil(org.talend.mdm.repository.utils.RepositoryResourceUtil) CoreRuntimePlugin(org.talend.core.runtime.CoreRuntimePlugin) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory) Before(org.junit.Before)

Aggregations

IRepositoryNodeConfiguration (org.talend.mdm.repository.core.IRepositoryNodeConfiguration)24 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)13 IRepositoryNodeResourceProvider (org.talend.mdm.repository.core.IRepositoryNodeResourceProvider)9 Item (org.talend.core.model.properties.Item)8 ContainerItem (org.talend.mdm.repository.model.mdmproperties.ContainerItem)8 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)8 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)6 RepositoryContext (org.talend.core.context.RepositoryContext)5 RecycleBinNodeConfiguration (org.talend.mdm.repository.core.impl.recyclebin.RecycleBinNodeConfiguration)5 PersistenceException (org.talend.commons.exception.PersistenceException)4 Property (org.talend.core.model.properties.Property)4 User (org.talend.core.model.properties.User)4 ResourceBundle (java.util.ResourceBundle)3 ImageRegistry (org.eclipse.jface.resource.ImageRegistry)3 Before (org.junit.Before)3 Test (org.junit.Test)3 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)3 LoginException (org.talend.commons.exception.LoginException)3 Project (org.talend.core.model.general.Project)3 IRepositoryFactory (org.talend.core.repository.model.IRepositoryFactory)3