Search in sources :

Example 1 with ProcessTypeImpl

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

the class ExportJobUtil method getJobContexts.

/**
     * 
     * Gets the set of current job's context.
     * 
     * @return a List of context names.
     * 
     */
public static List<String> getJobContexts(ProcessItem processItem) {
    List<String> contextNameList = new ArrayList<String>();
    for (Object o : ((ProcessTypeImpl) processItem.getProcess()).getContext()) {
        if (o instanceof ContextType) {
            ContextType context = (ContextType) o;
            if (contextNameList.contains(context.getName())) {
                continue;
            }
            contextNameList.add(context.getName());
        }
    }
    return contextNameList;
}
Also used : ContextType(org.talend.designer.core.model.utils.emf.talendfile.ContextType) ArrayList(java.util.ArrayList) ProcessTypeImpl(org.talend.designer.core.model.utils.emf.talendfile.impl.ProcessTypeImpl)

Example 2 with ProcessTypeImpl

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

the class JobJavaScriptsManager method getJobContextsComboValue.

@Override
public List<String> getJobContextsComboValue(ProcessItem processItem) {
    List<String> contextNameList = new ArrayList<String>();
    for (Object o : ((ProcessTypeImpl) processItem.getProcess()).getContext()) {
        if (o instanceof ContextType) {
            ContextType context = (ContextType) o;
            if (contextNameList.contains(context.getName())) {
                continue;
            }
            contextNameList.add(context.getName());
        }
    }
    return contextNameList;
}
Also used : ContextType(org.talend.designer.core.model.utils.emf.talendfile.ContextType) ArrayList(java.util.ArrayList) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ProcessTypeImpl(org.talend.designer.core.model.utils.emf.talendfile.impl.ProcessTypeImpl)

Example 3 with ProcessTypeImpl

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

the class ExportJobUtil method getJobContextValues.

/**
     * DOC zli Comment method "getJobContextValues".
     * 
     * @param processItem
     * @param contextName
     * @return
     */
@SuppressWarnings("rawtypes")
public static List<ContextParameterType> getJobContextValues(ProcessItem processItem, String contextName) {
    if (contextName == null) {
        return null;
    }
    // else do next line
    List<ContextParameterType> list = new ArrayList<ContextParameterType>();
    EList contexts = ((ProcessTypeImpl) processItem.getProcess()).getContext();
    for (int i = 0; i < contexts.size(); i++) {
        Object object = contexts.get(i);
        if (object instanceof ContextType) {
            ContextType contextType = (ContextType) object;
            if (contextName.equals(contextType.getName())) {
                EList contextParameter = contextType.getContextParameter();
                for (int j = 0; j < contextParameter.size(); j++) {
                    Object object2 = contextParameter.get(j);
                    if (object2 instanceof ContextParameterType) {
                        ContextParameterType contextParameterType = (ContextParameterType) object2;
                        list.add(contextParameterType);
                    }
                }
                return list;
            }
        }
    }
    return null;
}
Also used : ContextType(org.talend.designer.core.model.utils.emf.talendfile.ContextType) EList(org.eclipse.emf.common.util.EList) ArrayList(java.util.ArrayList) ProcessTypeImpl(org.talend.designer.core.model.utils.emf.talendfile.impl.ProcessTypeImpl) ContextParameterType(org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType)

Aggregations

ArrayList (java.util.ArrayList)3 ContextType (org.talend.designer.core.model.utils.emf.talendfile.ContextType)3 ProcessTypeImpl (org.talend.designer.core.model.utils.emf.talendfile.impl.ProcessTypeImpl)3 EList (org.eclipse.emf.common.util.EList)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 ContextParameterType (org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType)1