Search in sources :

Example 1 with BuildJobHandler

use of org.talend.repository.ui.wizards.exportjob.handler.BuildJobHandler in project tdi-studio-se by Talend.

the class BuildJobFactory method createBuildJobHandler.

/**
     * Create the build job handler according the job export type. Now only implement the handler of standalone job.
     * <p>
     * DOC ycbai Comment method "createBuildJobHandler".
     * 
     * @param exportChoiceMap
     * @param contextName
     * @param jobExportType
     * @return
     */
public static IBuildJobHandler createBuildJobHandler(ProcessItem processItem, String contextName, String version, Map<ExportChoice, Object> exportChoiceMap, JobExportType jobExportType) {
    if (jobExportType != null)
        switch(jobExportType) {
            case POJO:
                // continue
                break;
            case WSWAR:
            case WSZIP:
            case // TODO, later, when osgi pom is finished, will try to enable it.
            OSGI:
                // don't support others
                return null;
            default:
                // try the first one by default
                jobExportType = null;
                break;
        }
    String buildType = null;
    if (jobExportType != null) {
        final String newType = oldBuildTypeMap.get(jobExportType);
        if (newType == null) {
            // not valid type
            return null;
        }
        buildType = newType;
    }
    IBuildJobHandler buildJobHandler = createBuildJobHandler(processItem, contextName, version, exportChoiceMap, buildType);
    if (buildJobHandler == null) {
        // default
        buildJobHandler = new BuildJobHandler(processItem, version, contextName, exportChoiceMap);
    }
    return buildJobHandler;
}
Also used : IBuildJobHandler(org.talend.core.runtime.process.IBuildJobHandler) BuildJobHandler(org.talend.repository.ui.wizards.exportjob.handler.BuildJobHandler) IBuildJobHandler(org.talend.core.runtime.process.IBuildJobHandler)

Example 2 with BuildJobHandler

use of org.talend.repository.ui.wizards.exportjob.handler.BuildJobHandler in project tdi-studio-se by Talend.

the class StandardJobStandaloneBuildProvider method createBuildExportHandler.

@Override
public IBuildExportHandler createBuildExportHandler(Map<String, Object> parameters) {
    if (parameters == null || parameters.isEmpty()) {
        return null;
    }
    final Object item = parameters.get(ITEM);
    if (item == null || !(item instanceof ProcessItem)) {
        return null;
    }
    final Object version = parameters.get(VERSION);
    if (version == null) {
        return null;
    }
    final Object contextGroup = parameters.get(CONTEXT_GROUP);
    if (contextGroup == null) {
        return null;
    }
    Object choiceOption = parameters.get(CHOICE_OPTION);
    if (choiceOption == null) {
        choiceOption = Collections.emptyMap();
    }
    if (!(choiceOption instanceof Map)) {
        return null;
    }
    IBuildJobHandler buildHandler = new BuildJobHandler((ProcessItem) item, version.toString(), contextGroup.toString(), (Map<ExportChoice, Object>) choiceOption);
    return buildHandler;
}
Also used : ProcessItem(org.talend.core.model.properties.ProcessItem) IBuildJobHandler(org.talend.core.runtime.process.IBuildJobHandler) BuildJobHandler(org.talend.repository.ui.wizards.exportjob.handler.BuildJobHandler) IBuildJobHandler(org.talend.core.runtime.process.IBuildJobHandler) ExportChoice(org.talend.repository.ui.wizards.exportjob.scriptsmanager.JobScriptsManager.ExportChoice) Map(java.util.Map)

Aggregations

IBuildJobHandler (org.talend.core.runtime.process.IBuildJobHandler)2 BuildJobHandler (org.talend.repository.ui.wizards.exportjob.handler.BuildJobHandler)2 Map (java.util.Map)1 ProcessItem (org.talend.core.model.properties.ProcessItem)1 ExportChoice (org.talend.repository.ui.wizards.exportjob.scriptsmanager.JobScriptsManager.ExportChoice)1