Search in sources :

Example 36 with ParametersType

use of org.talend.designer.core.model.utils.emf.talendfile.ParametersType in project tdi-studio-se by Talend.

the class ProjectSettingManager method saveStatsAndLogToProjectSettings.

public static void saveStatsAndLogToProjectSettings(Element process, Project pro) {
    createStatsAndLogsElement(pro);
    ParametersType stats = pro.getEmfProject().getStatAndLogsSettings().getParameters();
    // load the project settings to process
    ElementParameter2ParameterType.saveElementParameters(process, stats);
    saveProject();
}
Also used : ParametersType(org.talend.designer.core.model.utils.emf.talendfile.ParametersType)

Example 37 with ParametersType

use of org.talend.designer.core.model.utils.emf.talendfile.ParametersType in project tdi-studio-se by Talend.

the class HTMLDocGenerator method generateJobSettingInfo.

/**
     * DOC qwei Comment method "hideSourcecodePassword".
     */
// private void hidePasswordInSourceCode4Doc(IProcess process) {
// List<? extends IElementParameter> processParam = process.getElementParameters();
// for (IElementParameter elementParameter : processParam) {
// elementParameter.setValue(ParameterValueUtil.getValue4Doc(elementParameter));
// }
// List<? extends INode> nodes = process.getGraphicalNodes();
// for (INode node : nodes) {
// List<? extends IElementParameter> nodeParamList = node.getElementParameters();
// for (IElementParameter nodeParam : nodeParamList) {
// nodeParam.setValue(ParameterValueUtil.getValue4Doc(nodeParam));
// }
// }
// }
/**
     * DOC YeXiaowei Comment method "genereateJobSettingInfo".
     * 
     * @return
     */
private void generateJobSettingInfo(final Item item, final Element element) {
    //$NON-NLS-1$
    Element jobSettingInfoElement = DocumentHelper.createElement("jobSetting");
    ParametersType jobDirectParams = null;
    if (item instanceof ProcessItem) {
        jobDirectParams = ((ProcessItem) item).getProcess().getParameters();
    } else if (item instanceof JobletProcessItem) {
        jobDirectParams = ((JobletProcessItem) item).getJobletProcess().getParameters();
    }
    if (jobDirectParams == null || jobDirectParams.getElementParameter() == null || jobDirectParams.getElementParameter().isEmpty()) {
        return;
    }
    EList params = jobDirectParams.getElementParameter();
    Map<String, String> nameValueMap = new HashMap<String, String>();
    for (int i = 0; i < params.size(); i++) {
        ElementParameterType param = (ElementParameterType) params.get(i);
        nameValueMap.put(param.getName(), ParameterValueUtil.getValue4Doc(param));
    }
    // Main settinparam info
    // Extra setting
    //$NON-NLS-1$
    Element extraElement = DocumentHelper.createElement("extra");
    jobSettingInfoElement.add(extraElement);
    if (item instanceof JobletProcessItem) {
        createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.STARTABLE);
        element.add(jobSettingInfoElement);
        return;
    }
    createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.COMP_DEFAULT_FILE_DIR);
    createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.MULTI_THREAD_EXECATION);
    createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.IMPLICIT_TCONTEXTLOAD);
    if (StringUtils.equals(nameValueMap.get(IJobSettingConstants.IMPLICIT_TCONTEXTLOAD), "true")) {
        if (StringUtils.equals(nameValueMap.get(IJobSettingConstants.FROM_FILE_FLAG_IMPLICIT_CONTEXT), "true")) {
            //$NON-NLS-1$
            createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.FROM_FILE_FLAG_IMPLICIT_CONTEXT);
            createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.IMPLICIT_TCONTEXTLOAD_FILE);
        }
        if (StringUtils.equals(nameValueMap.get(IJobSettingConstants.FROM_DATABASE_FLAG_IMPLICIT_CONTEXT), "true")) {
            //$NON-NLS-1$
            createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.FROM_DATABASE_FLAG_IMPLICIT_CONTEXT);
            // some params about databse setting
            createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.PROPERTY_TYPE_IMPLICIT_CONTEXT_PROPERTY_TYPE);
            if (!StringUtils.equalsIgnoreCase(nameValueMap.get(IJobSettingConstants.PROPERTY_TYPE_IMPLICIT_CONTEXT_PROPERTY_TYPE), "built_in")) {
                //$NON-NLS-1$
                restConnectionLabelById(nameValueMap, IJobSettingConstants.PROPERTY_TYPE_IMPLICIT_CONTEXT_REPOSITORY_PROPERTY_TYPE);
                createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.PROPERTY_TYPE_IMPLICIT_CONTEXT_REPOSITORY_PROPERTY_TYPE);
            }
            createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.DB_TYPE_IMPLICIT_CONTEXT);
            createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.HOST_IMPLICIT_CONTEXT);
            createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.PORT_IMPLICIT_CONTEXT);
            createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.DBNAME_IMPLICIT_CONTEXT);
            createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.SCHEMA_DB_IMPLICIT_CONTEXT);
            createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.USER_IMPLICIT_CONTEXT);
            createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.PASS_IMPLICIT_CONTEXT);
            createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.DBFILE_IMPLICIT_CONTEXT);
            createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.DBTABLE_IMPLICIT_CONTEXT);
            createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.QUERY_CONDITION_IMPLICIT_CONTEXT);
        }
        // print operation
        createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.PRINT_OPERATIONS);
        // diable warnings
        createSingleJobParameter(extraElement, nameValueMap, IJobSettingConstants.DISABLE_WARNINGS);
    }
    // Stats & logs setting
    //$NON-NLS-1$
    Element statsAndLotsElement = DocumentHelper.createElement("Statslogs");
    jobSettingInfoElement.add(statsAndLotsElement);
    createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.ON_STATCATCHER_FLAG);
    createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.ON_LOGCATCHER_FLAG);
    createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.ON_METERCATCHER_FLAG);
    createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.ON_CONSOLE_FLAG);
    createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.ON_FILES_FLAG);
    if (StringUtils.equals(nameValueMap.get(IJobSettingConstants.ON_FILES_FLAG), "true")) {
        //$NON-NLS-1$
        // add on file details
        createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.FILE_PATH);
        createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.FILENAME_LOGS);
        createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.FILENAME_METTER);
        createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.FILENAME_STATS);
    }
    createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.ON_DATABASE_FLAG);
    if (StringUtils.equals(nameValueMap.get(IJobSettingConstants.ON_DATABASE_FLAG), "true")) {
        //$NON-NLS-1$
        // add on database details
        createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.PROPERTY_TYPE);
        createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.PROPERTY_TYPE_PROPERTY_TYPE);
        if (!StringUtils.equalsIgnoreCase(nameValueMap.get(IJobSettingConstants.PROPERTY_TYPE_PROPERTY_TYPE), "built_in")) {
            //$NON-NLS-1$
            restConnectionLabelById(nameValueMap, IJobSettingConstants.PROPERTY_TYPE_REPOSITORY_PROPERTY_TYPE);
            createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.PROPERTY_TYPE_REPOSITORY_PROPERTY_TYPE);
        }
        createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.DB_TYPE);
        createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.HOST);
        createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.PORT);
        createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.DBNAME);
        createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.PROPERTIES);
        createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.SCHEMA_DB);
        createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.USER);
        createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.PASS);
        createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.DBFILE);
        createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.TABLE_LOGS);
        createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.TABLE_METER);
        createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.TABLE_STATS);
    }
    createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.CATCH_REALTIME_STATS);
    createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.CATCH_RUNTIME_ERRORS);
    createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.CATCH_USER_ERRORS);
    createSingleJobParameter(statsAndLotsElement, nameValueMap, IJobSettingConstants.CATCH_USER_WARNING);
    // verson setting see job info
    element.add(jobSettingInfoElement);
}
Also used : ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType) EList(org.eclipse.emf.common.util.EList) JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) ProcessItem(org.talend.core.model.properties.ProcessItem) JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) HashMap(java.util.HashMap) Element(org.dom4j.Element) ParametersType(org.talend.designer.core.model.utils.emf.talendfile.ParametersType) Point(org.eclipse.draw2d.geometry.Point)

Aggregations

ParametersType (org.talend.designer.core.model.utils.emf.talendfile.ParametersType)37 ElementParameterType (org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType)15 ProcessItem (org.talend.core.model.properties.ProcessItem)14 PersistenceException (org.talend.commons.exception.PersistenceException)13 ProcessType (org.talend.designer.core.model.utils.emf.talendfile.ProcessType)10 EList (org.eclipse.emf.common.util.EList)9 List (java.util.List)8 ProxyRepositoryFactory (org.talend.core.repository.model.ProxyRepositoryFactory)8 RoutinesParameterType (org.talend.designer.core.model.utils.emf.talendfile.RoutinesParameterType)7 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)7 ImplicitContextSettings (org.talend.core.model.properties.ImplicitContextSettings)6 Property (org.talend.core.model.properties.Property)6 StatAndLogsSettings (org.talend.core.model.properties.StatAndLogsSettings)6 ElementParameterTypeImpl (org.talend.designer.core.model.utils.emf.talendfile.impl.ElementParameterTypeImpl)5 JobletProcessItem (org.talend.core.model.properties.JobletProcessItem)4 ArrayList (java.util.ArrayList)3 Path (org.eclipse.core.runtime.Path)3 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)3 IPath (org.eclipse.core.runtime.IPath)2 Element (org.talend.core.model.process.Element)2