Search in sources :

Example 1 with ProjectManager

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

the class MultipleThreadDynamicComposite method getAllRepositoryMetadata.

/**
     * 
     * cli Comment method "getAllRepositoryMetadata".
     * 
     * fixed for 8971
     */
private List<IRepositoryViewObject> getAllRepositoryMetadata() {
    IProxyRepositoryFactory factory = DesignerPlugin.getDefault().getProxyRepositoryFactory();
    ProjectManager pManager = ProjectManager.getInstance();
    // retrieve reference project.
    pManager.getReferencedProjects();
    List<IRepositoryViewObject> repositoryObjects;
    try {
        repositoryObjects = retrieveMetadataFromProject(factory, pManager, pManager.getCurrentProject());
    } catch (PersistenceException e) {
        throw new RuntimeException(e);
    }
    return repositoryObjects;
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory) ProjectManager(org.talend.repository.ProjectManager)

Example 2 with ProjectManager

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

the class JobJavaScriptsManager method getChildrenJobAndContextName.

protected void getChildrenJobAndContextName(ExportFileResource[] allResources, String rootName, List<JobInfo> list, ProcessItem process, String projectName, List<ProcessItem> processedJob, List<URL> allJobScripts, ExportFileResource resource, Map<ExportChoice, Object> exportChoice, String... selectedJobVersion) {
    if (processedJob.contains(process)) {
        // prevent circle
        return;
    }
    processedJob.add(process);
    ProjectManager projectManager = ProjectManager.getInstance();
    Project project = projectManager.getProject(process);
    String childProjectName = projectName;
    if (project != null) {
        // hywang modify for 7932
        childProjectName = project.getTechnicalLabel().toLowerCase();
    }
    allJobScripts.addAll(getJobScripts(childProjectName, process.getProperty().getLabel(), process.getProperty().getVersion(), isOptionChoosed(ExportChoice.needJobScript)));
    addContextScripts(process, process.getProperty().getLabel(), process.getProperty().getVersion(), resource, isOptionChoosed(ExportChoice.needContext));
    addJobItem(allResources, process, isOptionChoosed(ExportChoice.needJobItem), resource);
    addDependencies(allResources, process, isOptionChoosed(ExportChoice.needDependencies) && isOptionChoosed(ExportChoice.needJobItem), resource);
    addSourceCode(allResources, process, isOptionChoosed(ExportChoice.needSourceCode), resource);
    addDependenciesSourceCode(allResources, resource, isOptionChoosed(ExportChoice.needSourceCode));
    Set<JobInfo> subjobInfos = ProcessorUtilities.getChildrenJobInfo(process);
    for (JobInfo subjobInfo : subjobInfos) {
        if (list.contains(subjobInfo)) {
            continue;
        }
        list.add(subjobInfo);
        getChildrenJobAndContextName(allResources, rootName, list, subjobInfo.getProcessItem(), projectName, processedJob, allJobScripts, resource, exportChoice);
    }
}
Also used : IProject(org.eclipse.core.resources.IProject) Project(org.talend.core.model.properties.Project) IJavaProject(org.eclipse.jdt.core.IJavaProject) ITalendProcessJavaProject(org.talend.core.runtime.process.ITalendProcessJavaProject) JobInfo(org.talend.core.model.process.JobInfo) ProjectManager(org.talend.repository.ProjectManager)

Example 3 with ProjectManager

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

the class SetupProcessDependenciesRoutinesDialog method init.

@SuppressWarnings("unchecked")
private void init(ProcessType process) {
    allRoutineItems.clear();
    ProjectManager projectManager = ProjectManager.getInstance();
    Project currentProject = projectManager.getCurrentProject();
    initModels(currentProject);
    Set<Project> referenceProjects = new HashSet<Project>();
    this.getAllReferenceProjects(currentProject, referenceProjects);
    initRefProjects(referenceProjects);
    List<RoutinesParameterType> routinesDependencies = process.getParameters().getRoutinesParameter();
    List<String> typeNames = new ArrayList<String>();
    for (RoutinesParameterType type : routinesDependencies) {
        RoutineItemRecord record = new RoutineItemRecord();
        record.setName(type.getName());
        Property property = findObject(type.getId(), type.getName());
        if (property != null) {
            // if system, id is not used
            record.setId(property.getId());
            record.setLabel(property.getLabel());
        } else {
            record.setHasProblem(true);
            // use the record
            record.setLabel(type.getName());
        }
        if (!record.hasProblem()) {
            // if lost, willn't display
            if (((RoutineItem) property.getItem()).isBuiltIn()) {
                systemRoutines.add(record);
            } else {
                if (typeNames.contains(type.getName())) {
                    break;
                } else {
                    typeNames.add(type.getName());
                    userRoutines.add(record);
                }
            }
        }
    }
}
Also used : Project(org.talend.core.model.general.Project) RoutinesParameterType(org.talend.designer.core.model.utils.emf.talendfile.RoutinesParameterType) ArrayList(java.util.ArrayList) RoutineItem(org.talend.core.model.properties.RoutineItem) Property(org.talend.core.model.properties.Property) ProjectManager(org.talend.repository.ProjectManager) HashSet(java.util.HashSet)

Example 4 with ProjectManager

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

the class GenerateDocAsHTMLAction method init.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.repository.ui.actions.ITreeContextualAction#init(org.eclipse.jface.viewers.TreeViewer,
     * org.eclipse.jface.viewers.IStructuredSelection)
     */
@Override
public void init(TreeViewer viewer, IStructuredSelection selection) {
    ProjectManager instance = ProjectManager.getInstance();
    boolean canWork = false;
    List<RepositoryNode> nodes = selection.toList();
    for (RepositoryNode node : nodes) {
        if (ERepositoryObjectType.PROCESS_MR != null) {
            if (node.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.PROCESS_MR) {
                if (node.getObject() != null && instance.isInCurrentMainProject(node)) {
                    canWork = true;
                }
            }
        }
        Object contentType = node.getProperties(EProperties.CONTENT_TYPE);
        if (contentType == ERepositoryObjectType.PROCESS || contentType == ERepositoryObjectType.PROCESS_ROUTE) {
            if (node.getObject() != null && instance.isInCurrentMainProject(node)) {
                canWork = true;
            }
        }
        if (canWork && node.getObject() != null && ProxyRepositoryFactory.getInstance().getStatus(node.getObject()) == ERepositoryStatus.DELETED) {
            canWork = false;
            break;
        }
    }
    setEnabled(canWork);
}
Also used : RepositoryNode(org.talend.repository.model.RepositoryNode) ProjectManager(org.talend.repository.ProjectManager)

Example 5 with ProjectManager

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

the class MergeTosMetadataMigrationTask method getItemURI.

private URI getItemURI(Item item) {
    ProjectManager pManager = ProjectManager.getInstance();
    org.talend.core.model.general.Project project = new org.talend.core.model.general.Project(pManager.getProject(item));
    // referenced item
    if (project != null && !project.equals(pManager.getCurrentProject())) {
        String folder = ERepositoryObjectType.getFolderName(ERepositoryObjectType.getItemType(item));
        if (folder != null) {
            IPath path = new Path(project.getTechnicalLabel());
            path = path.append(folder);
            path = path.append(item.getState().getPath());
            Property property = item.getProperty();
            //$NON-NLS-1$ //$NON-NLS-2$
            String itemStr = property.getLabel() + "_" + property.getVersion() + "." + FileConstants.PROPERTIES_EXTENSION;
            path = path.append(itemStr);
            return URIHelper.convert(path);
        }
    }
    if (item.eResource() != null) {
        // be null
        return item.eResource().getURI();
    }
    return null;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) Property(org.talend.core.model.properties.Property) ProjectManager(org.talend.repository.ProjectManager)

Aggregations

ProjectManager (org.talend.repository.ProjectManager)9 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)3 ArrayList (java.util.ArrayList)2 IPath (org.eclipse.core.runtime.IPath)2 Path (org.eclipse.core.runtime.Path)2 PersistenceException (org.talend.commons.exception.PersistenceException)2 Project (org.talend.core.model.general.Project)2 Item (org.talend.core.model.properties.Item)2 Project (org.talend.core.model.properties.Project)2 Property (org.talend.core.model.properties.Property)2 RepositoryObject (org.talend.core.model.repository.RepositoryObject)2 ProxyRepositoryFactory (org.talend.core.repository.model.ProxyRepositoryFactory)2 RepositoryNode (org.talend.repository.model.RepositoryNode)2 File (java.io.File)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 IFile (org.eclipse.core.resources.IFile)1 IProject (org.eclipse.core.resources.IProject)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1