début de conversion TP4
This commit is contained in:
parent
a694800345
commit
6d2aa4acff
|
@ -1,477 +1,33 @@
|
||||||
|
|
||||||
!ENTRY fr.n7.simplepdl.toHTML.ui 4 0 2021-10-09 21:26:13.352
|
!ENTRY org.eclipse.emf.cdo.explorer 4 0 2021-10-10 00:17:27.091
|
||||||
!MESSAGE '/fr/n7/simplepdl/toHTML/main/toHTML.emtl' not found
|
!MESSAGE InterruptedException
|
||||||
!STACK 0
|
!STACK 0
|
||||||
java.io.IOException: '/fr/n7/simplepdl/toHTML/main/toHTML.emtl' not found
|
java.lang.InterruptedException
|
||||||
at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.initialize(AbstractAcceleoGenerator.java:481)
|
at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1343)
|
||||||
at fr.n7.simplepdl.toHTML.main.ToHTML.<init>(ToHTML.java:91)
|
at java.base/java.util.concurrent.Semaphore.acquire(Semaphore.java:318)
|
||||||
at fr.n7.simplepdl.toHTML.ui.common.GenerateAll.doGenerate(GenerateAll.java:77)
|
at org.eclipse.net4j.util.lifecycle.Lifecycle.lock(Lifecycle.java:312)
|
||||||
at fr.n7.simplepdl.toHTML.ui.popupMenus.AcceleoGenerateToHTMLAction$1.run(AcceleoGenerateToHTMLAction.java:78)
|
at org.eclipse.net4j.util.lifecycle.Lifecycle.internalDeactivate(Lifecycle.java:118)
|
||||||
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
|
at org.eclipse.net4j.util.lifecycle.ShareableLifecycle.internalDeactivate(ShareableLifecycle.java:52)
|
||||||
|
at org.eclipse.net4j.util.lifecycle.Lifecycle.deactivate(Lifecycle.java:170)
|
||||||
!ENTRY org.eclipse.jdt.core 4 969 2021-10-09 22:03:20.149
|
at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:235)
|
||||||
!MESSAGE fr.n7.petrinet.toTINA.ui does not exist
|
at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:225)
|
||||||
|
at org.eclipse.emf.cdo.internal.explorer.bundle.OM.disposeManagers(OM.java:83)
|
||||||
!ENTRY org.eclipse.jdt.core 4 969 2021-10-09 22:03:20.151
|
at org.eclipse.emf.cdo.internal.explorer.bundle.OM$Activator.doStop(OM.java:136)
|
||||||
!MESSAGE fr.n7.petrinet.toTINA.ui does not exist
|
at org.eclipse.net4j.util.om.OSGiActivator.stop(OSGiActivator.java:92)
|
||||||
|
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:871)
|
||||||
!ENTRY org.eclipse.jdt.core 4 969 2021-10-09 22:03:20.154
|
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
|
||||||
!MESSAGE fr.n7.petrinet.toTINA.ui does not exist
|
at java.base/java.security.AccessController.doPrivileged(Native Method)
|
||||||
|
at org.eclipse.osgi.internal.framework.BundleContextImpl.stop(BundleContextImpl.java:863)
|
||||||
!ENTRY org.eclipse.jdt.core 4 969 2021-10-09 22:03:20.166
|
at org.eclipse.osgi.internal.framework.EquinoxBundle.stopWorker0(EquinoxBundle.java:1025)
|
||||||
!MESSAGE fr.n7.petrinet.toTINA.ui does not exist
|
at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.stopWorker(EquinoxBundle.java:370)
|
||||||
|
at org.eclipse.osgi.container.Module.doStop(Module.java:660)
|
||||||
!ENTRY org.eclipse.ui 4 0 2021-10-09 22:13:54.733
|
at org.eclipse.osgi.container.Module.stop(Module.java:521)
|
||||||
!MESSAGE Unhandled event loop exception
|
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.decStartLevel(ModuleContainer.java:1886)
|
||||||
!STACK 0
|
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1761)
|
||||||
java.lang.NullPointerException
|
at org.eclipse.osgi.container.SystemModule.stopWorker(SystemModule.java:275)
|
||||||
at org.eclipse.ui.internal.PartSite.getKeyBindingService(PartSite.java:549)
|
at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule.stopWorker(EquinoxBundle.java:202)
|
||||||
at org.eclipse.ui.part.MultiPageEditorPart.deactivateSite(MultiPageEditorPart.java:869)
|
at org.eclipse.osgi.container.Module.doStop(Module.java:660)
|
||||||
at org.eclipse.ui.part.MultiPageEditorPart.dispose(MultiPageEditorPart.java:482)
|
at org.eclipse.osgi.container.Module.stop(Module.java:521)
|
||||||
at org.eclipse.sirius.editor.editorPlugin.SiriusEditor.dispose(SiriusEditor.java:1342)
|
at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:207)
|
||||||
at org.eclipse.sirius.editor.tools.internal.presentation.CustomSiriusEditor.dispose(CustomSiriusEditor.java:465)
|
at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:220)
|
||||||
at org.eclipse.sirius.editor.editorPlugin.SiriusEditor$3$1.run(SiriusEditor.java:423)
|
at java.base/java.lang.Thread.run(Thread.java:829)
|
||||||
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
|
|
||||||
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
|
|
||||||
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4988)
|
|
||||||
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4510)
|
|
||||||
at org.eclipse.jface.operation.ModalContext$ModalContextThread.block(ModalContext.java:166)
|
|
||||||
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:368)
|
|
||||||
at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.run(RefactoringWizardDialog2.java:324)
|
|
||||||
at org.eclipse.ltk.ui.refactoring.RefactoringWizard.internalPerformFinish(RefactoringWizard.java:636)
|
|
||||||
at org.eclipse.ltk.ui.refactoring.UserInputWizardPage.performFinish(UserInputWizardPage.java:148)
|
|
||||||
at org.eclipse.ltk.ui.refactoring.resource.DeleteResourcesWizard$DeleteResourcesRefactoringConfigurationPage.performFinish(DeleteResourcesWizard.java:284)
|
|
||||||
at org.eclipse.ltk.ui.refactoring.RefactoringWizard.performFinish(RefactoringWizard.java:710)
|
|
||||||
at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.okPressed(RefactoringWizardDialog2.java:450)
|
|
||||||
at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:468)
|
|
||||||
at org.eclipse.jface.dialogs.Dialog.lambda$0(Dialog.java:619)
|
|
||||||
at org.eclipse.swt.events.SelectionListener$1.widgetSelected(SelectionListener.java:84)
|
|
||||||
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
|
|
||||||
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
|
|
||||||
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5745)
|
|
||||||
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1427)
|
|
||||||
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5013)
|
|
||||||
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4507)
|
|
||||||
at org.eclipse.jface.window.Window.runEventLoop(Window.java:823)
|
|
||||||
at org.eclipse.jface.window.Window.open(Window.java:799)
|
|
||||||
at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.lambda$0(RefactoringWizardOpenOperation.java:190)
|
|
||||||
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
|
|
||||||
at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:209)
|
|
||||||
at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:126)
|
|
||||||
at org.eclipse.ltk.internal.ui.refactoring.actions.DeleteResourcesHandler.execute(DeleteResourcesHandler.java:44)
|
|
||||||
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:283)
|
|
||||||
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:97)
|
|
||||||
at jdk.internal.reflect.GeneratedMethodAccessor83.invoke(Unknown Source)
|
|
||||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
|
||||||
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
|
|
||||||
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
|
|
||||||
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:319)
|
|
||||||
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:253)
|
|
||||||
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
|
|
||||||
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
|
|
||||||
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
|
|
||||||
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:487)
|
|
||||||
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
|
|
||||||
at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommandInContext(LegacyHandlerService.java:440)
|
|
||||||
at org.eclipse.ui.internal.ide.actions.LTKLauncher.runCommand(LTKLauncher.java:140)
|
|
||||||
at org.eclipse.ui.internal.ide.actions.LTKLauncher.openDeleteWizard(LTKLauncher.java:57)
|
|
||||||
at org.eclipse.ui.actions.DeleteResourceAction.run(DeleteResourceAction.java:452)
|
|
||||||
at org.eclipse.jdt.internal.ui.refactoring.reorg.DeleteAction.run(DeleteAction.java:196)
|
|
||||||
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:274)
|
|
||||||
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:252)
|
|
||||||
at org.eclipse.jface.action.Action.runWithEvent(Action.java:474)
|
|
||||||
at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:121)
|
|
||||||
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:97)
|
|
||||||
at jdk.internal.reflect.GeneratedMethodAccessor83.invoke(Unknown Source)
|
|
||||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
|
||||||
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
|
|
||||||
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
|
|
||||||
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:319)
|
|
||||||
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:253)
|
|
||||||
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
|
|
||||||
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
|
|
||||||
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
|
|
||||||
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:487)
|
|
||||||
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
|
|
||||||
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:308)
|
|
||||||
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:584)
|
|
||||||
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:653)
|
|
||||||
at org.eclipse.e4.ui.bindings.keys.OutOfOrderListener.handleEvent(OutOfOrderListener.java:75)
|
|
||||||
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
|
|
||||||
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5745)
|
|
||||||
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1427)
|
|
||||||
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1453)
|
|
||||||
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1436)
|
|
||||||
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1475)
|
|
||||||
at org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.java:838)
|
|
||||||
at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:4021)
|
|
||||||
at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:850)
|
|
||||||
at org.eclipse.swt.widgets.Tree.gtk_key_press_event(Tree.java:2294)
|
|
||||||
at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2326)
|
|
||||||
at org.eclipse.swt.widgets.Control.windowProc(Control.java:6795)
|
|
||||||
at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:4206)
|
|
||||||
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5979)
|
|
||||||
at org.eclipse.swt.internal.gtk.GTK.gtk_main_do_event(Native Method)
|
|
||||||
at org.eclipse.swt.widgets.Display.eventProc(Display.java:1517)
|
|
||||||
at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(Native Method)
|
|
||||||
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4505)
|
|
||||||
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157)
|
|
||||||
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
|
|
||||||
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
|
|
||||||
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
|
|
||||||
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
|
|
||||||
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
|
|
||||||
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
|
|
||||||
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:153)
|
|
||||||
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
|
|
||||||
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
|
|
||||||
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
|
|
||||||
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
|
|
||||||
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
|
|
||||||
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
|
|
||||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
|
||||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|
|
||||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
|
||||||
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
|
|
||||||
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
|
|
||||||
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
|
|
||||||
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
|
|
||||||
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
|
|
||||||
|
|
||||||
!ENTRY org.eclipse.acceleo.parser 4 0 2021-10-09 22:23:58.397
|
|
||||||
!MESSAGE Compilation error for expression [name/] : Unrecognized variable: (name)
|
|
||||||
|
|
||||||
!ENTRY org.eclipse.acceleo.parser 4 0 2021-10-09 22:23:58.406
|
|
||||||
!MESSAGE Compilation error for expression [name/] : Unrecognized variable: (name)
|
|
||||||
|
|
||||||
!ENTRY org.eclipse.acceleo.parser 4 0 2021-10-09 22:23:58.413
|
|
||||||
!MESSAGE Compilation error for expression [name/] : Unrecognized variable: (name)
|
|
||||||
|
|
||||||
!ENTRY org.eclipse.acceleo.parser 4 0 2021-10-09 22:23:58.420
|
|
||||||
!MESSAGE Compilation error for expression [name/] : Unrecognized variable: (name)
|
|
||||||
|
|
||||||
!ENTRY org.eclipse.acceleo.parser 4 0 2021-10-09 22:23:58.427
|
|
||||||
!MESSAGE Compilation error for expression [name/] : Unrecognized variable: (name)
|
|
||||||
|
|
||||||
!ENTRY org.eclipse.jface 4 2 2021-10-09 22:41:40.936
|
|
||||||
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
|
|
||||||
!STACK 0
|
|
||||||
java.lang.NullPointerException
|
|
||||||
at simplepdl.provider.RequestItemProvider.getText(RequestItemProvider.java:133)
|
|
||||||
at org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider.getText(AdapterFactoryLabelProvider.java:424)
|
|
||||||
at org.eclipse.jface.viewers.WrappedViewerLabelProvider.getText(WrappedViewerLabelProvider.java:99)
|
|
||||||
at org.eclipse.jface.viewers.WrappedViewerLabelProvider.update(WrappedViewerLabelProvider.java:148)
|
|
||||||
at org.eclipse.jface.viewers.ViewerColumn.refresh(ViewerColumn.java:144)
|
|
||||||
at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:959)
|
|
||||||
at org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeRunnable.run(AbstractTreeViewer.java:126)
|
|
||||||
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
|
|
||||||
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)
|
|
||||||
at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:1037)
|
|
||||||
at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java:427)
|
|
||||||
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
|
|
||||||
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)
|
|
||||||
at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java:2111)
|
|
||||||
at org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem(AbstractTreeViewer.java:853)
|
|
||||||
at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(AbstractTreeViewer.java:831)
|
|
||||||
at org.eclipse.jface.viewers.TreeViewer.createChildren(TreeViewer.java:604)
|
|
||||||
at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(AbstractTreeViewer.java:779)
|
|
||||||
at org.eclipse.jface.viewers.AbstractTreeViewer.internalExpand(AbstractTreeViewer.java:1690)
|
|
||||||
at org.eclipse.jface.viewers.AbstractTreeViewer.setSelectionToWidget(AbstractTreeViewer.java:2557)
|
|
||||||
at org.eclipse.jface.viewers.StructuredViewer.setSelectionToWidget(StructuredViewer.java:1704)
|
|
||||||
at org.eclipse.jface.viewers.AbstractTreeViewer.setSelectionToWidget(AbstractTreeViewer.java:3029)
|
|
||||||
at org.eclipse.jface.viewers.StructuredViewer.setSelection(StructuredViewer.java:1660)
|
|
||||||
at org.eclipse.jface.viewers.TreeViewer.setSelection(TreeViewer.java:1084)
|
|
||||||
at simplepdl.presentation.SimplepdlEditor$5.run(SimplepdlEditor.java:773)
|
|
||||||
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
|
|
||||||
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
|
|
||||||
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4988)
|
|
||||||
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4510)
|
|
||||||
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157)
|
|
||||||
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
|
|
||||||
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
|
|
||||||
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
|
|
||||||
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
|
|
||||||
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
|
|
||||||
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
|
|
||||||
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:153)
|
|
||||||
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
|
|
||||||
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
|
|
||||||
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
|
|
||||||
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
|
|
||||||
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
|
|
||||||
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
|
|
||||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
|
||||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|
|
||||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
|
||||||
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
|
|
||||||
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
|
|
||||||
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
|
|
||||||
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
|
|
||||||
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
|
|
||||||
|
|
||||||
!ENTRY org.eclipse.jface 4 2 2021-10-09 22:41:40.988
|
|
||||||
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
|
|
||||||
!STACK 0
|
|
||||||
java.lang.NullPointerException
|
|
||||||
at simplepdl.provider.RequestItemProvider.getText(RequestItemProvider.java:133)
|
|
||||||
at org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator.getText(AdapterFactoryItemDelegator.java:84)
|
|
||||||
at simplepdl.presentation.SimplepdlEditor.setStatusLineManager(SimplepdlEditor.java:1711)
|
|
||||||
at simplepdl.presentation.SimplepdlEditor.setSelection(SimplepdlEditor.java:1690)
|
|
||||||
at simplepdl.presentation.SimplepdlEditor$6.selectionChanged(SimplepdlEditor.java:886)
|
|
||||||
at org.eclipse.jface.viewers.Viewer$1.run(Viewer.java:151)
|
|
||||||
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
|
|
||||||
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)
|
|
||||||
at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:148)
|
|
||||||
at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2132)
|
|
||||||
at org.eclipse.jface.viewers.StructuredViewer.setSelection(StructuredViewer.java:1662)
|
|
||||||
at org.eclipse.jface.viewers.TreeViewer.setSelection(TreeViewer.java:1084)
|
|
||||||
at simplepdl.presentation.SimplepdlEditor$5.run(SimplepdlEditor.java:773)
|
|
||||||
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
|
|
||||||
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
|
|
||||||
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4988)
|
|
||||||
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4510)
|
|
||||||
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157)
|
|
||||||
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
|
|
||||||
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
|
|
||||||
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
|
|
||||||
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
|
|
||||||
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
|
|
||||||
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
|
|
||||||
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:153)
|
|
||||||
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
|
|
||||||
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
|
|
||||||
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
|
|
||||||
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
|
|
||||||
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
|
|
||||||
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
|
|
||||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
|
||||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|
|
||||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
|
||||||
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
|
|
||||||
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
|
|
||||||
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
|
|
||||||
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
|
|
||||||
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
|
|
||||||
|
|
||||||
!ENTRY org.eclipse.jface 4 2 2021-10-09 22:42:00.253
|
|
||||||
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
|
|
||||||
!STACK 0
|
|
||||||
java.lang.NullPointerException
|
|
||||||
at simplepdl.provider.RequestItemProvider.getText(RequestItemProvider.java:133)
|
|
||||||
at org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator.getText(AdapterFactoryItemDelegator.java:84)
|
|
||||||
at simplepdl.presentation.SimplepdlEditor.setStatusLineManager(SimplepdlEditor.java:1711)
|
|
||||||
at simplepdl.presentation.SimplepdlEditor.setSelection(SimplepdlEditor.java:1690)
|
|
||||||
at simplepdl.presentation.SimplepdlEditor$6.selectionChanged(SimplepdlEditor.java:886)
|
|
||||||
at org.eclipse.jface.viewers.Viewer$1.run(Viewer.java:151)
|
|
||||||
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
|
|
||||||
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)
|
|
||||||
at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:148)
|
|
||||||
at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2132)
|
|
||||||
at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1178)
|
|
||||||
at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1207)
|
|
||||||
at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:242)
|
|
||||||
at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:237)
|
|
||||||
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:402)
|
|
||||||
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
|
|
||||||
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5745)
|
|
||||||
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1427)
|
|
||||||
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5013)
|
|
||||||
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4507)
|
|
||||||
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157)
|
|
||||||
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
|
|
||||||
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
|
|
||||||
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
|
|
||||||
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
|
|
||||||
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
|
|
||||||
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
|
|
||||||
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:153)
|
|
||||||
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
|
|
||||||
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
|
|
||||||
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
|
|
||||||
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
|
|
||||||
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
|
|
||||||
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
|
|
||||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
|
||||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|
|
||||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
|
||||||
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
|
|
||||||
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
|
|
||||||
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
|
|
||||||
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
|
|
||||||
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
|
|
||||||
|
|
||||||
!ENTRY org.eclipse.ui.workbench 4 2 2021-10-09 22:42:03.727
|
|
||||||
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench".
|
|
||||||
!STACK 0
|
|
||||||
java.lang.NullPointerException
|
|
||||||
at simplepdl.provider.RequestItemProvider.getText(RequestItemProvider.java:133)
|
|
||||||
at org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator.getText(AdapterFactoryItemDelegator.java:84)
|
|
||||||
at simplepdl.presentation.SimplepdlEditor.setStatusLineManager(SimplepdlEditor.java:1711)
|
|
||||||
at simplepdl.presentation.SimplepdlEditor.setSelection(SimplepdlEditor.java:1690)
|
|
||||||
at simplepdl.presentation.SimplepdlEditor.handleActivate(SimplepdlEditor.java:553)
|
|
||||||
at simplepdl.presentation.SimplepdlEditor$1.partActivated(SimplepdlEditor.java:339)
|
|
||||||
at org.eclipse.ui.internal.WorkbenchPage$3.run(WorkbenchPage.java:4896)
|
|
||||||
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
|
|
||||||
at org.eclipse.ui.internal.WorkbenchPage.firePartActivated(WorkbenchPage.java:4893)
|
|
||||||
at org.eclipse.ui.internal.WorkbenchPage.access$3(WorkbenchPage.java:4878)
|
|
||||||
at org.eclipse.ui.internal.WorkbenchPage$E4PartListener.partActivated(WorkbenchPage.java:219)
|
|
||||||
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl$2.run(PartServiceImpl.java:249)
|
|
||||||
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
|
|
||||||
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.firePartActivated(PartServiceImpl.java:246)
|
|
||||||
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:770)
|
|
||||||
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:679)
|
|
||||||
at org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer.activate(AbstractPartRenderer.java:97)
|
|
||||||
at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.lambda$0(ContributedPartRenderer.java:63)
|
|
||||||
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
|
|
||||||
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5745)
|
|
||||||
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1427)
|
|
||||||
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1453)
|
|
||||||
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1436)
|
|
||||||
at org.eclipse.swt.widgets.Shell.setActiveControl(Shell.java:2129)
|
|
||||||
at org.eclipse.swt.widgets.Control.gtk_button_press_event(Control.java:3649)
|
|
||||||
at org.eclipse.swt.widgets.Control.gtk_button_press_event(Control.java:3532)
|
|
||||||
at org.eclipse.swt.widgets.Composite.gtk_button_press_event(Composite.java:829)
|
|
||||||
at org.eclipse.swt.widgets.Tree.gtk_button_press_event(Tree.java:2158)
|
|
||||||
at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2309)
|
|
||||||
at org.eclipse.swt.widgets.Control.windowProc(Control.java:6795)
|
|
||||||
at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:4206)
|
|
||||||
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5979)
|
|
||||||
at org.eclipse.swt.internal.gtk.GTK.gtk_main_do_event(Native Method)
|
|
||||||
at org.eclipse.swt.widgets.Display.eventProc(Display.java:1517)
|
|
||||||
at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(Native Method)
|
|
||||||
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4505)
|
|
||||||
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157)
|
|
||||||
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
|
|
||||||
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
|
|
||||||
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
|
|
||||||
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
|
|
||||||
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
|
|
||||||
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
|
|
||||||
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:153)
|
|
||||||
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
|
|
||||||
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
|
|
||||||
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
|
|
||||||
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
|
|
||||||
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
|
|
||||||
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
|
|
||||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
|
||||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|
|
||||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
|
||||||
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
|
|
||||||
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
|
|
||||||
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
|
|
||||||
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
|
|
||||||
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
|
|
||||||
|
|
||||||
!ENTRY org.eclipse.sirius 2 0 2021-10-09 22:42:16.170
|
|
||||||
!MESSAGE the following edge mapping source finder expression could not be correctly evaluated : feature:requests
|
|
||||||
!STACK 0
|
|
||||||
org.eclipse.sirius.common.tools.api.interpreter.EvaluationException: Unknown feature name requests
|
|
||||||
at org.eclipse.sirius.common.tools.internal.interpreter.FeatureInterpreter.evaluate(FeatureInterpreter.java:98)
|
|
||||||
at org.eclipse.sirius.tools.internal.interpreter.SessionInterpreter.evaluate(SessionInterpreter.java:179)
|
|
||||||
at org.eclipse.sirius.common.tools.api.interpreter.IInterpreter.evaluateCollection(IInterpreter.java:148)
|
|
||||||
at org.eclipse.sirius.diagram.business.api.query.EdgeMappingQuery.evaluateSourceFinderExpression(EdgeMappingQuery.java:148)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DEdgeSynchronizerHelper.handleCandidatesFromSemanticTargets(DEdgeSynchronizerHelper.java:203)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DEdgeSynchronizerHelper.computeEdgeCandidatesWithDomain(DEdgeSynchronizerHelper.java:129)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DEdgeSynchronizerHelper.computeNowEdgeCandidates(DEdgeSynchronizerHelper.java:108)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DDiagramSynchronizer.computeEdgeCandidates(DDiagramSynchronizer.java:1004)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DDiagramSynchronizer.createEdgeCandidates(DDiagramSynchronizer.java:1272)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DDiagramSynchronizer.refreshEdgeMapping(DDiagramSynchronizer.java:1224)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DDiagramSynchronizer.processEdgeMappingsRefresh(DDiagramSynchronizer.java:481)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DDiagramSynchronizer.refreshOperation(DDiagramSynchronizer.java:396)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DDiagramSynchronizer.refresh(DDiagramSynchronizer.java:317)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.dialect.DiagramDialectServices.refresh(DiagramDialectServices.java:240)
|
|
||||||
at org.eclipse.sirius.business.internal.dialect.DialectManagerImpl.refresh(DialectManagerImpl.java:106)
|
|
||||||
at org.eclipse.sirius.business.api.dialect.command.RefreshRepresentationsCommand.doExecute(RefreshRepresentationsCommand.java:124)
|
|
||||||
at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135)
|
|
||||||
at org.eclipse.emf.common.command.CompoundCommand.execute(CompoundCommand.java:261)
|
|
||||||
at org.eclipse.emf.workspace.EMFCommandOperation.doExecute(EMFCommandOperation.java:119)
|
|
||||||
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
|
|
||||||
at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:496)
|
|
||||||
at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208)
|
|
||||||
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
|
|
||||||
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219)
|
|
||||||
at org.eclipse.sirius.tools.api.ui.RefreshEditorsPrecommitListener.notify(RefreshEditorsPrecommitListener.java:260)
|
|
||||||
at org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl.notifyListeners(DAnalysisSessionImpl.java:1253)
|
|
||||||
at org.eclipse.sirius.business.internal.session.danalysis.SessionResourcesSynchronizer.reloadResource(SessionResourcesSynchronizer.java:237)
|
|
||||||
at org.eclipse.sirius.business.internal.session.danalysis.SessionResourcesSynchronizer.processAction(SessionResourcesSynchronizer.java:174)
|
|
||||||
at org.eclipse.sirius.business.internal.session.danalysis.SessionResourcesSynchronizer.processActions(SessionResourcesSynchronizer.java:163)
|
|
||||||
at org.eclipse.sirius.business.internal.session.danalysis.SessionResourcesSynchronizer.statusesChanged(SessionResourcesSynchronizer.java:113)
|
|
||||||
at org.eclipse.sirius.common.tools.api.resource.ResourceSetSync.notifyClientsInBatch(ResourceSetSync.java:424)
|
|
||||||
at org.eclipse.sirius.common.tools.api.resource.ResourceSetSync.statusesChanged(ResourceSetSync.java:479)
|
|
||||||
at org.eclipse.sirius.common.tools.internal.resource.ResourceSyncClientNotifier.run(ResourceSyncClientNotifier.java:80)
|
|
||||||
at org.eclipse.sirius.common.tools.internal.resource.EditingSessionWorkspaceListener.resourceChanged(EditingSessionWorkspaceListener.java:63)
|
|
||||||
at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:305)
|
|
||||||
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
|
|
||||||
at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:295)
|
|
||||||
at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:158)
|
|
||||||
at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:380)
|
|
||||||
at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1502)
|
|
||||||
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2306)
|
|
||||||
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2317)
|
|
||||||
at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:131)
|
|
||||||
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
|
|
||||||
|
|
||||||
!ENTRY org.eclipse.sirius 2 0 2021-10-09 22:44:35.000
|
|
||||||
!MESSAGE the following edge mapping source finder expression could not be correctly evaluated : feature:requests
|
|
||||||
!STACK 0
|
|
||||||
org.eclipse.sirius.common.tools.api.interpreter.EvaluationException: Unknown feature name requests
|
|
||||||
at org.eclipse.sirius.common.tools.internal.interpreter.FeatureInterpreter.evaluate(FeatureInterpreter.java:98)
|
|
||||||
at org.eclipse.sirius.tools.internal.interpreter.SessionInterpreter.evaluate(SessionInterpreter.java:179)
|
|
||||||
at org.eclipse.sirius.common.tools.api.interpreter.IInterpreter.evaluateCollection(IInterpreter.java:148)
|
|
||||||
at org.eclipse.sirius.diagram.business.api.query.EdgeMappingQuery.evaluateSourceFinderExpression(EdgeMappingQuery.java:148)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DEdgeSynchronizerHelper.handleCandidatesFromSemanticTargets(DEdgeSynchronizerHelper.java:203)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DEdgeSynchronizerHelper.computeEdgeCandidatesWithDomain(DEdgeSynchronizerHelper.java:129)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DEdgeSynchronizerHelper.computeNowEdgeCandidates(DEdgeSynchronizerHelper.java:108)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DDiagramSynchronizer.computeEdgeCandidates(DDiagramSynchronizer.java:1004)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DDiagramSynchronizer.createEdgeCandidates(DDiagramSynchronizer.java:1272)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DDiagramSynchronizer.refreshEdgeMapping(DDiagramSynchronizer.java:1224)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DDiagramSynchronizer.processEdgeMappingsRefresh(DDiagramSynchronizer.java:481)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DDiagramSynchronizer.refreshOperation(DDiagramSynchronizer.java:396)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DDiagramSynchronizer.refresh(DDiagramSynchronizer.java:317)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.dialect.DiagramDialectServices.refresh(DiagramDialectServices.java:240)
|
|
||||||
at org.eclipse.sirius.business.internal.dialect.DialectManagerImpl.refresh(DialectManagerImpl.java:106)
|
|
||||||
at org.eclipse.sirius.business.api.dialect.command.RefreshRepresentationsCommand.doExecute(RefreshRepresentationsCommand.java:124)
|
|
||||||
at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135)
|
|
||||||
at org.eclipse.emf.workspace.EMFCommandOperation.doExecute(EMFCommandOperation.java:119)
|
|
||||||
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
|
|
||||||
at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:496)
|
|
||||||
at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208)
|
|
||||||
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
|
|
||||||
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219)
|
|
||||||
at org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramEditorImpl.launchRefresh(DDiagramEditorImpl.java:1480)
|
|
||||||
at org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramEditorImpl.access$2(DDiagramEditorImpl.java:1451)
|
|
||||||
at org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramEditorImpl$1.run(DDiagramEditorImpl.java:796)
|
|
||||||
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
|
|
||||||
|
|
||||||
!ENTRY org.eclipse.sirius 2 0 2021-10-09 23:01:57.687
|
|
||||||
!MESSAGE the following edge mapping source finder expression could not be correctly evaluated : feature:requests
|
|
||||||
!STACK 0
|
|
||||||
org.eclipse.sirius.common.tools.api.interpreter.EvaluationException: Unknown feature name requests
|
|
||||||
at org.eclipse.sirius.common.tools.internal.interpreter.FeatureInterpreter.evaluate(FeatureInterpreter.java:98)
|
|
||||||
at org.eclipse.sirius.tools.internal.interpreter.SessionInterpreter.evaluate(SessionInterpreter.java:179)
|
|
||||||
at org.eclipse.sirius.common.tools.api.interpreter.IInterpreter.evaluateCollection(IInterpreter.java:148)
|
|
||||||
at org.eclipse.sirius.diagram.business.api.query.EdgeMappingQuery.evaluateSourceFinderExpression(EdgeMappingQuery.java:148)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DEdgeSynchronizerHelper.handleCandidatesFromSemanticTargets(DEdgeSynchronizerHelper.java:203)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DEdgeSynchronizerHelper.computeEdgeCandidatesWithDomain(DEdgeSynchronizerHelper.java:129)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DEdgeSynchronizerHelper.computeNowEdgeCandidates(DEdgeSynchronizerHelper.java:108)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DDiagramSynchronizer.computeEdgeCandidates(DDiagramSynchronizer.java:1004)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DDiagramSynchronizer.createEdgeCandidates(DDiagramSynchronizer.java:1272)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DDiagramSynchronizer.refreshEdgeMapping(DDiagramSynchronizer.java:1224)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DDiagramSynchronizer.processEdgeMappingsRefresh(DDiagramSynchronizer.java:481)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DDiagramSynchronizer.refreshOperation(DDiagramSynchronizer.java:396)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.sync.DDiagramSynchronizer.refresh(DDiagramSynchronizer.java:317)
|
|
||||||
at org.eclipse.sirius.diagram.business.internal.dialect.DiagramDialectServices.refresh(DiagramDialectServices.java:240)
|
|
||||||
at org.eclipse.sirius.business.internal.dialect.DialectManagerImpl.refresh(DialectManagerImpl.java:106)
|
|
||||||
at org.eclipse.sirius.business.api.dialect.command.RefreshRepresentationsCommand.doExecute(RefreshRepresentationsCommand.java:124)
|
|
||||||
at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135)
|
|
||||||
at org.eclipse.emf.workspace.EMFCommandOperation.doExecute(EMFCommandOperation.java:119)
|
|
||||||
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
|
|
||||||
at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:496)
|
|
||||||
at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208)
|
|
||||||
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
|
|
||||||
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219)
|
|
||||||
at org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramEditorImpl.launchRefresh(DDiagramEditorImpl.java:1480)
|
|
||||||
at org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramEditorImpl.access$2(DDiagramEditorImpl.java:1451)
|
|
||||||
at org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramEditorImpl$1.run(DDiagramEditorImpl.java:796)
|
|
||||||
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
|
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class SimplePDLCreator {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger le package SimplePDL afin de l'enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte Ã
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Définir la ressource (le modèle)
|
||||||
|
URI modelURI = URI.createURI("models/SimplePDLCreator_Created_Process.xmi");
|
||||||
|
Resource resource = resSet.createResource(modelURI);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de SimplePDL
|
||||||
|
SimplepdlFactory myFactory = SimplepdlFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Process
|
||||||
|
Process process = myFactory.createProcess();
|
||||||
|
process.setName("Mon premier processus");
|
||||||
|
|
||||||
|
// Ajouter le Process dans le modèle
|
||||||
|
resource.getContents().add(process);
|
||||||
|
|
||||||
|
// Ajouter deux WorkDefinitions
|
||||||
|
WorkDefinition wd1 = myFactory.createWorkDefinition();
|
||||||
|
wd1.setName("Ma première WorkDefinition, quelle émotion");
|
||||||
|
|
||||||
|
WorkDefinition wd2 = myFactory.createWorkDefinition();
|
||||||
|
wd2.setName("Ma deuxième WorkDefinition, toujours autant d'émotion");
|
||||||
|
|
||||||
|
process.getProcessElements().add(wd1);
|
||||||
|
process.getProcessElements().add(wd2);
|
||||||
|
|
||||||
|
// Ajouter une WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq = myFactory.createWorkSequence();
|
||||||
|
seq.setPredecessor(wd1);
|
||||||
|
seq.setSuccessor(wd2);
|
||||||
|
seq.setLinkType(WorkSequenceType.FINISH_TO_FINISH);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq);
|
||||||
|
|
||||||
|
// Ajouter une deuxième WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq2 = myFactory.createWorkSequence();
|
||||||
|
seq2.setPredecessor(wd1);
|
||||||
|
seq2.setSuccessor(wd2);
|
||||||
|
seq2.setLinkType(WorkSequenceType.START_TO_START);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq2);
|
||||||
|
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,129 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Transition;
|
||||||
|
import petrinet.Arc;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
idle.setTokens(1);
|
||||||
|
Place running = myFactory.createPlace();
|
||||||
|
running.setName(name + "_running");
|
||||||
|
running.setTokens(1);
|
||||||
|
Place finished = myFactory.createPlace();
|
||||||
|
finished.setName(name + "_finished");
|
||||||
|
finished.setTokens(1);
|
||||||
|
|
||||||
|
Arc pause2start = myFactory.createArc();
|
||||||
|
pause2start.setTarget(idle);
|
||||||
|
pause2start.setOutgoing(false);
|
||||||
|
pause2start.setWeight(1);
|
||||||
|
Arc start2running = myFactory.createArc();
|
||||||
|
start2running.setTarget(running);
|
||||||
|
start2running.setOutgoing(true);
|
||||||
|
start2running.setWeight(1);
|
||||||
|
Transition start = myFactory.createTransition();
|
||||||
|
start.setName(name + "_start");
|
||||||
|
start.getArcs().add(pause2start)
|
||||||
|
start.getArcs().add(start2running);
|
||||||
|
|
||||||
|
Transition finish = myFactory.createTransition();
|
||||||
|
finish.setName(name + "_finish");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// // Ajouter le Process dans le modèle
|
||||||
|
// resource.getContents().add(process);
|
||||||
|
//
|
||||||
|
// // Ajouter deux WorkDefinitions
|
||||||
|
// WorkDefinition wd1 = myFactory.createWorkDefinition();
|
||||||
|
// wd1.setName("Ma première WorkDefinition, quelle émotion");
|
||||||
|
//
|
||||||
|
// WorkDefinition wd2 = myFactory.createWorkDefinition();
|
||||||
|
// wd2.setName("Ma deuxième WorkDefinition, toujours autant d'émotion");
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(wd1);
|
||||||
|
// process.getProcessElements().add(wd2);
|
||||||
|
//
|
||||||
|
// // Ajouter une WorkSequence entre les deux WorkDefinitions
|
||||||
|
// WorkSequence seq = myFactory.createWorkSequence();
|
||||||
|
// seq.setPredecessor(wd1);
|
||||||
|
// seq.setSuccessor(wd2);
|
||||||
|
// seq.setLinkType(WorkSequenceType.FINISH_TO_FINISH);
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(seq);
|
||||||
|
//
|
||||||
|
// // Ajouter une deuxième WorkSequence entre les deux WorkDefinitions
|
||||||
|
// WorkSequence seq2 = myFactory.createWorkSequence();
|
||||||
|
// seq2.setPredecessor(wd1);
|
||||||
|
// seq2.setSuccessor(wd2);
|
||||||
|
// seq2.setLinkType(WorkSequenceType.START_TO_START);
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(seq2);
|
||||||
|
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger le package SimplePDL afin de l'enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte Ã
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Définir la ressource (le modèle)
|
||||||
|
URI modelURI = URI.createURI("models/SimplePDLCreator_Created_Process.xmi");
|
||||||
|
Resource resource = resSet.createResource(modelURI);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de SimplePDL
|
||||||
|
SimplepdlFactory myFactory = SimplepdlFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Process
|
||||||
|
Process process = myFactory.createProcess();
|
||||||
|
process.setName("Mon premier processus");
|
||||||
|
|
||||||
|
// Ajouter le Process dans le modèle
|
||||||
|
resource.getContents().add(process);
|
||||||
|
|
||||||
|
// Ajouter deux WorkDefinitions
|
||||||
|
WorkDefinition wd1 = myFactory.createWorkDefinition();
|
||||||
|
wd1.setName("Ma première WorkDefinition, quelle émotion");
|
||||||
|
|
||||||
|
WorkDefinition wd2 = myFactory.createWorkDefinition();
|
||||||
|
wd2.setName("Ma deuxième WorkDefinition, toujours autant d'émotion");
|
||||||
|
|
||||||
|
process.getProcessElements().add(wd1);
|
||||||
|
process.getProcessElements().add(wd2);
|
||||||
|
|
||||||
|
// Ajouter une WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq = myFactory.createWorkSequence();
|
||||||
|
seq.setPredecessor(wd1);
|
||||||
|
seq.setSuccessor(wd2);
|
||||||
|
seq.setLinkType(WorkSequenceType.FINISH_TO_FINISH);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq);
|
||||||
|
|
||||||
|
// Ajouter une deuxième WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq2 = myFactory.createWorkSequence();
|
||||||
|
seq2.setPredecessor(wd1);
|
||||||
|
seq2.setSuccessor(wd2);
|
||||||
|
seq2.setLinkType(WorkSequenceType.START_TO_START);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq2);
|
||||||
|
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,125 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Transition;
|
||||||
|
import petrinet.Arc;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resGet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resGet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
System.out.println(" - " + name);
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
idle.setTokens(1);
|
||||||
|
Place running = myFactory.createPlace();
|
||||||
|
running.setName(name + "_running");
|
||||||
|
running.setTokens(1);
|
||||||
|
Place finished = myFactory.createPlace();
|
||||||
|
finished.setName(name + "_finished");
|
||||||
|
finished.setTokens(1);
|
||||||
|
|
||||||
|
Arc pause2start = myFactory.createArc();
|
||||||
|
pause2start.setTarget(idle);
|
||||||
|
pause2start.setOutgoing(false);
|
||||||
|
pause2start.setWeight(1);
|
||||||
|
Arc start2running = myFactory.createArc();
|
||||||
|
start2running.setTarget(running);
|
||||||
|
start2running.setOutgoing(true);
|
||||||
|
start2running.setWeight(1);
|
||||||
|
Transition start = myFactory.createTransition();
|
||||||
|
start.setName(name + "_start");
|
||||||
|
start.getArcs().add(pause2start);
|
||||||
|
start.getArcs().add(start2running);
|
||||||
|
|
||||||
|
Arc running2finish = myFactory.createArc();
|
||||||
|
running2finish.setTarget(running);
|
||||||
|
running2finish.setOutgoing(false);
|
||||||
|
running2finish.setWeight(1);
|
||||||
|
Arc finish2finished = myFactory.createArc();
|
||||||
|
finish2finished.setTarget(finished);
|
||||||
|
finish2finished.setOutgoing(true);
|
||||||
|
finish2finished.setWeight(1);
|
||||||
|
Transition finish = myFactory.createTransition();
|
||||||
|
finish.setName(name + "_finish");
|
||||||
|
finish.getArcs().add(running2finish);
|
||||||
|
finish.getArcs().add(finish2finished);
|
||||||
|
|
||||||
|
System.out.println(" + " + idle.getName());
|
||||||
|
|
||||||
|
network.getNodes().add(idle);
|
||||||
|
network.getNodes().add(start);
|
||||||
|
network.getNodes().add(running);
|
||||||
|
network.getNodes().add(finish);
|
||||||
|
network.getNodes().add(finished);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Créer le nouveau xmi (modèle convertit)
|
||||||
|
URI convURI = URI.createURI("test.xmi");
|
||||||
|
Resource conv = resSet.createResource(convURI);
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
conv.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger le package SimplePDL afin de l'enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte Ã
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Définir la ressource (le modèle)
|
||||||
|
URI modelURI = URI.createURI("models/SimplePDLCreator_Created_Process.xmi");
|
||||||
|
Resource resource = resSet.createResource(modelURI);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de SimplePDL
|
||||||
|
SimplepdlFactory myFactory = SimplepdlFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Process
|
||||||
|
Process process = myFactory.createProcess();
|
||||||
|
process.setName("Mon premier processus");
|
||||||
|
|
||||||
|
// Ajouter le Process dans le modèle
|
||||||
|
resource.getContents().add(process);
|
||||||
|
|
||||||
|
// Ajouter deux WorkDefinitions
|
||||||
|
WorkDefinition wd1 = myFactory.createWorkDefinition();
|
||||||
|
wd1.setName("Ma première WorkDefinition, quelle émotion");
|
||||||
|
|
||||||
|
WorkDefinition wd2 = myFactory.createWorkDefinition();
|
||||||
|
wd2.setName("Ma deuxième WorkDefinition, toujours autant d'émotion");
|
||||||
|
|
||||||
|
process.getProcessElements().add(wd1);
|
||||||
|
process.getProcessElements().add(wd2);
|
||||||
|
|
||||||
|
// Ajouter une WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq = myFactory.createWorkSequence();
|
||||||
|
seq.setPredecessor(wd1);
|
||||||
|
seq.setSuccessor(wd2);
|
||||||
|
seq.setLinkType(WorkSequenceType.FINISH_TO_FINISH);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq);
|
||||||
|
|
||||||
|
// Ajouter une deuxième WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq2 = myFactory.createWorkSequence();
|
||||||
|
seq2.setPredecessor(wd1);
|
||||||
|
seq2.setSuccessor(wd2);
|
||||||
|
seq2.setLinkType(WorkSequenceType.START_TO_START);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq2);
|
||||||
|
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Définir la ressource (le modèle)
|
||||||
|
URI modelURI = URI.createURI("models/SimplePDL2PetriNET.xmi");
|
||||||
|
Resource resource = resSet.createResource(modelURI);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de SimplePDL
|
||||||
|
SimplepdlFactory myFactory = SimplepdlFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Process
|
||||||
|
Process process = myFactory.createProcess();
|
||||||
|
process.setName("Mon premier processus");
|
||||||
|
|
||||||
|
// Ajouter le Process dans le modèle
|
||||||
|
resource.getContents().add(process);
|
||||||
|
|
||||||
|
// Ajouter deux WorkDefinitions
|
||||||
|
WorkDefinition wd1 = myFactory.createWorkDefinition();
|
||||||
|
wd1.setName("Ma première WorkDefinition, quelle émotion");
|
||||||
|
|
||||||
|
WorkDefinition wd2 = myFactory.createWorkDefinition();
|
||||||
|
wd2.setName("Ma deuxième WorkDefinition, toujours autant d'émotion");
|
||||||
|
|
||||||
|
process.getProcessElements().add(wd1);
|
||||||
|
process.getProcessElements().add(wd2);
|
||||||
|
|
||||||
|
// Ajouter une WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq = myFactory.createWorkSequence();
|
||||||
|
seq.setPredecessor(wd1);
|
||||||
|
seq.setSuccessor(wd2);
|
||||||
|
seq.setLinkType(WorkSequenceType.FINISH_TO_FINISH);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq);
|
||||||
|
|
||||||
|
// Ajouter une deuxième WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq2 = myFactory.createWorkSequence();
|
||||||
|
seq2.setPredecessor(wd1);
|
||||||
|
seq2.setSuccessor(wd2);
|
||||||
|
seq2.setLinkType(WorkSequenceType.START_TO_START);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq2);
|
||||||
|
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,104 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// // Ajouter le Process dans le modèle
|
||||||
|
// resource.getContents().add(process);
|
||||||
|
//
|
||||||
|
// // Ajouter deux WorkDefinitions
|
||||||
|
// WorkDefinition wd1 = myFactory.createWorkDefinition();
|
||||||
|
// wd1.setName("Ma première WorkDefinition, quelle émotion");
|
||||||
|
//
|
||||||
|
// WorkDefinition wd2 = myFactory.createWorkDefinition();
|
||||||
|
// wd2.setName("Ma deuxième WorkDefinition, toujours autant d'émotion");
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(wd1);
|
||||||
|
// process.getProcessElements().add(wd2);
|
||||||
|
//
|
||||||
|
// // Ajouter une WorkSequence entre les deux WorkDefinitions
|
||||||
|
// WorkSequence seq = myFactory.createWorkSequence();
|
||||||
|
// seq.setPredecessor(wd1);
|
||||||
|
// seq.setSuccessor(wd2);
|
||||||
|
// seq.setLinkType(WorkSequenceType.FINISH_TO_FINISH);
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(seq);
|
||||||
|
//
|
||||||
|
// // Ajouter une deuxième WorkSequence entre les deux WorkDefinitions
|
||||||
|
// WorkSequence seq2 = myFactory.createWorkSequence();
|
||||||
|
// seq2.setPredecessor(wd1);
|
||||||
|
// seq2.setSuccessor(wd2);
|
||||||
|
// seq2.setLinkType(WorkSequenceType.START_TO_START);
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(seq2);
|
||||||
|
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<petrinet:Network
|
||||||
|
xmi:version="2.0"
|
||||||
|
xmlns:xmi="http://www.omg.org/XMI"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns:petrinet="http://petrinet"
|
||||||
|
xsi:schemaLocation="http://petrinet petrinet.ecore"
|
||||||
|
name="gentilleNetwork">
|
||||||
|
<nodes xsi:type="petrinet:Place"
|
||||||
|
name="debut"
|
||||||
|
tokens="1"/>
|
||||||
|
<nodes xsi:type="petrinet:Place"
|
||||||
|
name="fin"/>
|
||||||
|
<nodes xsi:type="petrinet:Transition"
|
||||||
|
name="debut2fin">
|
||||||
|
<arcs weight="1"
|
||||||
|
target="//@nodes.0"/>
|
||||||
|
<arcs weight="1"
|
||||||
|
outgoing="true"
|
||||||
|
target="//@nodes.1"/>
|
||||||
|
</nodes>
|
||||||
|
</petrinet:Network>
|
|
@ -0,0 +1,124 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Transition;
|
||||||
|
import petrinet.Arc;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
System.out.println(" - " + name);
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
idle.setTokens(1);
|
||||||
|
Place running = myFactory.createPlace();
|
||||||
|
running.setName(name + "_running");
|
||||||
|
running.setTokens(1);
|
||||||
|
Place finished = myFactory.createPlace();
|
||||||
|
finished.setName(name + "_finished");
|
||||||
|
finished.setTokens(1);
|
||||||
|
|
||||||
|
Arc pause2start = myFactory.createArc();
|
||||||
|
pause2start.setTarget(idle);
|
||||||
|
pause2start.setOutgoing(false);
|
||||||
|
pause2start.setWeight(1);
|
||||||
|
Arc start2running = myFactory.createArc();
|
||||||
|
start2running.setTarget(running);
|
||||||
|
start2running.setOutgoing(true);
|
||||||
|
start2running.setWeight(1);
|
||||||
|
Transition start = myFactory.createTransition();
|
||||||
|
start.setName(name + "_start");
|
||||||
|
start.getArcs().add(pause2start);
|
||||||
|
start.getArcs().add(start2running);
|
||||||
|
|
||||||
|
Arc running2finish = myFactory.createArc();
|
||||||
|
running2finish.setTarget(running);
|
||||||
|
running2finish.setOutgoing(false);
|
||||||
|
running2finish.setWeight(1);
|
||||||
|
Arc finish2finished = myFactory.createArc();
|
||||||
|
finish2finished.setTarget(finished);
|
||||||
|
finish2finished.setOutgoing(true);
|
||||||
|
finish2finished.setWeight(1);
|
||||||
|
Transition finish = myFactory.createTransition();
|
||||||
|
finish.setName(name + "_finish");
|
||||||
|
finish.getArcs().add(running2finish);
|
||||||
|
finish.getArcs().add(finish2finished);
|
||||||
|
|
||||||
|
System.out.println(" + " + idle.getName() + " (" + idle.getTokens() + ")");
|
||||||
|
|
||||||
|
network.getNodes().add(idle);
|
||||||
|
network.getNodes().add(start);
|
||||||
|
network.getNodes().add(running);
|
||||||
|
network.getNodes().add(finish);
|
||||||
|
network.getNodes().add(finished);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Créer le nouveau xmi (modèle convertit)
|
||||||
|
URI convURI = URI.createURI("test.xmi");
|
||||||
|
Resource conv = resSet.createResource(convURI);
|
||||||
|
|
||||||
|
// Ajouter le Network dans le nouveau modèle
|
||||||
|
conv.getContents().add(network);
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
conv.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,145 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Transition;
|
||||||
|
import petrinet.Arc;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
idle.setTokens(1);
|
||||||
|
Place running = myFactory.createPlace();
|
||||||
|
running.setName(name + "_running");
|
||||||
|
running.setTokens(1);
|
||||||
|
Place finished = myFactory.createPlace();
|
||||||
|
finished.setName(name + "_finished");
|
||||||
|
finished.setTokens(1);
|
||||||
|
|
||||||
|
Arc pause2start = myFactory.createArc();
|
||||||
|
pause2start.setTarget(idle);
|
||||||
|
pause2start.setOutgoing(false);
|
||||||
|
pause2start.setWeight(1);
|
||||||
|
Arc start2running = myFactory.createArc();
|
||||||
|
start2running.setTarget(running);
|
||||||
|
start2running.setOutgoing(true);
|
||||||
|
start2running.setWeight(1);
|
||||||
|
Transition start = myFactory.createTransition();
|
||||||
|
start.setName(name + "_start");
|
||||||
|
start.getArcs().add(pause2start);
|
||||||
|
start.getArcs().add(start2running);
|
||||||
|
|
||||||
|
Arc running2finish = myFactory.createArc();
|
||||||
|
running2finish.setTarget(running);
|
||||||
|
running2finish.setOutgoing(false);
|
||||||
|
running2finish.setWeight(1);
|
||||||
|
Arc finish2finished = myFactory.createArc();
|
||||||
|
finish2finished.setTarget(finished);
|
||||||
|
finish2finished.setOutgoing(true);
|
||||||
|
finish2finished.setWeight(1);
|
||||||
|
Transition finish = myFactory.createTransition();
|
||||||
|
finish.setName(name + "_finish");
|
||||||
|
finish.getArcs().add(running2finish);
|
||||||
|
finish.getArcs().add(finish2finished);
|
||||||
|
|
||||||
|
network.getNodes().add(idle);
|
||||||
|
network.getNodes().add(start);
|
||||||
|
network.getNodes().add(running);
|
||||||
|
network.getNodes().add(finish);
|
||||||
|
network.getNodes().add(finished);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// // Ajouter le Process dans le modèle
|
||||||
|
// resource.getContents().add(process);
|
||||||
|
//
|
||||||
|
// // Ajouter deux WorkDefinitions
|
||||||
|
// WorkDefinition wd1 = myFactory.createWorkDefinition();
|
||||||
|
// wd1.setName("Ma première WorkDefinition, quelle émotion");
|
||||||
|
//
|
||||||
|
// WorkDefinition wd2 = myFactory.createWorkDefinition();
|
||||||
|
// wd2.setName("Ma deuxième WorkDefinition, toujours autant d'émotion");
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(wd1);
|
||||||
|
// process.getProcessElements().add(wd2);
|
||||||
|
//
|
||||||
|
// // Ajouter une WorkSequence entre les deux WorkDefinitions
|
||||||
|
// WorkSequence seq = myFactory.createWorkSequence();
|
||||||
|
// seq.setPredecessor(wd1);
|
||||||
|
// seq.setSuccessor(wd2);
|
||||||
|
// seq.setLinkType(WorkSequenceType.FINISH_TO_FINISH);
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(seq);
|
||||||
|
//
|
||||||
|
// // Ajouter une deuxième WorkSequence entre les deux WorkDefinitions
|
||||||
|
// WorkSequence seq2 = myFactory.createWorkSequence();
|
||||||
|
// seq2.setPredecessor(wd1);
|
||||||
|
// seq2.setSuccessor(wd2);
|
||||||
|
// seq2.setLinkType(WorkSequenceType.START_TO_START);
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(seq2);
|
||||||
|
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger le package SimplePDL afin de l'enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte Ã
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Définir la ressource (le modèle)
|
||||||
|
URI modelURI = URI.createURI("models/SimplePDLCreator_Created_Process.xmi");
|
||||||
|
Resource resource = resSet.createResource(modelURI);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de SimplePDL
|
||||||
|
SimplepdlFactory myFactory = SimplepdlFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Process
|
||||||
|
Process process = myFactory.createProcess();
|
||||||
|
process.setName("Mon premier processus");
|
||||||
|
|
||||||
|
// Ajouter le Process dans le modèle
|
||||||
|
resource.getContents().add(process);
|
||||||
|
|
||||||
|
// Ajouter deux WorkDefinitions
|
||||||
|
WorkDefinition wd1 = myFactory.createWorkDefinition();
|
||||||
|
wd1.setName("Ma première WorkDefinition, quelle émotion");
|
||||||
|
|
||||||
|
WorkDefinition wd2 = myFactory.createWorkDefinition();
|
||||||
|
wd2.setName("Ma deuxième WorkDefinition, toujours autant d'émotion");
|
||||||
|
|
||||||
|
process.getProcessElements().add(wd1);
|
||||||
|
process.getProcessElements().add(wd2);
|
||||||
|
|
||||||
|
// Ajouter une WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq = myFactory.createWorkSequence();
|
||||||
|
seq.setPredecessor(wd1);
|
||||||
|
seq.setSuccessor(wd2);
|
||||||
|
seq.setLinkType(WorkSequenceType.FINISH_TO_FINISH);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq);
|
||||||
|
|
||||||
|
// Ajouter une deuxième WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq2 = myFactory.createWorkSequence();
|
||||||
|
seq2.setPredecessor(wd1);
|
||||||
|
seq2.setSuccessor(wd2);
|
||||||
|
seq2.setLinkType(WorkSequenceType.START_TO_START);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq2);
|
||||||
|
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Définir la ressource (le modèle)
|
||||||
|
URI modelURI = URI.createURI("models/SimplePDL2PetriNET.xmi");
|
||||||
|
Resource resource = resSet.createResource(modelURI);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de SimplePDL
|
||||||
|
SimplepdlFactory myFactory = SimplepdlFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Process
|
||||||
|
Process process = myFactory.createProcess();
|
||||||
|
process.setName("Mon premier processus");
|
||||||
|
|
||||||
|
// Ajouter le Process dans le modèle
|
||||||
|
resource.getContents().add(process);
|
||||||
|
|
||||||
|
// Ajouter deux WorkDefinitions
|
||||||
|
WorkDefinition wd1 = myFactory.createWorkDefinition();
|
||||||
|
wd1.setName("Ma première WorkDefinition, quelle émotion");
|
||||||
|
|
||||||
|
WorkDefinition wd2 = myFactory.createWorkDefinition();
|
||||||
|
wd2.setName("Ma deuxième WorkDefinition, toujours autant d'émotion");
|
||||||
|
|
||||||
|
process.getProcessElements().add(wd1);
|
||||||
|
process.getProcessElements().add(wd2);
|
||||||
|
|
||||||
|
// Ajouter une WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq = myFactory.createWorkSequence();
|
||||||
|
seq.setPredecessor(wd1);
|
||||||
|
seq.setSuccessor(wd2);
|
||||||
|
seq.setLinkType(WorkSequenceType.FINISH_TO_FINISH);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq);
|
||||||
|
|
||||||
|
// Ajouter une deuxième WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq2 = myFactory.createWorkSequence();
|
||||||
|
seq2.setPredecessor(wd1);
|
||||||
|
seq2.setSuccessor(wd2);
|
||||||
|
seq2.setLinkType(WorkSequenceType.START_TO_START);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq2);
|
||||||
|
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,120 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Transition;
|
||||||
|
import petrinet.Arc;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
System.out.println(" - " + name);
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
idle.setTokens(1);
|
||||||
|
Place running = myFactory.createPlace();
|
||||||
|
running.setName(name + "_running");
|
||||||
|
running.setTokens(1);
|
||||||
|
Place finished = myFactory.createPlace();
|
||||||
|
finished.setName(name + "_finished");
|
||||||
|
finished.setTokens(1);
|
||||||
|
|
||||||
|
Arc pause2start = myFactory.createArc();
|
||||||
|
pause2start.setTarget(idle);
|
||||||
|
pause2start.setOutgoing(false);
|
||||||
|
pause2start.setWeight(1);
|
||||||
|
Arc start2running = myFactory.createArc();
|
||||||
|
start2running.setTarget(running);
|
||||||
|
start2running.setOutgoing(true);
|
||||||
|
start2running.setWeight(1);
|
||||||
|
Transition start = myFactory.createTransition();
|
||||||
|
start.setName(name + "_start");
|
||||||
|
start.getArcs().add(pause2start);
|
||||||
|
start.getArcs().add(start2running);
|
||||||
|
|
||||||
|
Arc running2finish = myFactory.createArc();
|
||||||
|
running2finish.setTarget(running);
|
||||||
|
running2finish.setOutgoing(false);
|
||||||
|
running2finish.setWeight(1);
|
||||||
|
Arc finish2finished = myFactory.createArc();
|
||||||
|
finish2finished.setTarget(finished);
|
||||||
|
finish2finished.setOutgoing(true);
|
||||||
|
finish2finished.setWeight(1);
|
||||||
|
Transition finish = myFactory.createTransition();
|
||||||
|
finish.setName(name + "_finish");
|
||||||
|
finish.getArcs().add(running2finish);
|
||||||
|
finish.getArcs().add(finish2finished);
|
||||||
|
|
||||||
|
network.getNodes().add(idle);
|
||||||
|
network.getNodes().add(start);
|
||||||
|
network.getNodes().add(running);
|
||||||
|
network.getNodes().add(finish);
|
||||||
|
network.getNodes().add(finished);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Créer le nouveau xmi (modèle convertit)
|
||||||
|
URI convURI = URI.createURI("test.xmi");
|
||||||
|
Resource conv = resSet.createResource(convURI);
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
conv.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,115 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Transition;
|
||||||
|
import petrinet.Arc;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("model/test.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
idle.setTokens(1);
|
||||||
|
Place running = myFactory.createPlace();
|
||||||
|
running.setName(name + "_running");
|
||||||
|
running.setTokens(1);
|
||||||
|
Place finished = myFactory.createPlace();
|
||||||
|
finished.setName(name + "_finished");
|
||||||
|
finished.setTokens(1);
|
||||||
|
|
||||||
|
Arc pause2start = myFactory.createArc();
|
||||||
|
pause2start.setTarget(idle);
|
||||||
|
pause2start.setOutgoing(false);
|
||||||
|
pause2start.setWeight(1);
|
||||||
|
Arc start2running = myFactory.createArc();
|
||||||
|
start2running.setTarget(running);
|
||||||
|
start2running.setOutgoing(true);
|
||||||
|
start2running.setWeight(1);
|
||||||
|
Transition start = myFactory.createTransition();
|
||||||
|
start.setName(name + "_start");
|
||||||
|
start.getArcs().add(pause2start);
|
||||||
|
start.getArcs().add(start2running);
|
||||||
|
|
||||||
|
Arc running2finish = myFactory.createArc();
|
||||||
|
running2finish.setTarget(running);
|
||||||
|
running2finish.setOutgoing(false);
|
||||||
|
running2finish.setWeight(1);
|
||||||
|
Arc finish2finished = myFactory.createArc();
|
||||||
|
finish2finished.setTarget(finished);
|
||||||
|
finish2finished.setOutgoing(true);
|
||||||
|
finish2finished.setWeight(1);
|
||||||
|
Transition finish = myFactory.createTransition();
|
||||||
|
finish.setName(name + "_finish");
|
||||||
|
finish.getArcs().add(running2finish);
|
||||||
|
finish.getArcs().add(finish2finished);
|
||||||
|
|
||||||
|
network.getNodes().add(idle);
|
||||||
|
network.getNodes().add(start);
|
||||||
|
network.getNodes().add(running);
|
||||||
|
network.getNodes().add(finish);
|
||||||
|
network.getNodes().add(finished);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,123 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Transition;
|
||||||
|
import petrinet.Arc;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
idle.setTokens(1);
|
||||||
|
Place running = myFactory.createPlace();
|
||||||
|
running.setName(name + "_running");
|
||||||
|
running.setTokens(1);
|
||||||
|
Place finished = myFactory.createPlace();
|
||||||
|
finished.setName(name + "_finished");
|
||||||
|
finished.setTokens(1);
|
||||||
|
|
||||||
|
Arc pause2start = myFactory.createArc();
|
||||||
|
pause2start.setTarget(idle);
|
||||||
|
pause2start.setOutgoing(false);
|
||||||
|
pause2start.setWeight(1);
|
||||||
|
Transition start = myFactory.createTransition();
|
||||||
|
start.setName(name + "_start");
|
||||||
|
|
||||||
|
Transition finish = myFactory.createTransition();
|
||||||
|
finish.setName(name + "_finish");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// // Ajouter le Process dans le modèle
|
||||||
|
// resource.getContents().add(process);
|
||||||
|
//
|
||||||
|
// // Ajouter deux WorkDefinitions
|
||||||
|
// WorkDefinition wd1 = myFactory.createWorkDefinition();
|
||||||
|
// wd1.setName("Ma première WorkDefinition, quelle émotion");
|
||||||
|
//
|
||||||
|
// WorkDefinition wd2 = myFactory.createWorkDefinition();
|
||||||
|
// wd2.setName("Ma deuxième WorkDefinition, toujours autant d'émotion");
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(wd1);
|
||||||
|
// process.getProcessElements().add(wd2);
|
||||||
|
//
|
||||||
|
// // Ajouter une WorkSequence entre les deux WorkDefinitions
|
||||||
|
// WorkSequence seq = myFactory.createWorkSequence();
|
||||||
|
// seq.setPredecessor(wd1);
|
||||||
|
// seq.setSuccessor(wd2);
|
||||||
|
// seq.setLinkType(WorkSequenceType.FINISH_TO_FINISH);
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(seq);
|
||||||
|
//
|
||||||
|
// // Ajouter une deuxième WorkSequence entre les deux WorkDefinitions
|
||||||
|
// WorkSequence seq2 = myFactory.createWorkSequence();
|
||||||
|
// seq2.setPredecessor(wd1);
|
||||||
|
// seq2.setSuccessor(wd2);
|
||||||
|
// seq2.setLinkType(WorkSequenceType.START_TO_START);
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(seq2);
|
||||||
|
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?xml version="1.0" encoding="ASCII"?>
|
||||||
|
<petrinet:Network xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:petrinet="http://petrinet" xsi:schemaLocation="http://petrinet petrinet.ecore" name="Developpement">
|
||||||
|
<nodes xsi:type="petrinet:Place" name="Conception_idle" tokens="1"/>
|
||||||
|
<nodes xsi:type="petrinet:Transition" name="Conception_start">
|
||||||
|
<arcs weight="1" target="//@nodes.0"/>
|
||||||
|
<arcs weight="1" outgoing="true" target="//@nodes.2"/>
|
||||||
|
</nodes>
|
||||||
|
<nodes xsi:type="petrinet:Place" name="Conception_running" tokens="1"/>
|
||||||
|
<nodes xsi:type="petrinet:Transition" name="Conception_finish">
|
||||||
|
<arcs weight="1" target="//@nodes.2"/>
|
||||||
|
<arcs weight="1" outgoing="true" target="//@nodes.4"/>
|
||||||
|
</nodes>
|
||||||
|
<nodes xsi:type="petrinet:Place" name="Conception_finished" tokens="1"/>
|
||||||
|
<nodes xsi:type="petrinet:Place" name="Programmation_idle" tokens="1"/>
|
||||||
|
<nodes xsi:type="petrinet:Transition" name="Programmation_start">
|
||||||
|
<arcs weight="1" target="//@nodes.5"/>
|
||||||
|
<arcs weight="1" outgoing="true" target="//@nodes.7"/>
|
||||||
|
</nodes>
|
||||||
|
<nodes xsi:type="petrinet:Place" name="Programmation_running" tokens="1"/>
|
||||||
|
<nodes xsi:type="petrinet:Transition" name="Programmation_finish">
|
||||||
|
<arcs weight="1" target="//@nodes.7"/>
|
||||||
|
<arcs weight="1" outgoing="true" target="//@nodes.9"/>
|
||||||
|
</nodes>
|
||||||
|
<nodes xsi:type="petrinet:Place" name="Programmation_finished" tokens="1"/>
|
||||||
|
<nodes xsi:type="petrinet:Place" name="RedactionTests_idle" tokens="1"/>
|
||||||
|
<nodes xsi:type="petrinet:Transition" name="RedactionTests_start">
|
||||||
|
<arcs weight="1" target="//@nodes.10"/>
|
||||||
|
<arcs weight="1" outgoing="true" target="//@nodes.12"/>
|
||||||
|
</nodes>
|
||||||
|
<nodes xsi:type="petrinet:Place" name="RedactionTests_running" tokens="1"/>
|
||||||
|
<nodes xsi:type="petrinet:Transition" name="RedactionTests_finish">
|
||||||
|
<arcs weight="1" target="//@nodes.12"/>
|
||||||
|
<arcs weight="1" outgoing="true" target="//@nodes.14"/>
|
||||||
|
</nodes>
|
||||||
|
<nodes xsi:type="petrinet:Place" name="RedactionTests_finished" tokens="1"/>
|
||||||
|
<nodes xsi:type="petrinet:Place" name="RedactionDocs_idle" tokens="1"/>
|
||||||
|
<nodes xsi:type="petrinet:Transition" name="RedactionDocs_start">
|
||||||
|
<arcs weight="1" target="//@nodes.15"/>
|
||||||
|
<arcs weight="1" outgoing="true" target="//@nodes.17"/>
|
||||||
|
</nodes>
|
||||||
|
<nodes xsi:type="petrinet:Place" name="RedactionDocs_running" tokens="1"/>
|
||||||
|
<nodes xsi:type="petrinet:Transition" name="RedactionDocs_finish">
|
||||||
|
<arcs weight="1" target="//@nodes.17"/>
|
||||||
|
<arcs weight="1" outgoing="true" target="//@nodes.19"/>
|
||||||
|
</nodes>
|
||||||
|
<nodes xsi:type="petrinet:Place" name="RedactionDocs_finished" tokens="1"/>
|
||||||
|
</petrinet:Network>
|
|
@ -0,0 +1,115 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Transition;
|
||||||
|
import petrinet.Arc;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
idle.setTokens(1);
|
||||||
|
Place running = myFactory.createPlace();
|
||||||
|
running.setName(name + "_running");
|
||||||
|
running.setTokens(1);
|
||||||
|
Place finished = myFactory.createPlace();
|
||||||
|
finished.setName(name + "_finished");
|
||||||
|
finished.setTokens(1);
|
||||||
|
|
||||||
|
Arc pause2start = myFactory.createArc();
|
||||||
|
pause2start.setTarget(idle);
|
||||||
|
pause2start.setOutgoing(false);
|
||||||
|
pause2start.setWeight(1);
|
||||||
|
Arc start2running = myFactory.createArc();
|
||||||
|
start2running.setTarget(running);
|
||||||
|
start2running.setOutgoing(true);
|
||||||
|
start2running.setWeight(1);
|
||||||
|
Transition start = myFactory.createTransition();
|
||||||
|
start.setName(name + "_start");
|
||||||
|
start.getArcs().add(pause2start);
|
||||||
|
start.getArcs().add(start2running);
|
||||||
|
|
||||||
|
Arc running2finish = myFactory.createArc();
|
||||||
|
running2finish.setTarget(running);
|
||||||
|
running2finish.setOutgoing(false);
|
||||||
|
running2finish.setWeight(1);
|
||||||
|
Arc finish2finished = myFactory.createArc();
|
||||||
|
finish2finished.setTarget(finished);
|
||||||
|
finish2finished.setOutgoing(true);
|
||||||
|
finish2finished.setWeight(1);
|
||||||
|
Transition finish = myFactory.createTransition();
|
||||||
|
finish.setName(name + "_finish");
|
||||||
|
finish.getArcs().add(running2finish);
|
||||||
|
finish.getArcs().add(finish2finished);
|
||||||
|
|
||||||
|
network.getNodes().add(idle);
|
||||||
|
network.getNodes().add(start);
|
||||||
|
network.getNodes().add(running);
|
||||||
|
network.getNodes().add(finish);
|
||||||
|
network.getNodes().add(finished);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<petrinet:Network
|
||||||
|
xmi:version="2.0"
|
||||||
|
xmlns:xmi="http://www.omg.org/XMI"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns:petrinet="http://petrinet"
|
||||||
|
xsi:schemaLocation="http://petrinet petrinet.ecore"
|
||||||
|
name="gentilleNetwork">
|
||||||
|
<nodes xsi:type="petrinet:Place"
|
||||||
|
name="debut"
|
||||||
|
tokens="1"/>
|
||||||
|
<nodes xsi:type="petrinet:Place"
|
||||||
|
name="fin"/>
|
||||||
|
<nodes xsi:type="petrinet:Transition"
|
||||||
|
name="debut2fin">
|
||||||
|
<arcs weight="1"
|
||||||
|
target="//@nodes.0"/>
|
||||||
|
<arcs weight="1"
|
||||||
|
outgoing="true"
|
||||||
|
target="//@nodes.1"/>
|
||||||
|
</nodes>
|
||||||
|
</petrinet:Network>
|
|
@ -0,0 +1,88 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Définir la ressource (le modèle)
|
||||||
|
URI modelURI = URI.createURI("models/SimplePDLCreator_Created_Process.xmi");
|
||||||
|
Resource resource = resSet.createResource(modelURI);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de SimplePDL
|
||||||
|
SimplepdlFactory myFactory = SimplepdlFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Process
|
||||||
|
Process process = myFactory.createProcess();
|
||||||
|
process.setName("Mon premier processus");
|
||||||
|
|
||||||
|
// Ajouter le Process dans le modèle
|
||||||
|
resource.getContents().add(process);
|
||||||
|
|
||||||
|
// Ajouter deux WorkDefinitions
|
||||||
|
WorkDefinition wd1 = myFactory.createWorkDefinition();
|
||||||
|
wd1.setName("Ma première WorkDefinition, quelle émotion");
|
||||||
|
|
||||||
|
WorkDefinition wd2 = myFactory.createWorkDefinition();
|
||||||
|
wd2.setName("Ma deuxième WorkDefinition, toujours autant d'émotion");
|
||||||
|
|
||||||
|
process.getProcessElements().add(wd1);
|
||||||
|
process.getProcessElements().add(wd2);
|
||||||
|
|
||||||
|
// Ajouter une WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq = myFactory.createWorkSequence();
|
||||||
|
seq.setPredecessor(wd1);
|
||||||
|
seq.setSuccessor(wd2);
|
||||||
|
seq.setLinkType(WorkSequenceType.FINISH_TO_FINISH);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq);
|
||||||
|
|
||||||
|
// Ajouter une deuxième WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq2 = myFactory.createWorkSequence();
|
||||||
|
seq2.setPredecessor(wd1);
|
||||||
|
seq2.setSuccessor(wd2);
|
||||||
|
seq2.setLinkType(WorkSequenceType.START_TO_START);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq2);
|
||||||
|
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,123 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Transition;
|
||||||
|
import petrinet.Arc;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resGet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resGet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
System.out.println(" - " + name);
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
idle.setTokens(1);
|
||||||
|
Place running = myFactory.createPlace();
|
||||||
|
running.setName(name + "_running");
|
||||||
|
running.setTokens(1);
|
||||||
|
Place finished = myFactory.createPlace();
|
||||||
|
finished.setName(name + "_finished");
|
||||||
|
finished.setTokens(1);
|
||||||
|
|
||||||
|
Arc pause2start = myFactory.createArc();
|
||||||
|
pause2start.setTarget(idle);
|
||||||
|
pause2start.setOutgoing(false);
|
||||||
|
pause2start.setWeight(1);
|
||||||
|
Arc start2running = myFactory.createArc();
|
||||||
|
start2running.setTarget(running);
|
||||||
|
start2running.setOutgoing(true);
|
||||||
|
start2running.setWeight(1);
|
||||||
|
Transition start = myFactory.createTransition();
|
||||||
|
start.setName(name + "_start");
|
||||||
|
start.getArcs().add(pause2start);
|
||||||
|
start.getArcs().add(start2running);
|
||||||
|
|
||||||
|
Arc running2finish = myFactory.createArc();
|
||||||
|
running2finish.setTarget(running);
|
||||||
|
running2finish.setOutgoing(false);
|
||||||
|
running2finish.setWeight(1);
|
||||||
|
Arc finish2finished = myFactory.createArc();
|
||||||
|
finish2finished.setTarget(finished);
|
||||||
|
finish2finished.setOutgoing(true);
|
||||||
|
finish2finished.setWeight(1);
|
||||||
|
Transition finish = myFactory.createTransition();
|
||||||
|
finish.setName(name + "_finish");
|
||||||
|
finish.getArcs().add(running2finish);
|
||||||
|
finish.getArcs().add(finish2finished);
|
||||||
|
|
||||||
|
network.getNodes().add(idle);
|
||||||
|
network.getNodes().add(start);
|
||||||
|
network.getNodes().add(running);
|
||||||
|
network.getNodes().add(finish);
|
||||||
|
network.getNodes().add(finished);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Créer le nouveau xmi (modèle convertit)
|
||||||
|
URI convURI = URI.createURI("test.xmi");
|
||||||
|
Resource conv = resSet.createResource(convURI);
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
conv.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de SimplePDL
|
||||||
|
SimplepdlFactory myFactory = SimplepdlFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Process
|
||||||
|
Process process = myFactory.createProcess();
|
||||||
|
process.setName("Mon premier processus");
|
||||||
|
|
||||||
|
// Ajouter le Process dans le modèle
|
||||||
|
resource.getContents().add(process);
|
||||||
|
|
||||||
|
// Ajouter deux WorkDefinitions
|
||||||
|
WorkDefinition wd1 = myFactory.createWorkDefinition();
|
||||||
|
wd1.setName("Ma première WorkDefinition, quelle émotion");
|
||||||
|
|
||||||
|
WorkDefinition wd2 = myFactory.createWorkDefinition();
|
||||||
|
wd2.setName("Ma deuxième WorkDefinition, toujours autant d'émotion");
|
||||||
|
|
||||||
|
process.getProcessElements().add(wd1);
|
||||||
|
process.getProcessElements().add(wd2);
|
||||||
|
|
||||||
|
// Ajouter une WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq = myFactory.createWorkSequence();
|
||||||
|
seq.setPredecessor(wd1);
|
||||||
|
seq.setSuccessor(wd2);
|
||||||
|
seq.setLinkType(WorkSequenceType.FINISH_TO_FINISH);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq);
|
||||||
|
|
||||||
|
// Ajouter une deuxième WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq2 = myFactory.createWorkSequence();
|
||||||
|
seq2.setPredecessor(wd1);
|
||||||
|
seq2.setSuccessor(wd2);
|
||||||
|
seq2.setLinkType(WorkSequenceType.START_TO_START);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq2);
|
||||||
|
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger le package SimplePDL afin de l'enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte Ã
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Définir la ressource (le modèle)
|
||||||
|
URI modelURI = URI.createURI("models/SimplePDLCreator_Created_Process.xmi");
|
||||||
|
Resource resource = resSet.createResource(modelURI);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de SimplePDL
|
||||||
|
SimplepdlFactory myFactory = SimplepdlFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Process
|
||||||
|
Process process = myFactory.createProcess();
|
||||||
|
process.setName("Mon premier processus");
|
||||||
|
|
||||||
|
// Ajouter le Process dans le modèle
|
||||||
|
resource.getContents().add(process);
|
||||||
|
|
||||||
|
// Ajouter deux WorkDefinitions
|
||||||
|
WorkDefinition wd1 = myFactory.createWorkDefinition();
|
||||||
|
wd1.setName("Ma première WorkDefinition, quelle émotion");
|
||||||
|
|
||||||
|
WorkDefinition wd2 = myFactory.createWorkDefinition();
|
||||||
|
wd2.setName("Ma deuxième WorkDefinition, toujours autant d'émotion");
|
||||||
|
|
||||||
|
process.getProcessElements().add(wd1);
|
||||||
|
process.getProcessElements().add(wd2);
|
||||||
|
|
||||||
|
// Ajouter une WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq = myFactory.createWorkSequence();
|
||||||
|
seq.setPredecessor(wd1);
|
||||||
|
seq.setSuccessor(wd2);
|
||||||
|
seq.setLinkType(WorkSequenceType.FINISH_TO_FINISH);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq);
|
||||||
|
|
||||||
|
// Ajouter une deuxième WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq2 = myFactory.createWorkSequence();
|
||||||
|
seq2.setPredecessor(wd1);
|
||||||
|
seq2.setSuccessor(wd2);
|
||||||
|
seq2.setLinkType(WorkSequenceType.START_TO_START);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq2);
|
||||||
|
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,121 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Transition;
|
||||||
|
import petrinet.Arc;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
System.out.println(" - " + name);
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
idle.setTokens(1);
|
||||||
|
Place running = myFactory.createPlace();
|
||||||
|
running.setName(name + "_running");
|
||||||
|
running.setTokens(1);
|
||||||
|
Place finished = myFactory.createPlace();
|
||||||
|
finished.setName(name + "_finished");
|
||||||
|
finished.setTokens(1);
|
||||||
|
|
||||||
|
Arc pause2start = myFactory.createArc();
|
||||||
|
pause2start.setTarget(idle);
|
||||||
|
pause2start.setOutgoing(false);
|
||||||
|
pause2start.setWeight(1);
|
||||||
|
Arc start2running = myFactory.createArc();
|
||||||
|
start2running.setTarget(running);
|
||||||
|
start2running.setOutgoing(true);
|
||||||
|
start2running.setWeight(1);
|
||||||
|
Transition start = myFactory.createTransition();
|
||||||
|
start.setName(name + "_start");
|
||||||
|
start.getArcs().add(pause2start);
|
||||||
|
start.getArcs().add(start2running);
|
||||||
|
|
||||||
|
Arc running2finish = myFactory.createArc();
|
||||||
|
running2finish.setTarget(running);
|
||||||
|
running2finish.setOutgoing(false);
|
||||||
|
running2finish.setWeight(1);
|
||||||
|
Arc finish2finished = myFactory.createArc();
|
||||||
|
finish2finished.setTarget(finished);
|
||||||
|
finish2finished.setOutgoing(true);
|
||||||
|
finish2finished.setWeight(1);
|
||||||
|
Transition finish = myFactory.createTransition();
|
||||||
|
finish.setName(name + "_finish");
|
||||||
|
finish.getArcs().add(running2finish);
|
||||||
|
finish.getArcs().add(finish2finished);
|
||||||
|
|
||||||
|
System.out.println(" + " + idle.getName() + " (" + idle.getTokens() + ")");
|
||||||
|
|
||||||
|
network.getNodes().add(idle);
|
||||||
|
network.getNodes().add(start);
|
||||||
|
network.getNodes().add(running);
|
||||||
|
network.getNodes().add(finish);
|
||||||
|
network.getNodes().add(finished);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Créer le nouveau xmi (modèle convertit)
|
||||||
|
URI convURI = URI.createURI("test.xmi");
|
||||||
|
Resource conv = resSet.createResource(convURI);
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
conv.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte Ã
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Définir la ressource (le modèle)
|
||||||
|
URI modelURI = URI.createURI("models/SimplePDLCreator_Created_Process.xmi");
|
||||||
|
Resource resource = resSet.createResource(modelURI);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de SimplePDL
|
||||||
|
SimplepdlFactory myFactory = SimplepdlFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Process
|
||||||
|
Process process = myFactory.createProcess();
|
||||||
|
process.setName("Mon premier processus");
|
||||||
|
|
||||||
|
// Ajouter le Process dans le modèle
|
||||||
|
resource.getContents().add(process);
|
||||||
|
|
||||||
|
// Ajouter deux WorkDefinitions
|
||||||
|
WorkDefinition wd1 = myFactory.createWorkDefinition();
|
||||||
|
wd1.setName("Ma première WorkDefinition, quelle émotion");
|
||||||
|
|
||||||
|
WorkDefinition wd2 = myFactory.createWorkDefinition();
|
||||||
|
wd2.setName("Ma deuxième WorkDefinition, toujours autant d'émotion");
|
||||||
|
|
||||||
|
process.getProcessElements().add(wd1);
|
||||||
|
process.getProcessElements().add(wd2);
|
||||||
|
|
||||||
|
// Ajouter une WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq = myFactory.createWorkSequence();
|
||||||
|
seq.setPredecessor(wd1);
|
||||||
|
seq.setSuccessor(wd2);
|
||||||
|
seq.setLinkType(WorkSequenceType.FINISH_TO_FINISH);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq);
|
||||||
|
|
||||||
|
// Ajouter une deuxième WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq2 = myFactory.createWorkSequence();
|
||||||
|
seq2.setPredecessor(wd1);
|
||||||
|
seq2.setSuccessor(wd2);
|
||||||
|
seq2.setLinkType(WorkSequenceType.START_TO_START);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq2);
|
||||||
|
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
|
||||||
|
//
|
||||||
|
// // Ajouter le Process dans le modèle
|
||||||
|
// resource.getContents().add(process);
|
||||||
|
//
|
||||||
|
// // Ajouter deux WorkDefinitions
|
||||||
|
// WorkDefinition wd1 = myFactory.createWorkDefinition();
|
||||||
|
// wd1.setName("Ma première WorkDefinition, quelle émotion");
|
||||||
|
//
|
||||||
|
// WorkDefinition wd2 = myFactory.createWorkDefinition();
|
||||||
|
// wd2.setName("Ma deuxième WorkDefinition, toujours autant d'émotion");
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(wd1);
|
||||||
|
// process.getProcessElements().add(wd2);
|
||||||
|
//
|
||||||
|
// // Ajouter une WorkSequence entre les deux WorkDefinitions
|
||||||
|
// WorkSequence seq = myFactory.createWorkSequence();
|
||||||
|
// seq.setPredecessor(wd1);
|
||||||
|
// seq.setSuccessor(wd2);
|
||||||
|
// seq.setLinkType(WorkSequenceType.FINISH_TO_FINISH);
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(seq);
|
||||||
|
//
|
||||||
|
// // Ajouter une deuxième WorkSequence entre les deux WorkDefinitions
|
||||||
|
// WorkSequence seq2 = myFactory.createWorkSequence();
|
||||||
|
// seq2.setPredecessor(wd1);
|
||||||
|
// seq2.setSuccessor(wd2);
|
||||||
|
// seq2.setLinkType(WorkSequenceType.START_TO_START);
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(seq2);
|
||||||
|
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,119 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Transition;
|
||||||
|
import petrinet.Arc;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Créer la ressource (modèle convertit)
|
||||||
|
URI convURI = URI.createURI("test.xmi");
|
||||||
|
Resource conv = resSet.getResource(convURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
idle.setTokens(1);
|
||||||
|
Place running = myFactory.createPlace();
|
||||||
|
running.setName(name + "_running");
|
||||||
|
running.setTokens(1);
|
||||||
|
Place finished = myFactory.createPlace();
|
||||||
|
finished.setName(name + "_finished");
|
||||||
|
finished.setTokens(1);
|
||||||
|
|
||||||
|
Arc pause2start = myFactory.createArc();
|
||||||
|
pause2start.setTarget(idle);
|
||||||
|
pause2start.setOutgoing(false);
|
||||||
|
pause2start.setWeight(1);
|
||||||
|
Arc start2running = myFactory.createArc();
|
||||||
|
start2running.setTarget(running);
|
||||||
|
start2running.setOutgoing(true);
|
||||||
|
start2running.setWeight(1);
|
||||||
|
Transition start = myFactory.createTransition();
|
||||||
|
start.setName(name + "_start");
|
||||||
|
start.getArcs().add(pause2start);
|
||||||
|
start.getArcs().add(start2running);
|
||||||
|
|
||||||
|
Arc running2finish = myFactory.createArc();
|
||||||
|
running2finish.setTarget(running);
|
||||||
|
running2finish.setOutgoing(false);
|
||||||
|
running2finish.setWeight(1);
|
||||||
|
Arc finish2finished = myFactory.createArc();
|
||||||
|
finish2finished.setTarget(finished);
|
||||||
|
finish2finished.setOutgoing(true);
|
||||||
|
finish2finished.setWeight(1);
|
||||||
|
Transition finish = myFactory.createTransition();
|
||||||
|
finish.setName(name + "_finish");
|
||||||
|
finish.getArcs().add(running2finish);
|
||||||
|
finish.getArcs().add(finish2finished);
|
||||||
|
|
||||||
|
network.getNodes().add(idle);
|
||||||
|
network.getNodes().add(start);
|
||||||
|
network.getNodes().add(running);
|
||||||
|
network.getNodes().add(finish);
|
||||||
|
network.getNodes().add(finished);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
conv.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,119 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Transition;
|
||||||
|
import petrinet.Arc;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Créer la ressource (modèle convertit)
|
||||||
|
URI convURI = URI.createURI("test.xmi");
|
||||||
|
Resource conv = resSet.createResource(convURI);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
idle.setTokens(1);
|
||||||
|
Place running = myFactory.createPlace();
|
||||||
|
running.setName(name + "_running");
|
||||||
|
running.setTokens(1);
|
||||||
|
Place finished = myFactory.createPlace();
|
||||||
|
finished.setName(name + "_finished");
|
||||||
|
finished.setTokens(1);
|
||||||
|
|
||||||
|
Arc pause2start = myFactory.createArc();
|
||||||
|
pause2start.setTarget(idle);
|
||||||
|
pause2start.setOutgoing(false);
|
||||||
|
pause2start.setWeight(1);
|
||||||
|
Arc start2running = myFactory.createArc();
|
||||||
|
start2running.setTarget(running);
|
||||||
|
start2running.setOutgoing(true);
|
||||||
|
start2running.setWeight(1);
|
||||||
|
Transition start = myFactory.createTransition();
|
||||||
|
start.setName(name + "_start");
|
||||||
|
start.getArcs().add(pause2start);
|
||||||
|
start.getArcs().add(start2running);
|
||||||
|
|
||||||
|
Arc running2finish = myFactory.createArc();
|
||||||
|
running2finish.setTarget(running);
|
||||||
|
running2finish.setOutgoing(false);
|
||||||
|
running2finish.setWeight(1);
|
||||||
|
Arc finish2finished = myFactory.createArc();
|
||||||
|
finish2finished.setTarget(finished);
|
||||||
|
finish2finished.setOutgoing(true);
|
||||||
|
finish2finished.setWeight(1);
|
||||||
|
Transition finish = myFactory.createTransition();
|
||||||
|
finish.setName(name + "_finish");
|
||||||
|
finish.getArcs().add(running2finish);
|
||||||
|
finish.getArcs().add(finish2finished);
|
||||||
|
|
||||||
|
network.getNodes().add(idle);
|
||||||
|
network.getNodes().add(start);
|
||||||
|
network.getNodes().add(running);
|
||||||
|
network.getNodes().add(finish);
|
||||||
|
network.getNodes().add(finished);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
conv.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,119 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Transition;
|
||||||
|
import petrinet.Arc;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Créer la ressource (modèle convertit)
|
||||||
|
URI convURI = URI.createURI("test.xmi");
|
||||||
|
Resource conv = resSet.getResource(convURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
idle.setTokens(1);
|
||||||
|
Place running = myFactory.createPlace();
|
||||||
|
running.setName(name + "_running");
|
||||||
|
running.setTokens(1);
|
||||||
|
Place finished = myFactory.createPlace();
|
||||||
|
finished.setName(name + "_finished");
|
||||||
|
finished.setTokens(1);
|
||||||
|
|
||||||
|
Arc pause2start = myFactory.createArc();
|
||||||
|
pause2start.setTarget(idle);
|
||||||
|
pause2start.setOutgoing(false);
|
||||||
|
pause2start.setWeight(1);
|
||||||
|
Arc start2running = myFactory.createArc();
|
||||||
|
start2running.setTarget(running);
|
||||||
|
start2running.setOutgoing(true);
|
||||||
|
start2running.setWeight(1);
|
||||||
|
Transition start = myFactory.createTransition();
|
||||||
|
start.setName(name + "_start");
|
||||||
|
start.getArcs().add(pause2start);
|
||||||
|
start.getArcs().add(start2running);
|
||||||
|
|
||||||
|
Arc running2finish = myFactory.createArc();
|
||||||
|
running2finish.setTarget(running);
|
||||||
|
running2finish.setOutgoing(false);
|
||||||
|
running2finish.setWeight(1);
|
||||||
|
Arc finish2finished = myFactory.createArc();
|
||||||
|
finish2finished.setTarget(finished);
|
||||||
|
finish2finished.setOutgoing(true);
|
||||||
|
finish2finished.setWeight(1);
|
||||||
|
Transition finish = myFactory.createTransition();
|
||||||
|
finish.setName(name + "_finish");
|
||||||
|
finish.getArcs().add(running2finish);
|
||||||
|
finish.getArcs().add(finish2finished);
|
||||||
|
|
||||||
|
network.getNodes().add(idle);
|
||||||
|
network.getNodes().add(start);
|
||||||
|
network.getNodes().add(running);
|
||||||
|
network.getNodes().add(finish);
|
||||||
|
network.getNodes().add(finished);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,125 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Transition;
|
||||||
|
import petrinet.Arc;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resGet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resGet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
System.out.println(" - " + name);
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
idle.setTokens(1);
|
||||||
|
Place running = myFactory.createPlace();
|
||||||
|
running.setName(name + "_running");
|
||||||
|
running.setTokens(1);
|
||||||
|
Place finished = myFactory.createPlace();
|
||||||
|
finished.setName(name + "_finished");
|
||||||
|
finished.setTokens(1);
|
||||||
|
|
||||||
|
Arc pause2start = myFactory.createArc();
|
||||||
|
pause2start.setTarget(idle);
|
||||||
|
pause2start.setOutgoing(false);
|
||||||
|
pause2start.setWeight(1);
|
||||||
|
Arc start2running = myFactory.createArc();
|
||||||
|
start2running.setTarget(running);
|
||||||
|
start2running.setOutgoing(true);
|
||||||
|
start2running.setWeight(1);
|
||||||
|
Transition start = myFactory.createTransition();
|
||||||
|
start.setName(name + "_start");
|
||||||
|
start.getArcs().add(pause2start);
|
||||||
|
start.getArcs().add(start2running);
|
||||||
|
|
||||||
|
Arc running2finish = myFactory.createArc();
|
||||||
|
running2finish.setTarget(running);
|
||||||
|
running2finish.setOutgoing(false);
|
||||||
|
running2finish.setWeight(1);
|
||||||
|
Arc finish2finished = myFactory.createArc();
|
||||||
|
finish2finished.setTarget(finished);
|
||||||
|
finish2finished.setOutgoing(true);
|
||||||
|
finish2finished.setWeight(1);
|
||||||
|
Transition finish = myFactory.createTransition();
|
||||||
|
finish.setName(name + "_finish");
|
||||||
|
finish.getArcs().add(running2finish);
|
||||||
|
finish.getArcs().add(finish2finished);
|
||||||
|
|
||||||
|
System.out.println(" + " + idle.getName() + " (" + idle.getTokens() + ")");
|
||||||
|
|
||||||
|
network.getNodes().add(idle);
|
||||||
|
network.getNodes().add(start);
|
||||||
|
network.getNodes().add(running);
|
||||||
|
network.getNodes().add(finish);
|
||||||
|
network.getNodes().add(finished);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Créer le nouveau xmi (modèle convertit)
|
||||||
|
URI convURI = URI.createURI("test.xmi");
|
||||||
|
Resource conv = resSet.createResource(convURI);
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
conv.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Process
|
||||||
|
Process process = myFactory.createProcess();
|
||||||
|
process.setName("Mon premier processus");
|
||||||
|
|
||||||
|
// Ajouter le Process dans le modèle
|
||||||
|
resource.getContents().add(process);
|
||||||
|
|
||||||
|
// Ajouter deux WorkDefinitions
|
||||||
|
WorkDefinition wd1 = myFactory.createWorkDefinition();
|
||||||
|
wd1.setName("Ma première WorkDefinition, quelle émotion");
|
||||||
|
|
||||||
|
WorkDefinition wd2 = myFactory.createWorkDefinition();
|
||||||
|
wd2.setName("Ma deuxième WorkDefinition, toujours autant d'émotion");
|
||||||
|
|
||||||
|
process.getProcessElements().add(wd1);
|
||||||
|
process.getProcessElements().add(wd2);
|
||||||
|
|
||||||
|
// Ajouter une WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq = myFactory.createWorkSequence();
|
||||||
|
seq.setPredecessor(wd1);
|
||||||
|
seq.setSuccessor(wd2);
|
||||||
|
seq.setLinkType(WorkSequenceType.FINISH_TO_FINISH);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq);
|
||||||
|
|
||||||
|
// Ajouter une deuxième WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq2 = myFactory.createWorkSequence();
|
||||||
|
seq2.setPredecessor(wd1);
|
||||||
|
seq2.setSuccessor(wd2);
|
||||||
|
seq2.setLinkType(WorkSequenceType.START_TO_START);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq2);
|
||||||
|
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,120 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Transition;
|
||||||
|
import petrinet.Arc;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Créer la ressource (modèle convertit)
|
||||||
|
URI convURI = URI.createURI("test.xmi");
|
||||||
|
Resource conv = resSet.createResource(convURI);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
System.out.println(" - " + name);
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
idle.setTokens(1);
|
||||||
|
Place running = myFactory.createPlace();
|
||||||
|
running.setName(name + "_running");
|
||||||
|
running.setTokens(1);
|
||||||
|
Place finished = myFactory.createPlace();
|
||||||
|
finished.setName(name + "_finished");
|
||||||
|
finished.setTokens(1);
|
||||||
|
|
||||||
|
Arc pause2start = myFactory.createArc();
|
||||||
|
pause2start.setTarget(idle);
|
||||||
|
pause2start.setOutgoing(false);
|
||||||
|
pause2start.setWeight(1);
|
||||||
|
Arc start2running = myFactory.createArc();
|
||||||
|
start2running.setTarget(running);
|
||||||
|
start2running.setOutgoing(true);
|
||||||
|
start2running.setWeight(1);
|
||||||
|
Transition start = myFactory.createTransition();
|
||||||
|
start.setName(name + "_start");
|
||||||
|
start.getArcs().add(pause2start);
|
||||||
|
start.getArcs().add(start2running);
|
||||||
|
|
||||||
|
Arc running2finish = myFactory.createArc();
|
||||||
|
running2finish.setTarget(running);
|
||||||
|
running2finish.setOutgoing(false);
|
||||||
|
running2finish.setWeight(1);
|
||||||
|
Arc finish2finished = myFactory.createArc();
|
||||||
|
finish2finished.setTarget(finished);
|
||||||
|
finish2finished.setOutgoing(true);
|
||||||
|
finish2finished.setWeight(1);
|
||||||
|
Transition finish = myFactory.createTransition();
|
||||||
|
finish.setName(name + "_finish");
|
||||||
|
finish.getArcs().add(running2finish);
|
||||||
|
finish.getArcs().add(finish2finished);
|
||||||
|
|
||||||
|
network.getNodes().add(idle);
|
||||||
|
network.getNodes().add(start);
|
||||||
|
network.getNodes().add(running);
|
||||||
|
network.getNodes().add(finish);
|
||||||
|
network.getNodes().add(finished);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
conv.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
//
|
||||||
|
// // Ajouter le Process dans le modèle
|
||||||
|
// resource.getContents().add(process);
|
||||||
|
//
|
||||||
|
// // Ajouter deux WorkDefinitions
|
||||||
|
// WorkDefinition wd1 = myFactory.createWorkDefinition();
|
||||||
|
// wd1.setName("Ma première WorkDefinition, quelle émotion");
|
||||||
|
//
|
||||||
|
// WorkDefinition wd2 = myFactory.createWorkDefinition();
|
||||||
|
// wd2.setName("Ma deuxième WorkDefinition, toujours autant d'émotion");
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(wd1);
|
||||||
|
// process.getProcessElements().add(wd2);
|
||||||
|
//
|
||||||
|
// // Ajouter une WorkSequence entre les deux WorkDefinitions
|
||||||
|
// WorkSequence seq = myFactory.createWorkSequence();
|
||||||
|
// seq.setPredecessor(wd1);
|
||||||
|
// seq.setSuccessor(wd2);
|
||||||
|
// seq.setLinkType(WorkSequenceType.FINISH_TO_FINISH);
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(seq);
|
||||||
|
//
|
||||||
|
// // Ajouter une deuxième WorkSequence entre les deux WorkDefinitions
|
||||||
|
// WorkSequence seq2 = myFactory.createWorkSequence();
|
||||||
|
// seq2.setPredecessor(wd1);
|
||||||
|
// seq2.setSuccessor(wd2);
|
||||||
|
// seq2.setLinkType(WorkSequenceType.START_TO_START);
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(seq2);
|
||||||
|
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Définir la ressource (le modèle)
|
||||||
|
URI modelURI = URI.createURI("models/SimplePDLCreator_Created_Process.xmi");
|
||||||
|
Resource resource = resSet.createResource(modelURI);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de SimplePDL
|
||||||
|
SimplepdlFactory myFactory = SimplepdlFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Process
|
||||||
|
Process process = myFactory.createProcess();
|
||||||
|
process.setName("Mon premier processus");
|
||||||
|
|
||||||
|
// Ajouter le Process dans le modèle
|
||||||
|
resource.getContents().add(process);
|
||||||
|
|
||||||
|
// Ajouter deux WorkDefinitions
|
||||||
|
WorkDefinition wd1 = myFactory.createWorkDefinition();
|
||||||
|
wd1.setName("Ma première WorkDefinition, quelle émotion");
|
||||||
|
|
||||||
|
WorkDefinition wd2 = myFactory.createWorkDefinition();
|
||||||
|
wd2.setName("Ma deuxième WorkDefinition, toujours autant d'émotion");
|
||||||
|
|
||||||
|
process.getProcessElements().add(wd1);
|
||||||
|
process.getProcessElements().add(wd2);
|
||||||
|
|
||||||
|
// Ajouter une WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq = myFactory.createWorkSequence();
|
||||||
|
seq.setPredecessor(wd1);
|
||||||
|
seq.setSuccessor(wd2);
|
||||||
|
seq.setLinkType(WorkSequenceType.FINISH_TO_FINISH);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq);
|
||||||
|
|
||||||
|
// Ajouter une deuxième WorkSequence entre les deux WorkDefinitions
|
||||||
|
WorkSequence seq2 = myFactory.createWorkSequence();
|
||||||
|
seq2.setPredecessor(wd1);
|
||||||
|
seq2.setSuccessor(wd2);
|
||||||
|
seq2.setLinkType(WorkSequenceType.START_TO_START);
|
||||||
|
|
||||||
|
process.getProcessElements().add(seq2);
|
||||||
|
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,122 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Transition;
|
||||||
|
import petrinet.Arc;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
System.out.println(" - " + name);
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
idle.setTokens(1);
|
||||||
|
Place running = myFactory.createPlace();
|
||||||
|
running.setName(name + "_running");
|
||||||
|
running.setTokens(1);
|
||||||
|
Place finished = myFactory.createPlace();
|
||||||
|
finished.setName(name + "_finished");
|
||||||
|
finished.setTokens(1);
|
||||||
|
|
||||||
|
Arc pause2start = myFactory.createArc();
|
||||||
|
pause2start.setTarget(idle);
|
||||||
|
pause2start.setOutgoing(false);
|
||||||
|
pause2start.setWeight(1);
|
||||||
|
Arc start2running = myFactory.createArc();
|
||||||
|
start2running.setTarget(running);
|
||||||
|
start2running.setOutgoing(true);
|
||||||
|
start2running.setWeight(1);
|
||||||
|
Transition start = myFactory.createTransition();
|
||||||
|
start.setName(name + "_start");
|
||||||
|
start.getArcs().add(pause2start);
|
||||||
|
start.getArcs().add(start2running);
|
||||||
|
|
||||||
|
Arc running2finish = myFactory.createArc();
|
||||||
|
running2finish.setTarget(running);
|
||||||
|
running2finish.setOutgoing(false);
|
||||||
|
running2finish.setWeight(1);
|
||||||
|
Arc finish2finished = myFactory.createArc();
|
||||||
|
finish2finished.setTarget(finished);
|
||||||
|
finish2finished.setOutgoing(true);
|
||||||
|
finish2finished.setWeight(1);
|
||||||
|
Transition finish = myFactory.createTransition();
|
||||||
|
finish.setName(name + "_finish");
|
||||||
|
finish.getArcs().add(running2finish);
|
||||||
|
finish.getArcs().add(finish2finished);
|
||||||
|
|
||||||
|
System.out.println(" + " + idle.getName() + " (" + idle.getTokens() + ")");
|
||||||
|
|
||||||
|
network.getNodes().add(idle);
|
||||||
|
network.getNodes().add(start);
|
||||||
|
network.getNodes().add(running);
|
||||||
|
network.getNodes().add(finish);
|
||||||
|
network.getNodes().add(finished);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Créer le nouveau xmi (modèle convertit)
|
||||||
|
URI convURI = URI.createURI("test.xmi");
|
||||||
|
Resource conv = resSet.createResource(convURI);
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
conv.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,139 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Transition;
|
||||||
|
import petrinet.Arc;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
idle.setTokens(1);
|
||||||
|
Place running = myFactory.createPlace();
|
||||||
|
running.setName(name + "_running");
|
||||||
|
running.setTokens(1);
|
||||||
|
Place finished = myFactory.createPlace();
|
||||||
|
finished.setName(name + "_finished");
|
||||||
|
finished.setTokens(1);
|
||||||
|
|
||||||
|
Arc pause2start = myFactory.createArc();
|
||||||
|
pause2start.setTarget(idle);
|
||||||
|
pause2start.setOutgoing(false);
|
||||||
|
pause2start.setWeight(1);
|
||||||
|
Arc start2running = myFactory.createArc();
|
||||||
|
start2running.setTarget(running);
|
||||||
|
start2running.setOutgoing(true);
|
||||||
|
start2running.setWeight(1);
|
||||||
|
Transition start = myFactory.createTransition();
|
||||||
|
start.setName(name + "_start");
|
||||||
|
start.getArcs().add(pause2start);
|
||||||
|
start.getArcs().add(start2running);
|
||||||
|
|
||||||
|
Arc running2finish = myFactory.createArc();
|
||||||
|
running2finish.setTarget(running);
|
||||||
|
running2finish.setOutgoing(false);
|
||||||
|
running2finish.setWeight(1);
|
||||||
|
Arc finish2finished = myFactory.createArc();
|
||||||
|
finish2finished.setTarget(finished);
|
||||||
|
finish2finished.setOutgoing(true);
|
||||||
|
finish2finished.setWeight(1);
|
||||||
|
Transition finish = myFactory.createTransition();
|
||||||
|
finish.setName(name + "_finish");
|
||||||
|
finish.getArcs().add(running2finish);
|
||||||
|
finish.getArcs().add(finish2finished);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// // Ajouter le Process dans le modèle
|
||||||
|
// resource.getContents().add(process);
|
||||||
|
//
|
||||||
|
// // Ajouter deux WorkDefinitions
|
||||||
|
// WorkDefinition wd1 = myFactory.createWorkDefinition();
|
||||||
|
// wd1.setName("Ma première WorkDefinition, quelle émotion");
|
||||||
|
//
|
||||||
|
// WorkDefinition wd2 = myFactory.createWorkDefinition();
|
||||||
|
// wd2.setName("Ma deuxième WorkDefinition, toujours autant d'émotion");
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(wd1);
|
||||||
|
// process.getProcessElements().add(wd2);
|
||||||
|
//
|
||||||
|
// // Ajouter une WorkSequence entre les deux WorkDefinitions
|
||||||
|
// WorkSequence seq = myFactory.createWorkSequence();
|
||||||
|
// seq.setPredecessor(wd1);
|
||||||
|
// seq.setSuccessor(wd2);
|
||||||
|
// seq.setLinkType(WorkSequenceType.FINISH_TO_FINISH);
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(seq);
|
||||||
|
//
|
||||||
|
// // Ajouter une deuxième WorkSequence entre les deux WorkDefinitions
|
||||||
|
// WorkSequence seq2 = myFactory.createWorkSequence();
|
||||||
|
// seq2.setPredecessor(wd1);
|
||||||
|
// seq2.setSuccessor(wd2);
|
||||||
|
// seq2.setLinkType(WorkSequenceType.START_TO_START);
|
||||||
|
//
|
||||||
|
// process.getProcessElements().add(seq2);
|
||||||
|
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,119 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Transition;
|
||||||
|
import petrinet.Arc;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Créer la ressource (modèle convertit)
|
||||||
|
URI modelURI = URI.createURI("test.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
idle.setTokens(1);
|
||||||
|
Place running = myFactory.createPlace();
|
||||||
|
running.setName(name + "_running");
|
||||||
|
running.setTokens(1);
|
||||||
|
Place finished = myFactory.createPlace();
|
||||||
|
finished.setName(name + "_finished");
|
||||||
|
finished.setTokens(1);
|
||||||
|
|
||||||
|
Arc pause2start = myFactory.createArc();
|
||||||
|
pause2start.setTarget(idle);
|
||||||
|
pause2start.setOutgoing(false);
|
||||||
|
pause2start.setWeight(1);
|
||||||
|
Arc start2running = myFactory.createArc();
|
||||||
|
start2running.setTarget(running);
|
||||||
|
start2running.setOutgoing(true);
|
||||||
|
start2running.setWeight(1);
|
||||||
|
Transition start = myFactory.createTransition();
|
||||||
|
start.setName(name + "_start");
|
||||||
|
start.getArcs().add(pause2start);
|
||||||
|
start.getArcs().add(start2running);
|
||||||
|
|
||||||
|
Arc running2finish = myFactory.createArc();
|
||||||
|
running2finish.setTarget(running);
|
||||||
|
running2finish.setOutgoing(false);
|
||||||
|
running2finish.setWeight(1);
|
||||||
|
Arc finish2finished = myFactory.createArc();
|
||||||
|
finish2finished.setTarget(finished);
|
||||||
|
finish2finished.setOutgoing(true);
|
||||||
|
finish2finished.setWeight(1);
|
||||||
|
Transition finish = myFactory.createTransition();
|
||||||
|
finish.setName(name + "_finish");
|
||||||
|
finish.getArcs().add(running2finish);
|
||||||
|
finish.getArcs().add(finish2finished);
|
||||||
|
|
||||||
|
network.getNodes().add(idle);
|
||||||
|
network.getNodes().add(start);
|
||||||
|
network.getNodes().add(running);
|
||||||
|
network.getNodes().add(finish);
|
||||||
|
network.getNodes().add(finished);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,115 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Transition;
|
||||||
|
import petrinet.Arc;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resSet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
idle.setTokens(1);
|
||||||
|
Place running = myFactory.createPlace();
|
||||||
|
running.setName(name + "_running");
|
||||||
|
running.setTokens(1);
|
||||||
|
Place finished = myFactory.createPlace();
|
||||||
|
finished.setName(name + "_finished");
|
||||||
|
finished.setTokens(1);
|
||||||
|
|
||||||
|
Arc pause2start = myFactory.createArc();
|
||||||
|
pause2start.setTarget(idle);
|
||||||
|
pause2start.setOutgoing(false);
|
||||||
|
pause2start.setWeight(1);
|
||||||
|
Arc start2running = myFactory.createArc();
|
||||||
|
start2running.setTarget(running);
|
||||||
|
start2running.setOutgoing(true);
|
||||||
|
start2running.setWeight(1);
|
||||||
|
Transition start = myFactory.createTransition();
|
||||||
|
start.setName(name + "_start");
|
||||||
|
start.getArcs().add(pause2start);
|
||||||
|
start.getArcs().add(start2running);
|
||||||
|
|
||||||
|
Arc running2finish = myFactory.createArc();
|
||||||
|
running2finish.setTarget(running);
|
||||||
|
running2finish.setOutgoing(false);
|
||||||
|
running2finish.setWeight(1);
|
||||||
|
Arc finish2finished = myFactory.createArc();
|
||||||
|
finish2finished.setTarget(finished);
|
||||||
|
finish2finished.setOutgoing(true);
|
||||||
|
finish2finished.setWeight(1);
|
||||||
|
Transition finish = myFactory.createTransition();
|
||||||
|
finish.setName(name + "_finish");
|
||||||
|
finish.getArcs().add(running2finish);
|
||||||
|
finish.getArcs().add(finish2finished);
|
||||||
|
|
||||||
|
network.getNodes().add(idle);
|
||||||
|
network.getNodes().add(start);
|
||||||
|
network.getNodes().add(running);
|
||||||
|
network.getNodes().add(finish);
|
||||||
|
network.getNodes().add(finished);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
resource.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,125 @@
|
||||||
|
package simplepdl.manip;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
|
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||||
|
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
|
||||||
|
|
||||||
|
import petrinet.PetrinetPackage;
|
||||||
|
import petrinet.Place;
|
||||||
|
import petrinet.Transition;
|
||||||
|
import petrinet.Arc;
|
||||||
|
import petrinet.Network;
|
||||||
|
import petrinet.PetrinetFactory;
|
||||||
|
import simplepdl.Process;
|
||||||
|
import simplepdl.WorkDefinition;
|
||||||
|
import simplepdl.WorkSequence;
|
||||||
|
import simplepdl.WorkSequenceType;
|
||||||
|
import simplepdl.SimplepdlFactory;
|
||||||
|
import simplepdl.SimplepdlPackage;
|
||||||
|
|
||||||
|
public class simplepdl2petrinet {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// Charger les package SimplePDL et Petrinet afin de les enregistrer dans le registre d'Eclipse.
|
||||||
|
SimplepdlPackage packageInstance = SimplepdlPackage.eINSTANCE;
|
||||||
|
PetrinetPackage packageInstance2 = PetrinetPackage.eINSTANCE;
|
||||||
|
|
||||||
|
// Enregistrer l'extension ".xmi" comme devant être ouverte à
|
||||||
|
// l'aide d'un objet "XMIResourceFactoryImpl"
|
||||||
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
|
||||||
|
Map<String, Object> m = reg.getExtensionToFactoryMap();
|
||||||
|
m.put("xmi", new XMIResourceFactoryImpl());
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resGet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Charger la ressource (notre modèle)
|
||||||
|
URI modelURI = URI.createURI("pdl-sujet.xmi");
|
||||||
|
Resource resource = resGet.getResource(modelURI, true);
|
||||||
|
|
||||||
|
// Récupérer le premier élément du modèle (élément racine)
|
||||||
|
Process process = (Process) resource.getContents().get(0);
|
||||||
|
|
||||||
|
// La fabrique pour fabriquer les éléments de PetriNET
|
||||||
|
PetrinetFactory myFactory = PetrinetFactory.eINSTANCE;
|
||||||
|
|
||||||
|
// Créer un élément Network
|
||||||
|
Network network = myFactory.createNetwork();
|
||||||
|
network.setName(process.getName());
|
||||||
|
|
||||||
|
// Conversion des WorkDefinition en Node et Transition
|
||||||
|
for (Object o : process.getProcessElements()) {
|
||||||
|
if (o instanceof WorkDefinition) {
|
||||||
|
WorkDefinition wd = (WorkDefinition) o;
|
||||||
|
String name = wd.getName();
|
||||||
|
System.out.println(" - " + name);
|
||||||
|
|
||||||
|
Place idle = myFactory.createPlace();
|
||||||
|
idle.setName(name + "_idle");
|
||||||
|
idle.setTokens(1);
|
||||||
|
Place running = myFactory.createPlace();
|
||||||
|
running.setName(name + "_running");
|
||||||
|
running.setTokens(1);
|
||||||
|
Place finished = myFactory.createPlace();
|
||||||
|
finished.setName(name + "_finished");
|
||||||
|
finished.setTokens(1);
|
||||||
|
|
||||||
|
Arc pause2start = myFactory.createArc();
|
||||||
|
pause2start.setTarget(idle);
|
||||||
|
pause2start.setOutgoing(false);
|
||||||
|
pause2start.setWeight(1);
|
||||||
|
Arc start2running = myFactory.createArc();
|
||||||
|
start2running.setTarget(running);
|
||||||
|
start2running.setOutgoing(true);
|
||||||
|
start2running.setWeight(1);
|
||||||
|
Transition start = myFactory.createTransition();
|
||||||
|
start.setName(name + "_start");
|
||||||
|
start.getArcs().add(pause2start);
|
||||||
|
start.getArcs().add(start2running);
|
||||||
|
|
||||||
|
Arc running2finish = myFactory.createArc();
|
||||||
|
running2finish.setTarget(running);
|
||||||
|
running2finish.setOutgoing(false);
|
||||||
|
running2finish.setWeight(1);
|
||||||
|
Arc finish2finished = myFactory.createArc();
|
||||||
|
finish2finished.setTarget(finished);
|
||||||
|
finish2finished.setOutgoing(true);
|
||||||
|
finish2finished.setWeight(1);
|
||||||
|
Transition finish = myFactory.createTransition();
|
||||||
|
finish.setName(name + "_finish");
|
||||||
|
finish.getArcs().add(running2finish);
|
||||||
|
finish.getArcs().add(finish2finished);
|
||||||
|
|
||||||
|
System.out.println(" + " + idle.getName());
|
||||||
|
|
||||||
|
network.getNodes().add(idle);
|
||||||
|
network.getNodes().add(start);
|
||||||
|
network.getNodes().add(running);
|
||||||
|
network.getNodes().add(finish);
|
||||||
|
network.getNodes().add(finished);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Créer un objet resourceSetImpl qui contiendra une ressource EMF (le modèle)
|
||||||
|
ResourceSet resSet = new ResourceSetImpl();
|
||||||
|
|
||||||
|
// Créer le nouveau xmi (modèle convertit)
|
||||||
|
URI convURI = URI.createURI("test.xmi");
|
||||||
|
Resource conv = resSet.createResource(convURI);
|
||||||
|
|
||||||
|
// Sauver la ressource
|
||||||
|
try {
|
||||||
|
conv.save(Collections.EMPTY_MAP);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue