View Javadoc

1   /*
2    WSMO Studio - a Semantic Web Service Editor
3    Copyright (c) 2004-2006, OntoText Lab. / SIRMA Group
4    
5    This library is free software; you can redistribute it and/or modify it under
6    the terms of the GNU Lesser General Public License as published by the Free
7    Software Foundation; either version 2.1 of the License, or (at your option)
8    any later version.
9    This library is distributed in the hope that it will be useful, but WITHOUT
10   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   details.
13   You should have received a copy of the GNU Lesser General Public License along
14   with this library; if not, write to the Free Software Foundation, Inc.,
15   59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16   */
17  
18  /***
19   * <p>Title: WSMO Studio</p>
20   * <p>Description: Semantic Web Service Editor</p>
21   * <p>Copyright:  Copyright (c) 2004-2006</p>
22   * <p>Company: OntoText Lab. / SIRMA </p>
23   */
24  
25  package org.wsmostudio.choreography.editors.model;
26  
27  import org.omwg.ontology.Ontology;
28  import org.wsmo.service.choreography.Choreography;
29  import org.wsmo.service.choreography.rule.*;
30  import org.wsmo.service.rule.ChoreographyRule;
31  import org.wsmo.service.signature.*;
32  import org.wsmostudio.ui.editors.model.EntityModel;
33  
34  public class ChoreographyModel extends EntityModel {
35  
36      public ChoreographyModel(Choreography chor) {
37          super(chor);
38      }
39      
40      public Choreography getChoreography() {
41          return (Choreography)getAdapter(Choreography.class);
42      }
43      
44      public StateSignature getStateSignature() {
45          return getChoreography().getStateSignature();
46      }
47  
48      public void addRule(ChoreographyRule rule) {
49          getChoreography().getRules().addRule(rule);
50          setChanged();
51      }
52      
53      public void addRule(ChoreographyRule newRule, ChoreographyTransitionRule containerRule) {
54          containerRule.addRule(newRule);
55          setChanged();
56      }
57  
58      public void removeRule(ChoreographyRule removeRule, ChoreographyTransitionRule containerRule) {
59          containerRule.removeRule(removeRule);
60          removeRule(removeRule);
61      }
62      
63      public void removeRule(ChoreographyRule rule) {
64          getChoreography().getRules().removeRule(rule);
65          setChanged();
66      }
67      
68      public void addOntology(Ontology onto) {
69          getStateSignature().addOntology(onto);
70          setChanged();
71      }
72      public void removeOntology(Ontology onto) {
73          getStateSignature().removeOntology(onto);
74          setChanged();
75      }
76      
77      public void addMode(Mode mode) {
78          getStateSignature().addMode(mode);
79          setChanged();
80      }
81      public void removeMode(Mode mode) {
82          getStateSignature().removeMode(mode);
83          setChanged();
84      }
85      
86      public void addGrounding(GroundedMode mode, Grounding grounding) {
87          mode.addGrounding(grounding);
88          setChanged();
89      }
90      public void removeGrounding(GroundedMode mode, Grounding grounding) {
91          mode.removeGrounding(grounding);
92          setChanged();
93      }
94  }
95  
96  /*
97   * $Log$
98   * Revision 1.4  2006/11/22 14:11:07  alex_simov
99   * Code refactoring: the plug-in is synchronized with the latest wsmo4j changes
100  *
101  * Revision 1.3  2006/01/09 12:51:11  alex_simov
102  * Copyright message in header updated
103  *
104  * Revision 1.2  2005/12/16 12:45:08  alex_simov
105  * added more utility methods
106  *
107  * Revision 1.1  2005/11/10 13:40:57  alex_simov
108  * UIModels support added
109  *
110  */