Search in sources :

Example 1 with IProcessDescription

use of org.talend.core.repository.model.preview.IProcessDescription in project tdi-studio-se by Talend.

the class JSONShadowFilePreview method preview.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.repository.preview.IPreview#preview(org.talend.repository.preview.IProcessDescription,
     * java.lang.String, boolean)
     */
public CsvArray preview(IProcessDescription description, String type, boolean outputErrorAsException) throws CoreException {
    CsvArray res = null;
    EJSONShadowProcessType typeShadow = EJSONShadowProcessType.valueOf(type);
    shadowProcess = new JSONShadowProcess<IProcessDescription>(description, typeShadow);
    try {
        res = shadowProcess.runWithErrorOutputAsException(outputErrorAsException);
    } catch (ProcessorException e) {
        Status status = new Status(Status.ERROR, RunProcessPlugin.PLUGIN_ID, Status.OK, e.getMessage(), e);
        RunProcessPlugin.getDefault().getLog().log(status);
        throw new CoreException(status);
    }
    return res;
}
Also used : EJSONShadowProcessType(org.talend.repository.json.ui.shadow.JSONShadowProcess.EJSONShadowProcessType) Status(org.eclipse.core.runtime.Status) CsvArray(org.talend.core.utils.CsvArray) ProcessorException(org.talend.designer.runprocess.ProcessorException) CoreException(org.eclipse.core.runtime.CoreException) IProcessDescription(org.talend.core.repository.model.preview.IProcessDescription)

Example 2 with IProcessDescription

use of org.talend.core.repository.model.preview.IProcessDescription in project tdi-studio-se by Talend.

the class JSONShadowFilePreview method preview.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.repository.preview.filedelimited.IFileDelimitedPreview#
     * preview(org.talend.repository.preview.filedelimited.ProcessDescription)
     */
public CsvArray preview(IProcessDescription description, String type) throws CoreException {
    CsvArray res = null;
    EJSONShadowProcessType typeShadow = EJSONShadowProcessType.valueOf(type);
    shadowProcess = new JSONShadowProcess<IProcessDescription>(description, typeShadow);
    try {
        res = shadowProcess.run();
    } catch (ProcessorException e) {
        Status status = new Status(Status.ERROR, RunProcessPlugin.PLUGIN_ID, Status.OK, e.getMessage(), e);
        RunProcessPlugin.getDefault().getLog().log(status);
        throw new CoreException(status);
    }
    return res;
}
Also used : EJSONShadowProcessType(org.talend.repository.json.ui.shadow.JSONShadowProcess.EJSONShadowProcessType) Status(org.eclipse.core.runtime.Status) CsvArray(org.talend.core.utils.CsvArray) ProcessorException(org.talend.designer.runprocess.ProcessorException) CoreException(org.eclipse.core.runtime.CoreException) IProcessDescription(org.talend.core.repository.model.preview.IProcessDescription)

Example 3 with IProcessDescription

use of org.talend.core.repository.model.preview.IProcessDescription in project tdi-studio-se by Talend.

the class ShadowFilePreview method preview.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.repository.preview.filedelimited.IFileDelimitedPreview#
     * preview(org.talend.repository.preview.filedelimited.ProcessDescription)
     */
public CsvArray preview(IProcessDescription description, String type) throws CoreException {
    CsvArray res = null;
    EShadowProcessType typeShadow = EShadowProcessType.valueOf(type);
    shadowProcess = new ShadowProcess<IProcessDescription>(description, typeShadow);
    try {
        res = shadowProcess.run();
    } catch (ProcessorException e) {
        Status status = new Status(Status.ERROR, RunProcessPlugin.PLUGIN_ID, Status.OK, e.getMessage(), e);
        RunProcessPlugin.getDefault().getLog().log(status);
        throw new CoreException(status);
    }
    return res;
}
Also used : Status(org.eclipse.core.runtime.Status) CsvArray(org.talend.core.utils.CsvArray) ProcessorException(org.talend.designer.runprocess.ProcessorException) CoreException(org.eclipse.core.runtime.CoreException) IProcessDescription(org.talend.core.repository.model.preview.IProcessDescription) EShadowProcessType(org.talend.designer.runprocess.shadow.ShadowProcess.EShadowProcessType)

Example 4 with IProcessDescription

use of org.talend.core.repository.model.preview.IProcessDescription in project tdi-studio-se by Talend.

the class ShadowFilePreview method preview.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.repository.preview.IPreview#preview(org.talend.repository.preview.IProcessDescription,
     * java.lang.String, boolean)
     */
public CsvArray preview(IProcessDescription description, String type, boolean outputErrorAsException) throws CoreException {
    CsvArray res = null;
    EShadowProcessType typeShadow = EShadowProcessType.valueOf(type);
    shadowProcess = new ShadowProcess<IProcessDescription>(description, typeShadow);
    try {
        res = shadowProcess.runWithErrorOutputAsException(outputErrorAsException);
    } catch (ProcessorException e) {
        Status status = new Status(Status.ERROR, RunProcessPlugin.PLUGIN_ID, Status.OK, e.getMessage(), e);
        RunProcessPlugin.getDefault().getLog().log(status);
        throw new CoreException(status);
    }
    return res;
}
Also used : Status(org.eclipse.core.runtime.Status) CsvArray(org.talend.core.utils.CsvArray) ProcessorException(org.talend.designer.runprocess.ProcessorException) CoreException(org.eclipse.core.runtime.CoreException) IProcessDescription(org.talend.core.repository.model.preview.IProcessDescription) EShadowProcessType(org.talend.designer.runprocess.shadow.ShadowProcess.EShadowProcessType)

Aggregations

CoreException (org.eclipse.core.runtime.CoreException)4 Status (org.eclipse.core.runtime.Status)4 IProcessDescription (org.talend.core.repository.model.preview.IProcessDescription)4 CsvArray (org.talend.core.utils.CsvArray)4 ProcessorException (org.talend.designer.runprocess.ProcessorException)4 EShadowProcessType (org.talend.designer.runprocess.shadow.ShadowProcess.EShadowProcessType)2 EJSONShadowProcessType (org.talend.repository.json.ui.shadow.JSONShadowProcess.EJSONShadowProcessType)2