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));
}
}
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;
}
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);
}
}
}
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;
}
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;
}
Aggregations