Statistics
| Revision:

root / branches / modelio3.7.x / src / main / java / org / modelio / togaf / profile / applicationarchitecture / model / ServiceDataFragment.java @ 237

History | View | Annotate | Download (3.7 KB)

1
/** 
2
 * Licensed to the Apache Software Foundation (ASF) under one 
3
 * or more contributor license agreements.  See the NOTICE file 
4
 * distributed with this work for additional information 
5
 * regarding copyright ownership.  The ASF licenses this file 
6
 * to you under the Apache License, Version 2.0 (the 
7
 * "License"); you may not use this file except in compliance 
8
 * with the License.  You may obtain a copy of the License at 
9
 * 
10
 *        http://www.apache.org/licenses/LICENSE-2.0 
11
 * 
12
 *        Unless required by applicable law or agreed to in writing, 
13
 *        software distributed under the License is distributed on an 
14
 *        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
15
 *        KIND, either express or implied.  See the License for the 
16
 *        specific language governing permissions and limitations 
17
 *        under the License. 
18
 * 
19
 * 
20
 * @package    org.modelio.togaf. 
21
 * @author     Modelio 
22
 * @license    http://www.apache.org/licenses/LICENSE-2.0 
23
 * @version  1.0.00 
24
 **/
25
package org.modelio.togaf.profile.applicationarchitecture.model;
26

    
27
import java.util.List;
28

    
29
import org.modelio.metamodel.uml.infrastructure.ModelTree;
30
import org.modelio.metamodel.uml.statik.Attribute;
31
import org.modelio.metamodel.uml.statik.Class;
32
import org.modelio.metamodel.uml.statik.Package;
33
import org.modelio.metamodel.uml.statik.TemplateParameter;
34
import org.modelio.togaf.impl.TogafArchitectModule;
35
import org.modelio.togaf.profile.structure.model.ApplicationArchitecture;
36
import org.modelio.togaf.profile.utils.ModelUtils;
37
import org.modelio.togaf.profile.utils.ResourceManager;
38
public class ServiceDataFragment {
39
        protected Class element;
40

    
41
        public ServiceDataFragment() {
42
                this.element = TogafArchitectModule.getInstance().getModuleContext().getModelingSession().getModel().createClass();
43
                ModelUtils.setStereotype(this.element, "TogafArchitect","ServiceDataFragment");
44
                this.element.setName(ResourceManager.getName("ServiceDataFragment"));
45
        }
46

    
47
        public ServiceDataFragment(Class element) {
48
                this.element = element;
49
        }
50

    
51
        public Class getElement() {
52
                return this.element;
53
        }
54

    
55
        public void setParent(ModelTree parent) {
56
                this.element.setOwner(parent);
57
        }
58

    
59
        public void setParent(TemplateParameter parent) {
60
                this.element.setOwnerTemplateParameter(parent);
61
        }
62

    
63
        public ApplicationArchitecture getApplicationArchitecture() {
64
                return new ApplicationArchitecture((Package) this.element.getOwner());
65
        }
66

    
67
        public void addApplicationArchitecture(ApplicationArchitecture model) {
68
                this.element.setOwner(model.getElement());
69
        }
70

    
71
        public ServiceData getServiceData() {
72
                return new ServiceData((Class) this.element.getOwner());
73
        }
74

    
75
        public void addServiceData(ServiceData model) {
76
                this.element.setOwner(model.getElement());
77
        }
78

    
79
        public List<ApplicationArchitectureAttribute> getApplicationArchitectureAttribute() {
80
                List<ApplicationArchitectureAttribute> res = new java.util.ArrayList<>();
81
                for (Attribute model_element : this.element.getOwnedAttribute()) {
82
                        res.add(new ApplicationArchitectureAttribute( model_element));
83
                }
84
                return res;
85
        }
86

    
87
        public void addApplicationArchitectureAttribute(ApplicationArchitectureAttribute model) {
88
                this.element.getOwnedAttribute().add(model.getElement());
89
        }
90

    
91
        public List<ServiceDataFragment> getFragment() {
92
                List<ServiceDataFragment> res = new java.util.ArrayList<>();
93
                for (ModelTree model_element : this.element.getOwnedElement()) {
94
                        res.add(new ServiceDataFragment((Class) model_element));
95
                }
96
                return res;
97
        }
98

    
99
        public void addFragment(ServiceDataFragment model) {
100
                this.element.getOwnedElement().add(model.getElement());
101
        }
102

    
103
        public ServiceDataFragment getParentFragment() {
104
                return new ServiceDataFragment((Class) this.element.getOwner());
105
        }
106

    
107
        public void addParentFragment(ServiceDataFragment model) {
108
                this.element.setOwner(model.getElement());
109
        }
110

    
111
}