Search in sources :

Example 1 with WSTransformerV2E

use of org.talend.mdm.repository.model.mdmserverobject.WSTransformerV2E in project tmdm-studio-se by Talend.

the class WSTransformerV2ItemImpl method setWsTransformerV2.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setWsTransformerV2(WSTransformerV2E newWsTransformerV2) {
    WSTransformerV2E oldWsTransformerV2 = wsTransformerV2;
    wsTransformerV2 = newWsTransformerV2;
    if (eNotificationRequired()) {
        eNotify(new ENotificationImpl(this, Notification.SET, MdmpropertiesPackage.WS_TRANSFORMER_V2_ITEM__WS_TRANSFORMER_V2, oldWsTransformerV2, wsTransformerV2));
    }
}
Also used : WSTransformerV2E(org.talend.mdm.repository.model.mdmserverobject.WSTransformerV2E) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 2 with WSTransformerV2E

use of org.talend.mdm.repository.model.mdmserverobject.WSTransformerV2E in project tmdm-studio-se by Talend.

the class WSTransformerV2ItemImpl method getWsTransformerV2.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public WSTransformerV2E getWsTransformerV2() {
    if (wsTransformerV2 != null && wsTransformerV2.eIsProxy()) {
        InternalEObject oldWsTransformerV2 = (InternalEObject) wsTransformerV2;
        wsTransformerV2 = (WSTransformerV2E) eResolveProxy(oldWsTransformerV2);
        if (wsTransformerV2.eResource() == null && eResource() != null) {
            URI uri = EcoreUtil.getURI(wsTransformerV2);
            if (uri.hasFragment()) {
                uri = uri.trimFragment();
            }
            Resource resource = eResource().getResourceSet().getResource(uri, true);
            for (EObject object : resource.getContents()) {
                if (object instanceof WSTransformerV2E) {
                    wsTransformerV2 = (WSTransformerV2E) object;
                    break;
                }
            }
        }
        if (wsTransformerV2 != oldWsTransformerV2) {
            if (eNotificationRequired()) {
                eNotify(new ENotificationImpl(this, Notification.RESOLVE, MdmpropertiesPackage.WS_TRANSFORMER_V2_ITEM__WS_TRANSFORMER_V2, oldWsTransformerV2, wsTransformerV2));
            }
        }
    }
    return wsTransformerV2;
}
Also used : WSTransformerV2E(org.talend.mdm.repository.model.mdmserverobject.WSTransformerV2E) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) EObject(org.eclipse.emf.ecore.EObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) Resource(org.eclipse.emf.ecore.resource.Resource) URI(org.eclipse.emf.common.util.URI) InternalEObject(org.eclipse.emf.ecore.InternalEObject)

Example 3 with WSTransformerV2E

use of org.talend.mdm.repository.model.mdmserverobject.WSTransformerV2E in project tmdm-studio-se by Talend.

the class NewProcessAction method doRun.

@Override
protected void doRun() {
    parentItem = null;
    selectObj = getSelectedObject().get(0);
    int type = getType();
    if (selectObj instanceof IRepositoryViewObject) {
        Item pItem = ((IRepositoryViewObject) selectObj).getProperty().getItem();
        if (pItem instanceof ContainerItem) {
            parentItem = (ContainerItem) pItem;
        }
    }
    IWorkbenchPartSite site = commonViewer.getCommonNavigator().getSite();
    // wizard
    NewProcessWizard newProcessWizard = new NewProcessWizard(site, type);
    WizardDialog wizardDialog = new WizardDialog(getShell(), newProcessWizard);
    wizardDialog.setPageSize(500, 260);
    if (wizardDialog.open() == IDialogConstants.OK_ID) {
        WSTransformerV2E newProcess = newProcessWizard.getNewProcess();
        final Item item = createServerObject(newProcess);
        commonViewer.refresh(selectObj);
        commonViewer.expandToLevel(selectObj, 1);
        openEditor(item);
        if (newProcessWizard.isCreateJob()) {
            generateJobTemplate(newProcessWizard.getType(), newProcessWizard.getProcessName(), newProcessWizard.getReturnMessages(), newProcessWizard.isEnableRedirect(), newProcessWizard.getRedirectUrl(), newProcessWizard.getJobTemplates());
            refreshJobEditorTitle(item);
        }
    }
}
Also used : IWorkbenchPartSite(org.eclipse.ui.IWorkbenchPartSite) WSTransformerV2Item(org.talend.mdm.repository.model.mdmproperties.WSTransformerV2Item) ProcessItem(org.talend.core.model.properties.ProcessItem) Item(org.talend.core.model.properties.Item) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) WSTransformerV2E(org.talend.mdm.repository.model.mdmserverobject.WSTransformerV2E) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) NewProcessWizard(org.talend.mdm.repository.ui.wizards.process.NewProcessWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 4 with WSTransformerV2E

use of org.talend.mdm.repository.model.mdmserverobject.WSTransformerV2E in project tmdm-studio-se by Talend.

the class NewProcessAction method newProcess.

private WSTransformerV2E newProcess(String key) {
    WSTransformerV2E transformer = MdmserverobjectFactory.eINSTANCE.createWSTransformerV2E();
    transformer.setName(key);
    // $NON-NLS-1$
    transformer.setDescription("");
    if (key.toString().startsWith("Smart_view_")) {
        // $NON-NLS-1$
        final String parameters = // $NON-NLS-1$
        "<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>\n" + // $NON-NLS-1$
        "   <xsl:output method='html' indent='yes' omit-xml-declaration='yes'/>\n" + "   <xsl:template match='/'>\n" + // $NON-NLS-1$//$NON-NLS-2$
        "       <html>\n" + "          <head><title>Smart View</title></head>\n" + // $NON-NLS-1$//$NON-NLS-2$
        "          <body>\n" + // $NON-NLS-1$
        "            <h1>This is the default Smart View for: <xsl:value-of select='./text()'/></h1>\n" + "            <xsl:copy-of select='.'/>\n" + // $NON-NLS-1$//$NON-NLS-2$
        "            <!-- Customize the stylesheet -->\n" + "          </body>\n" + "       </html>\n" + "    </xsl:template>" + // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
        "</xsl:stylesheet>";
        // $NON-NLS-1$
        final String TRANSFORMER_PLUGIN = "amalto/local/transformer/plugin/xslt";
        List<WSTransformerVariablesMappingE> inItems = new ArrayList<WSTransformerVariablesMappingE>();
        WSTransformerVariablesMappingE inputLine = MdmserverobjectFactory.eINSTANCE.createWSTransformerVariablesMappingE();
        // $NON-NLS-1$
        inputLine.setPipelineVariable("_DEFAULT_");
        // $NON-NLS-1$
        inputLine.setPluginVariable("xml");
        inItems.add(inputLine);
        List<WSTransformerVariablesMappingE> outItems = new ArrayList<WSTransformerVariablesMappingE>();
        WSTransformerVariablesMappingE outputLine = MdmserverobjectFactory.eINSTANCE.createWSTransformerVariablesMappingE();
        // $NON-NLS-1$
        outputLine.setPipelineVariable("html");
        // $NON-NLS-1$
        outputLine.setPluginVariable("text");
        outItems.add(outputLine);
        ArrayList<WSTransformerProcessStepE> list = new ArrayList<WSTransformerProcessStepE>();
        WSTransformerProcessStepE step = MdmserverobjectFactory.eINSTANCE.createWSTransformerProcessStepE();
        step.setPluginJNDI(TRANSFORMER_PLUGIN);
        // $NON-NLS-1$
        step.setDescription("Stylesheet");
        step.setParameters(parameters);
        step.getInputMappings().addAll(inItems);
        step.getOutputMappings().addAll(outItems);
        step.setDisabled(false);
        list.add(step);
        transformer.getProcessSteps().addAll(list);
    }
    return transformer;
}
Also used : WSTransformerVariablesMappingE(org.talend.mdm.repository.model.mdmserverobject.WSTransformerVariablesMappingE) WSTransformerV2E(org.talend.mdm.repository.model.mdmserverobject.WSTransformerV2E) ArrayList(java.util.ArrayList) WSTransformerProcessStepE(org.talend.mdm.repository.model.mdmserverobject.WSTransformerProcessStepE)

Example 5 with WSTransformerV2E

use of org.talend.mdm.repository.model.mdmserverobject.WSTransformerV2E in project tmdm-studio-se by Talend.

the class NewProcessAction method createServerObject.

@Override
protected Item createServerObject(String key) {
    WSTransformerV2Item item = MdmpropertiesFactory.eINSTANCE.createWSTransformerV2Item();
    ItemState itemState = PropertiesFactory.eINSTANCE.createItemState();
    item.setState(itemState);
    // 
    WSTransformerV2E process = newProcess(key);
    item.setWsTransformerV2(process);
    if (parentItem != null) {
        item.getState().setPath(parentItem.getState().getPath());
        RepositoryResourceUtil.createItem(item, key);
    }
    return item;
}
Also used : WSTransformerV2E(org.talend.mdm.repository.model.mdmserverobject.WSTransformerV2E) WSTransformerV2Item(org.talend.mdm.repository.model.mdmproperties.WSTransformerV2Item) ItemState(org.talend.core.model.properties.ItemState)

Aggregations

WSTransformerV2E (org.talend.mdm.repository.model.mdmserverobject.WSTransformerV2E)7 ArrayList (java.util.ArrayList)2 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 WSTransformerV2Item (org.talend.mdm.repository.model.mdmproperties.WSTransformerV2Item)2 WSTransformerProcessStepE (org.talend.mdm.repository.model.mdmserverobject.WSTransformerProcessStepE)2 WSTransformerVariablesMappingE (org.talend.mdm.repository.model.mdmserverobject.WSTransformerVariablesMappingE)2 IValidateService (com.amalto.workbench.service.IValidateService)1 WSTransformerVariablesMapping (com.amalto.workbench.webservices.WSTransformerVariablesMapping)1 URI (org.eclipse.emf.common.util.URI)1 EObject (org.eclipse.emf.ecore.EObject)1 InternalEObject (org.eclipse.emf.ecore.InternalEObject)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 IEditorPart (org.eclipse.ui.IEditorPart)1 IWorkbenchPartSite (org.eclipse.ui.IWorkbenchPartSite)1 Item (org.talend.core.model.properties.Item)1 ItemState (org.talend.core.model.properties.ItemState)1 ProcessItem (org.talend.core.model.properties.ProcessItem)1 Property (org.talend.core.model.properties.Property)1