Search in sources :

Example 1 with IProxyRepositoryService

use of org.talend.repository.model.IProxyRepositoryService in project tdi-studio-se by Talend.

the class NewProcessWizardPage method loadRepViewObjectWithOtherTypes.

@Override
protected List<IRepositoryViewObject> loadRepViewObjectWithOtherTypes() throws PersistenceException {
    List<IRepositoryViewObject> list = new ArrayList<IRepositoryViewObject>();
    // List for all other processes
    List<IRepositoryViewObject> processList = getAllProcessTypeObjectsWithoutCurrentType();
    if (processList != null && !processList.isEmpty()) {
        list.addAll(processList);
    }
    // List for routine
    if (ERepositoryObjectType.ROUTINES != null) {
        if (GlobalServiceRegister.getDefault().isServiceRegistered(IProxyRepositoryService.class)) {
            IProxyRepositoryService service = (IProxyRepositoryService) GlobalServiceRegister.getDefault().getService(IProxyRepositoryService.class);
            List<IRepositoryViewObject> mrList = service.getProxyRepositoryFactory().getAll(ERepositoryObjectType.ROUTINES, true, false);
            if (mrList != null && mrList.size() > 0) {
                list.addAll(mrList);
            }
        }
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IProxyRepositoryService(org.talend.repository.model.IProxyRepositoryService)

Example 2 with IProxyRepositoryService

use of org.talend.repository.model.IProxyRepositoryService in project tdi-studio-se by Talend.

the class JobletUtil method needReadOnlyJoblet.

public boolean needReadOnlyJoblet(JobletProcessItem jobletItem) {
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IEditorPart[] editors = page.getEditors();
    for (IEditorPart editor : editors) {
        if (editor instanceof AbstractMultiPageTalendEditor) {
            List<? extends INode> nodeList = ((AbstractMultiPageTalendEditor) editor).getProcess().getGraphicalNodes();
            for (INode node : nodeList) {
                if (((Node) node).isJoblet() && jobletItem.getProperty() != null) {
                    if (jobletItem.getProperty().getId().equals(node.getComponent().getProcess().getId())) {
                        boolean haveLock = jobletItem.getState().isLocked();
                        boolean isSvn = false;
                        ISVNProviderService service = null;
                        if (PluginChecker.isSVNProviderPluginLoaded()) {
                            service = (ISVNProviderService) GlobalServiceRegister.getDefault().getService(ISVNProviderService.class);
                        }
                        if (service != null && service.isProjectInSvnMode()) {
                            isSvn = service.isProjectInSvnMode();
                        }
                        if (isSvn) {
                            IProxyRepositoryService proxyService = (IProxyRepositoryService) GlobalServiceRegister.getDefault().getService(IProxyRepositoryService.class);
                            IProxyRepositoryFactory factory = proxyService.getProxyRepositoryFactory();
                            ERepositoryStatus repositoryStatus = factory.getStatus(jobletItem);
                            if (repositoryStatus == ERepositoryStatus.LOCK_BY_USER) {
                                haveLock = true;
                            }
                        }
                        if (haveLock) {
                            return true;
                        }
                    }
                }
            }
        }
    }
    return false;
}
Also used : INode(org.talend.core.model.process.INode) ERepositoryStatus(org.talend.commons.runtime.model.repository.ERepositoryStatus) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) IProxyRepositoryService(org.talend.repository.model.IProxyRepositoryService) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) ISVNProviderService(org.talend.core.services.ISVNProviderService) IEditorPart(org.eclipse.ui.IEditorPart) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 3 with IProxyRepositoryService

use of org.talend.repository.model.IProxyRepositoryService in project tdi-studio-se by Talend.

the class JobletUtil method lockByOthers.

// public void reloadJobletComponent(IProcess2 process){
// IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(
// IJobletProviderService.class);
// if (service != null) {
// process.get
// service.reloadJobletProcess(this);
// }
// }
public boolean lockByOthers(Item item) {
    IProxyRepositoryService service = (IProxyRepositoryService) GlobalServiceRegister.getDefault().getService(IProxyRepositoryService.class);
    IProxyRepositoryFactory factory = service.getProxyRepositoryFactory();
    ERepositoryStatus repositoryStatus = factory.getStatus(item);
    if (repositoryStatus == ERepositoryStatus.LOCK_BY_OTHER) {
        return true;
    }
    return false;
}
Also used : ERepositoryStatus(org.talend.commons.runtime.model.repository.ERepositoryStatus) IProxyRepositoryService(org.talend.repository.model.IProxyRepositoryService) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 4 with IProxyRepositoryService

use of org.talend.repository.model.IProxyRepositoryService in project tdi-studio-se by Talend.

the class GenericConnWizardPage method loadRepViewObjectWithSameType.

/**
     * Loads the repository view objects, which have the same repository type as the current job that are opened in
     * properties wizard dialog. Added by Marvin Wang on Feb 22, 2013.
     * 
     * @return
     * @throws PersistenceException
     */
private List<IRepositoryViewObject> loadRepViewObjectWithSameType() throws PersistenceException {
    List<IRepositoryViewObject> list = new ArrayList<IRepositoryViewObject>();
    ERepositoryObjectType type = ERepositoryObjectType.getType(((GenericConnectionItem) connectionItem).getTypeName());
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IProxyRepositoryService.class)) {
        IProxyRepositoryService service = (IProxyRepositoryService) GlobalServiceRegister.getDefault().getService(IProxyRepositoryService.class);
        list = service.getProxyRepositoryFactory().getAll(type, true, false);
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IProxyRepositoryService(org.talend.repository.model.IProxyRepositoryService) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType)

Aggregations

IProxyRepositoryService (org.talend.repository.model.IProxyRepositoryService)4 ArrayList (java.util.ArrayList)2 ERepositoryStatus (org.talend.commons.runtime.model.repository.ERepositoryStatus)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)2 IEditorPart (org.eclipse.ui.IEditorPart)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 INode (org.talend.core.model.process.INode)1 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)1 ISVNProviderService (org.talend.core.services.ISVNProviderService)1 AbstractMultiPageTalendEditor (org.talend.designer.core.ui.AbstractMultiPageTalendEditor)1