Skip to contentPackage: TypeManager
TypeManager
Coverage
1: package de.fhdw.wtf.persistence.facade;
2:
3: import java.util.Collection;
4:
5: import de.fhdw.wtf.persistence.exception.TypeOrAssociationNotFoundException;
6: import de.fhdw.wtf.persistence.meta.Association;
7: import de.fhdw.wtf.persistence.meta.MapAssociation;
8: import de.fhdw.wtf.persistence.meta.Specialization;
9: import de.fhdw.wtf.persistence.meta.Type;
10: import de.fhdw.wtf.persistence.meta.UnidirectionalAssociation;
11:
12: /**
13: * Interface of a Type Manager. A Type Manager stores information about all Model Items created by a Class Facade.
14: *
15: */
16: public interface TypeManager {
17:         
18:         /**
19:          * Stores the Information of a type in this Type Manager Object.
20:          *
21:          * @param type
22:          * The Type which information will be saved.
23:          */
24:         void saveType(Type type);
25:         
26:         /**
27:          * Stores the Information of an association in this Type Manager Object.
28:          *
29:          * @param association
30:          * The association, which information will be saved.
31:          */
32:         void saveAssociation(Association association);
33:         
34:         /**
35:          * Stores the Information of an specialization in this Type Manager Object.
36:          *
37:          * @param specialization
38:          * The specialization, which information will be saved.
39:          */
40:         void saveSpecialization(Specialization specialization);
41:         
42:         /**
43:          * @return Returns a copy of the collection with all specializations saved in this TypeManager. However the
44:          * contained specialization-objects are not copies!
45:          */
46:         Collection<Specialization> getAllSpecializations();
47:         
48:         /**
49:          * get the last type id.
50:          *
51:          * @return the last id
52:          */
53:         long getMaximumTypeId();
54:         
55:         /**
56:          * Provides the Type for a given ID.
57:          *
58:          * @param id
59:          * The id of the searched Type
60:          * @return Provides a Type Object.
61:          * @throws TypeOrAssociationNotFoundException
62:          * This exception is thrown if there is no Type with the given Id.
63:          */
64:         Type getTypeForId(long id) throws TypeOrAssociationNotFoundException;
65:         
66:         /**
67:          * Provides the Type for a given name. Note that a name might be ambigous.
68:          *
69:          * @param name
70:          * the name of the searched Type.
71:          * @return Provides a Type object with the given name.
72:          * @throws TypeOrAssociationNotFoundException
73:          * This exception is thrown if there is no Type with the given name.
74:          */
75:         Type getTypeforName(String name) throws TypeOrAssociationNotFoundException;
76:         
77:         /**
78:          * Provides the UnidirectionalAssociation with the given Id.
79:          *
80:          * @param id
81:          * The Id of the searched association.
82:          * @return Provides an UnidirectionalAssociation Object with the given name.
83:          * @throws TypeOrAssociationNotFoundException
84:          * This exception is thrown if there is no UnidirectionalAssociation with the given Id.
85:          */
86:         UnidirectionalAssociation getUnidirectionalAssociationForId(long id) throws TypeOrAssociationNotFoundException;
87:         
88:         /**
89:          * Provides the MapAssociation with the given Id.
90:          *
91:          * @param id
92:          * The Id of the searched association.
93:          * @return Provides an UnidirectionalAssociation Object with the given name.
94:          * @throws TypeOrAssociationNotFoundException
95:          * This exception is thrown if there is no MapAssociation with the given Id.
96:          */
97:         MapAssociation getMapAssociationForId(long id) throws TypeOrAssociationNotFoundException;
98:         
99:         /**
100:          * Provides the UnidirectionalAssociation with the given Name. Note that the name might be ambiguous.
101:          *
102:          * @param name
103:          * The Name of the searched UnidirectionalAssociation.
104:          * @return Provides an UnidirectionalAssociation Object with the given Name.
105:          * @throws TypeOrAssociationNotFoundException
106:          * This exception is thrown if there is no UnidirectionalAssociation with the given name.
107:          */
108:         UnidirectionalAssociation getUnidirectionalAssociationForName(String name)
109:                         throws TypeOrAssociationNotFoundException;
110:         
111:         /**
112:          * Provides the MapAssociation with the given Name. Note that the name might be ambiguous.
113:          *
114:          * @param name
115:          * The Name of the searched UnidirectionalAssociation.
116:          * @return Provides an UnidirectionalAssociation Object with the given Name.
117:          * @throws TypeOrAssociationNotFoundException
118:          * This exception is thrown if there is no MapAssociation with the given name.
119:          */
120:         MapAssociation getMapAssociationForName(String name) throws TypeOrAssociationNotFoundException;
121:         
122:         /**
123:          * Deletes all Elements which have been saved by this TypeManager.
124:          */
125:         void clear();
126:         
127:         /**
128:          * Deletes a type with the given id from this TypeManager.
129:          *
130:          * @param typeId
131:          * the id of the UserType to delete.
132:          * @throws TypeOrAssociationNotFoundException
133:          * if no UserType with the given id exists.
134:          */
135:         void deleteType(long typeId) throws TypeOrAssociationNotFoundException;
136:         
137:         /**
138:          * Deletes an association with the given id from this TypeManager.
139:          *
140:          * @param associationId
141:          * the id of the Association to delete.
142:          * @throws TypeOrAssociationNotFoundException
143:          * if no Association with the given id exists.
144:          */
145:         void deleteAssociation(long associationId) throws TypeOrAssociationNotFoundException;
146:         
147:         /**
148:          * Deletes the given Specialization from this TypeManager. Does nothing if the given Specialization does not exist
149:          * in this TypeManager.
150:          *
151:          * @param specialization
152:          * the Specialization to be deleted.
153:          */
154:         void deleteSpecialization(Specialization specialization);
155:         
156:         /**
157:          * Checks if there is a Type with the given ID.
158:          *
159:          * @param typeId
160:          * the id that will be checked
161:          * @return true = Type exists, false = Type not exists
162:          */
163:         boolean existsType(long typeId);
164:         
165:         /**
166:          * Checks if there is a Type with the given Name.
167:          *
168:          * @param typeName
169:          * the Name that will be checked
170:          * @return true = Type exists, false = Type not exists
171:          */
172:         boolean existsType(String typeName);
173:         
174:         /**
175:          * Checks if there is a Type with the given ID.
176:          *
177:          * @param associationId
178:          * the id that will be checked
179:          * @return true = Association exists, false = Association not exists
180:          */
181:         boolean existsAssociation(long associationId);
182:         
183:         /**
184:          * Checks if there is a Specialization with the given ID.
185:          *
186:          * @param specializationId
187:          * the id that will be checked
188:          * @return true = Specialization exists, false = Specialization not exists
189:          */
190:         boolean existsSpecialization(long specializationId);
191: }