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.ui.editors.model;
26  
27  import org.omwg.ontology.*;
28  import org.wsmo.common.exception.InvalidModelException;
29  
30  public class RelationModel extends EntityModel {
31  
32      public RelationModel(Relation relation) {
33          super(relation);
34      }
35      
36      public Relation getRelation() {
37          return (Relation)getAdapter(Relation.class);
38      }
39      
40      public void addRelationInstance(RelationInstance inst) 
41              throws InvalidModelException {
42          getRelation().addRelationInstance(inst);
43          setChanged();
44      }
45  
46      public void addSuperRelation(Relation superRelation) 
47              throws InvalidModelException {
48          getRelation().addSuperRelation(superRelation);
49          setChanged();
50      }
51      
52      public Parameter createParameter(byte pos) 
53              throws InvalidModelException {
54          Parameter newParam = getRelation().createParameter(pos);
55          setChanged();
56          return newParam;
57      }
58      
59      public void removeParameter(Parameter param)
60              throws InvalidModelException {
61          getRelation().removeParameter(param);
62          setChanged();
63      }
64  
65      public void removeRelationInstance(RelationInstance inst)
66              throws InvalidModelException {
67          getRelation().removeRelationInstance(inst);
68          setChanged();
69      }
70      public void removeSuperRelation(Relation superRelation)
71              throws InvalidModelException {
72          getRelation().removeSuperRelation(superRelation);
73          setChanged();
74      }
75      
76      public void addParameterType(Parameter param, Type type) throws InvalidModelException {
77          param.addType(type);
78          setChanged();
79      }
80      
81      public void removeParameterType(Parameter param, Type type) {
82          param.removeType(type);
83          setChanged();
84      }
85  
86  }
87  
88  /*
89   * $Log: RelationModel.java,v $
90   * Revision 1.4  2006/02/20 12:46:04  alex_simov
91   * wsmo4j api change: more methods throw InvalidModelExceptions
92   *
93   * Revision 1.3  2006/01/09 12:51:14  alex_simov
94   * Copyright message in header updated
95   *
96   * Revision 1.2  2005/11/09 16:16:08  alex_simov
97   * UIModels notification improved
98   *
99   * Revision 1.1  2005/11/04 15:54:00  alex_simov
100  * wsmo4j entity UI models created
101  *
102  *
103  */