Skip to main content
summaryrefslogtreecommitdiffstats
blob: dcaa14f9fc624e28de02b423d5b3fbf464704d05 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
        Map<GenerationElement, FactoryComponent> fcs = (Map<GenerationElement, FactoryComponent>) ctx.getValue(FcoreBuilderConstants.CURRENT_FCORE);

        FactoryComponent fc = fcs.get((GenerationElement) (parameter.eContainer()));

        ProductionPlan pp = (ProductionPlan) fc.getOrchestration();
        DomainViewpoint dvp = (DomainViewpoint) fc.getViewpointContainer().getViewpoint(DomainViewpoint.class);

        EMFDomain genModelEMFDomain = null;
        URI uri = ((HashMap<EmfGeneration, URI>) ctx.getValue(FcoreBuilderConstants.GENMODEL_URIS)).get(parameter);
        genModelEMFDomain = ActivityInvocationHelper.getDomain(dvp, uri);
        if (genModelEMFDomain == null) {
            genModelEMFDomain = DomainFactory.eINSTANCE.createEMFDomain();
            genModelEMFDomain.setUri(uri);
            dvp.getDomains().add(genModelEMFDomain);
        }

        Map<String, Type> contracts = new HashMap<String, Type>();
        Map<String, OrchestrationParameter> parameters = new HashMap<String, OrchestrationParameter>();

        for (OrchestrationParameter param : pp.getOrchestrationParameters()) {
            if (ActivityInvocationHelper.GENERATION_EXTENSION_PARAMETER_NAME.equals(param.getName())) {
                parameters.put("pattern.substitutions", param);
            }
        }

        ResourceSet resourceSet = fc.eResource().getResourceSet();
        if (parameter.isGenerateModel()) {
            TypeDomain typeEMFDomain = DomainFactory.eINSTANCE.createTypeDomain();
            typeEMFDomain.setDomain(genModelEMFDomain);
            contracts.put("genModel", typeEMFDomain);
            ActivityInvocationHelper.addInvocation(pp, (Activity) resourceSet.getEObject(URI.createURI(this.modelActivity, false), true), contracts, parameters);
        }
        if (parameter.isGenerateEdit()) {
            TypeDomain typeEMFDomain = DomainFactory.eINSTANCE.createTypeDomain();
            typeEMFDomain.setDomain(genModelEMFDomain);
            contracts.put("genModel", typeEMFDomain);
            ActivityInvocationHelper.addInvocation(pp, (Activity) resourceSet.getEObject(URI.createURI(this.editActivity, false), true), contracts, parameters);
        }
        if (parameter.isGenerateEditor()) {
            TypeDomain typeEMFDomain = DomainFactory.eINSTANCE.createTypeDomain();
            typeEMFDomain.setDomain(genModelEMFDomain);
            contracts.put("genModel", typeEMFDomain);
            ActivityInvocationHelper.addInvocation(pp, (Activity) resourceSet.getEObject(URI.createURI(this.editorActivity, false), true), contracts, parameters);
        }
        if (parameter.isGenerateTest()) {
            TypeDomain typeEMFDomain = DomainFactory.eINSTANCE.createTypeDomain();
            typeEMFDomain.setDomain(genModelEMFDomain);
            contracts.put("genModel", typeEMFDomain);
            ActivityInvocationHelper.addInvocation(pp, (Activity) resourceSet.getEObject(URI.createURI(this.testActivity, false), true), contracts, parameters);
        }
        if (parameter.isGenerateJavadoc()) {
            TypeDomain typeEMFDomain = DomainFactory.eINSTANCE.createTypeDomain();
            typeEMFDomain.setDomain(genModelEMFDomain);
            contracts.put("genModel", typeEMFDomain);
            ActivityInvocationHelper.addInvocation(pp, (Activity) resourceSet.getEObject(URI.createURI(this.javadocActivity, false), true), contracts, parameters);
        }

Back to the top