1 /*******************************************************************************
2 * Imixs Workflow
3 * Copyright (C) 2001, 2011 Imixs Software Solutions GmbH,
4 * http://www.imixs.com
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You can receive a copy of the GNU General Public
17 * License at http://www.gnu.org/licenses/gpl.html
18 *
19 * Project:
20 * http://www.imixs.org
21 * http://java.net/projects/imixs-workflow
22 *
23 * Contributors:
24 * Imixs Software Solutions GmbH - initial API and implementation
25 * Ralph Soika - Software Developer
26 *******************************************************************************/
27
28 package org.imixs.workflow.jee.ejb;
29
30 import java.util.Collection;
31
32 import javax.ejb.Remote;
33
34 import org.imixs.workflow.ItemCollection;
35 import org.imixs.workflow.exceptions.AccessDeniedException;
36 import org.imixs.workflow.exceptions.InvalidAccessException;
37
38 /**
39 * The EntityService Remote interface from the EntityService statless EJB
40 *
41 * @see org.imixs.workflow.jee.ejb.EntityService
42 * @author rsoika
43 *
44 */
45 @Remote
46 public interface EntityServiceRemote {
47
48 /**
49 * Returns additional AccessRoles defined for the EJB instance
50 *
51 * @return
52 */
53 public String getAccessRoles();
54
55 /**
56 * Returns additional ReadAccessFields defined for the EJB instance.
57 * Default=$ReadAccess
58 *
59 * @return
60 */
61 public String getReadAccessFields();
62
63 /**
64 * Returns additional WriteAccessFields defined for the EJB instance.
65 * Default=$WriteAccess
66 *
67 * @return
68 */
69 public String getWriteAccessFields();
70
71 /**
72 * This Method saves an ItemCollection into a database. If the
73 * ItemCollection is saved the first time the method generates a uniqueID
74 * ('$uniqueid') which can be used to identify the ItemCollection by its ID.
75 * If the ItemCollection was saved before the method updates the
76 * ItemCollection stored in the database. The Method returns an updated
77 * instance of the ItemCollection containing the attributes $modified,
78 * $created, and $uniqueid
79 * <p>
80 * The method throws an AccessDeniedException if the CallerPrincipal is not
81 * allowed to save or update the ItemCollection in the database. The
82 * CallerPrincipial should have at least the access Role
83 * org.imixs.ACCESSLEVEL.AUTHORACCESS
84 *
85 * @param ItemCollection
86 * to be saved
87 * @return updated ItemCollection
88 */
89 public ItemCollection save(ItemCollection itemcol)
90 throws AccessDeniedException;
91
92 /**
93 * This method loads an ItemCollection from the Database. The method expects
94 * a valid $unqiueID to identify the ItemCollection saved before into the
95 * database. The method returns null if no ItemCollection with the
96 * corresponding ID exists.
97 * <p>
98 * The method checks also if the CallerPrincipal has read access to
99 * ItemCollection stored in the database. If not the method returns null.
100 * The method dose not throw an AccessDeniedException if the user is not
101 * allowed to read the entity to prevent a aggressor with informations about
102 * the existence of that specific ItemCollection.
103 * <p>
104 * CallerPrincipial should have at least the access Role
105 * org.imixs.ACCESSLEVEL.READACCESS
106 *
107 * @param id
108 * the $unqiueid of the ItemCollection to be loaded
109 * @return ItemCollection object or null if the ItemColleciton dose not
110 * exist or the CallerPrincipal hat insufficient read access.
111 *
112 */
113 public ItemCollection load(String id);
114
115 /**
116 * This method removes an ItemCollection from the database. If the
117 * CallerPrincipal is not allowed to access the ItemColleciton the method
118 * throws an AccessDeniedException.
119 * <p>
120 * The CallerPrincipial should have at least the access Role
121 * org.imixs.ACCESSLEVEL.AUTHORACCESS
122 *
123 * @param ItemCollection
124 * to be removed
125 * @throws AccessDeniedException
126 */
127 public void remove(ItemCollection itemcol) throws AccessDeniedException;
128
129 /**
130 * Adds an EntityIndex to the current list of external properties. A
131 * EntityIndex defines a Index to a specific Attribute provided by
132 * ItemCollections saved to the database. The method throws an
133 * AccessDeniedException if the CallerPrinciapal is not in the role
134 * org.imixs.ACCESSLEVEL.MANAGERACCESS.
135 *
136 * @param stitel
137 * @param ityp
138 * - Type of EntityIndex
139 * @throws AccessDeniedException
140 */
141 public void addIndex(String stitel, int ityp) throws AccessDeniedException;
142
143 /**
144 * Removes an EntityIndex from the current list of external properties. The
145 * method throws an AccessDeniedException if the CallerPrinciapal is not in
146 * the role org.imixs.ACCESSLEVEL.MANAGERACCESS.
147 *
148 * @param stitel
149 * @throws AccessDeniedException
150 */
151 public void removeIndex(String stitel) throws AccessDeniedException;
152
153 /**
154 * The method returns a collection of ItemCollections. The method expects an
155 * valid EQL statement. The method returns only ItemCollections which are
156 * readable by the CallerPrincipal. With the startpos and count parameters
157 * it is possible to read chunks of entities.
158 *
159 * @param query
160 * @param startpos
161 * @param count
162 * @return
163 */
164 public Collection<ItemCollection> findAllEntities(String query,
165 int startpos, int count) throws InvalidAccessException;
166
167 /**
168 * The method returns the parent ItemCollection to a given ItemCollection. A
169 * parent entity is referenced by an other entity by the property
170 * $uniqueidRef which points to a parent entity.
171 *
172 * @param childentity
173 * @return parent entity
174 */
175 public ItemCollection findParentEntity(ItemCollection entity)
176 throws InvalidAccessException;
177
178 /**
179 * The method returns a collection of child ItemCollections. A child entity
180 * is defined by the property $uniqueidRef which points to a parent entity.
181 *
182 * The method returns only ItemCollections which are readable by the
183 * CallerPrincipal. With the startPos and count parameters it is possible to
184 * read chunks of entities.
185 *
186 * @see findParentEntity
187 *
188 * @param parententity
189 * @param startpos
190 * @param count
191 * @return
192 */
193 public Collection<ItemCollection> findChildEntities(ItemCollection entity,
194 int startpos, int count) throws InvalidAccessException;
195
196 }