Revision 237 branches/modelio3.7.x/src/main/java/org/modelio/togaf/conf/TogafModelContributor.java

View differences:

TogafModelContributor.java
19 19
public class TogafModelContributor {
20 20

  
21 21
	public void createInitialModel() {
22

  
23 22
		ApplicationLayer applilayer = null;
24 23
		TechnologyArchitecture techno = null;
25 24
		BusinessLayer business = null;
26 25

  
27
		
28
        Package root = null;
29
        for(MObject obj : TogafArchitectModule.getInstance().getModuleContext().getModelingSession().getModel().getModelRoots()){
30
            if(obj instanceof Project){
31
            	if(!((Project)obj).getModel().isEmpty()){
32
            		root = ((Project)obj).getModel().get(0);
33
            	}
34
                
35
            }
36
        }
37
				
38
        
26

  
27
		Package root = null;
28
		for(MObject obj : TogafArchitectModule.getInstance().getModuleContext().getModelingSession().getModel().getModelRoots()){
29
			if(obj instanceof Project){
30
				if(!((Project)obj).getModel().isEmpty()){
31
					root = ((Project)obj).getModel().get(0);
32
				}
33
			}
34
		}
35

  
36
		if (root == null) {
37
			return;
38
		}
39

  
39 40
		for (ModelElement sub : root.getOwnedElement()) {
40 41
			if (sub.isStereotyped("TogafArchitect","BusinessLayer")) {
41 42
				business = new BusinessLayer((Package) sub);
......
48 49

  
49 50
		try {
50 51
			if(!root.isStereotyped("TogafArchitect", "TogafRoot")){
51
				root.addStereotype("TogafArchitect", "TogafRoot");	
52
				root.addStereotype("TogafArchitect", "TogafRoot");
52 53
			}
53 54
			if (business == null) {
54 55
				business = new BusinessLayer();
55 56
				business.setParent(root);
56
				 business.getElement().putNoteContent("ModelerModule", "description",Messages.getString("BusinessLayer_Template"));
57
				business.getElement().putNoteContent("ModelerModule", "description",Messages.getString("BusinessLayer_Template"));
57 58

  
58 59
				BusinessEntities entities = new BusinessEntities();
59 60
				entities.setParent(business.getElement());
......
76 77
				BusinessOrganizationDomain businessfunction = new BusinessOrganizationDomain();
77 78
				businessfunction.getElement().setName("Business Function");
78 79
				businessfunction.setParent(architecture.getElement());
79
				 businessfunction.getElement().putNoteContent("ModelerModule", "description",Messages.getString("Function_Template"));
80
				businessfunction.getElement().putNoteContent("ModelerModule", "description",Messages.getString("Function_Template"));
80 81

  
81 82
				BusinessOrganizationDomain locations = new BusinessOrganizationDomain();
82 83
				locations.getElement().setName("Locations");
......
104 105
				ApplicationArchitectureDomain systemeusecase = new ApplicationArchitectureDomain();
105 106
				systemeusecase.getElement().setName("System Use Case");
106 107
				systemeusecase.setParent(appliarchi.getElement());
107
				systemeusecase.getElement().putNoteContent("ModelerModule", "description",Messages.getString("Systeme_Template"));				
108
				systemeusecase.getElement().putNoteContent("ModelerModule", "description",Messages.getString("Systeme_Template"));
108 109
			}
109 110

  
110 111
			if (techno == null) {

Also available in: Unified diff