Search in sources :

Example 51 with RepositoryContext

use of org.talend.core.context.RepositoryContext in project tmdm-studio-se by Talend.

the class AbstractBridgeLabelProvider method isEditableAsReadOnly.

private void isEditableAsReadOnly() {
    Context ctx = CoreRuntimePlugin.getInstance().getContext();
    RepositoryContext rc = (RepositoryContext) ctx.getProperty(Context.REPOSITORY_CONTEXT_KEY);
    this.editableAsReadOnly = rc.isEditableAsReadOnly();
}
Also used : Context(org.talend.core.context.Context) RepositoryContext(org.talend.core.context.RepositoryContext) RepositoryContext(org.talend.core.context.RepositoryContext)

Example 52 with RepositoryContext

use of org.talend.core.context.RepositoryContext in project tmdm-studio-se by Talend.

the class ServerDefService method createServerDef.

public static String createServerDef(MDMServerDef serverDef) {
    IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
    RepositoryContext context = factory.getRepositoryContext();
    MDMServerDefItem item = MdmpropertiesFactory.eINSTANCE.createMDMServerDefItem();
    item.setServerDef(serverDef);
    Property prop = PropertiesFactory.eINSTANCE.createProperty();
    item.setProperty(prop);
    try {
        String nextId = factory.getNextId();
        Property property = item.getProperty();
        property.setId(nextId);
        property.setVersion(VersionUtils.DEFAULT_VERSION);
        property.setAuthor(context.getUser());
        property.setLabel(item.getServerDef().getName());
        // $NON-NLS-1$
        factory.create(item, new Path(""));
        return nextId;
    } catch (PersistenceException e) {
        log.error(e.getMessage(), e);
    }
    return null;
}
Also used : Path(org.eclipse.core.runtime.Path) RepositoryContext(org.talend.core.context.RepositoryContext) MDMServerDefItem(org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem) PersistenceException(org.talend.commons.exception.PersistenceException) Property(org.talend.core.model.properties.Property) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 53 with RepositoryContext

use of org.talend.core.context.RepositoryContext in project tesb-studio-se by Talend.

the class CreateMavenBundlePom method getProcessor.

public static IProcessor getProcessor(JobInfo jobInfo) {
    if (jobInfo.getProcessor() != null) {
        return jobInfo.getProcessor();
    }
    IProcess process = null;
    ProcessItem processItem;
    processItem = jobInfo.getProcessItem();
    if (processItem == null && jobInfo.getJobVersion() == null) {
        processItem = ItemCacheManager.getProcessItem(jobInfo.getJobId());
    }
    if (processItem == null && jobInfo.getJobVersion() != null) {
        processItem = ItemCacheManager.getProcessItem(jobInfo.getJobId(), jobInfo.getJobVersion());
    }
    if (processItem == null && jobInfo.getProcess() == null) {
        return null;
    }
    if (jobInfo.getProcess() == null) {
        if (processItem != null) {
            IDesignerCoreService service = CorePlugin.getDefault().getDesignerCoreService();
            process = service.getProcessFromProcessItem(processItem);
            if (process instanceof IProcess2) {
                ((IProcess2) process).setProperty(processItem.getProperty());
            }
        }
        if (process == null) {
            return null;
        }
    } else {
        process = jobInfo.getProcess();
    }
    Property curProperty = processItem.getProperty();
    if (processItem.getProperty() == null && process instanceof IProcess2) {
        curProperty = ((IProcess2) process).getProperty();
    }
    IRunProcessService service = CorePlugin.getDefault().getRunProcessService();
    IProcessor processor = service.createCodeProcessor(process, curProperty, ((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getProject().getLanguage(), true);
    jobInfo.setProcessor(processor);
    return processor;
}
Also used : RepositoryContext(org.talend.core.context.RepositoryContext) ProcessItem(org.talend.core.model.properties.ProcessItem) IRunProcessService(org.talend.designer.runprocess.IRunProcessService) IProcess2(org.talend.core.model.process.IProcess2) IDesignerCoreService(org.talend.designer.core.IDesignerCoreService) IProcessor(org.talend.designer.runprocess.IProcessor) IProcess(org.talend.core.model.process.IProcess) ActivationProperty(org.apache.maven.model.ActivationProperty) Property(org.talend.core.model.properties.Property)

Aggregations

RepositoryContext (org.talend.core.context.RepositoryContext)53 Context (org.talend.core.context.Context)28 Project (org.talend.core.model.general.Project)18 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)14 PersistenceException (org.talend.commons.exception.PersistenceException)11 User (org.talend.core.model.properties.User)8 ProxyRepositoryFactory (org.talend.core.repository.model.ProxyRepositoryFactory)7 IProject (org.eclipse.core.resources.IProject)6 AnalysisContext (org.talend.dataquality.analysis.AnalysisContext)6 ECodeLanguage (org.talend.core.language.ECodeLanguage)5 IRepositoryFactory (org.talend.core.repository.model.IRepositoryFactory)5 IRepositoryNodeConfiguration (org.talend.mdm.repository.core.IRepositoryNodeConfiguration)5 IRepositoryNodeResourceProvider (org.talend.mdm.repository.core.IRepositoryNodeResourceProvider)5 Property (org.talend.core.model.properties.Property)4 RecycleBinNodeConfiguration (org.talend.mdm.repository.core.impl.recyclebin.RecycleBinNodeConfiguration)4 File (java.io.File)3 IOException (java.io.IOException)3 ResourceBundle (java.util.ResourceBundle)3 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)3 ImageRegistry (org.eclipse.jface.resource.ImageRegistry)3