001: /***************************************************************
002: * This file is part of the [fleXive](R) project.
003: *
004: * Copyright (c) 1999-2008
005: * UCS - unique computing solutions gmbh (http://www.ucs.at)
006: * All rights reserved
007: *
008: * The [fleXive](R) project is free software; you can redistribute
009: * it and/or modify it under the terms of the GNU General Public
010: * License as published by the Free Software Foundation;
011: * either version 2 of the License, or (at your option) any
012: * later version.
013: *
014: * The GNU General Public License can be found at
015: * http://www.gnu.org/copyleft/gpl.html.
016: * A copy is found in the textfile GPL.txt and important notices to the
017: * license from the author are found in LICENSE.txt distributed with
018: * these libraries.
019: *
020: * This library is distributed in the hope that it will be useful,
021: * but WITHOUT ANY WARRANTY; without even the implied warranty of
022: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
023: * GNU General Public License for more details.
024: *
025: * For further information about UCS - unique computing solutions gmbh,
026: * please see the company website: http://www.ucs.at
027: *
028: * For further information about [fleXive](R), please see the
029: * project website: http://www.flexive.org
030: *
031: *
032: * This copyright notice MUST APPEAR in all copies of the file!
033: ***************************************************************/package com.flexive.shared.interfaces;
034:
035: import com.flexive.shared.exceptions.*;
036: import com.flexive.shared.structure.FxAssignment;
037: import com.flexive.shared.structure.FxGroupEdit;
038: import com.flexive.shared.structure.FxPropertyEdit;
039:
040: import javax.ejb.Remote;
041:
042: /**
043: * Structure Assignment management
044: *
045: * @author Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
046: */
047: @Remote
048: public interface AssignmentEngine {
049:
050: /**
051: * Create a new property and assign it at the given parentXPath to the virtual ROOT_ID type
052: *
053: * @param property property to create
054: * @param parentXPath the property's parent xpath
055: * @return <b>assignment id</b> of the property
056: * @throws FxApplicationException on errors
057: * @throws FxCreateException for create errors
058: * @throws FxInvalidParameterException if the given parentXPath is not valid
059: * @throws FxEntryExistsException if a property with this name already exists at the requested parentXPath
060: * @throws FxNoAccessException if the calling user is not permitted to call this method
061: */
062: long createProperty(FxPropertyEdit property, String parentXPath)
063: throws FxApplicationException;
064:
065: /**
066: * Create a new property and assign it at the given parentXPath to the given type
067: *
068: * @param typeId id of the type to assign this property to
069: * @param property property to create
070: * @param parentXPath the property's parent xpath
071: * @return <b>assignment id</b> of the property
072: * @throws FxApplicationException on errors
073: * @throws FxCreateException for create errors
074: * @throws FxInvalidParameterException if the given parentXPath is not valid
075: * @throws FxEntryExistsException if a property with this name already exists at the requested parentXPath
076: * @throws FxNoAccessException if the calling user is not permitted to call this method
077: */
078: long createProperty(long typeId, FxPropertyEdit property,
079: String parentXPath) throws FxApplicationException;
080:
081: /**
082: * Create a new property and assign it at the given parentXPath to the given type using assignmentAlias instead of
083: * properties name.
084: *
085: * @param typeId id of the type to assign this property to
086: * @param property property to create
087: * @param parentXPath the property's parent xpath
088: * @param assignmentAlias alias to use for the assignment to the type
089: * @return <b>assignment id</b> of the property
090: * @throws FxApplicationException on errors
091: * @throws FxInvalidParameterException if the given parentXPath is not valid
092: * @throws FxEntryExistsException if a property with this name already exists at the requested parentXPath
093: * @throws FxNoAccessException if the calling user is not permitted to call this method
094: */
095: long createProperty(long typeId, FxPropertyEdit property,
096: String parentXPath, String assignmentAlias)
097: throws FxApplicationException;
098:
099: /**
100: * Create a new group and assign it at the given parentXPath to the virtual ROOT_ID type
101: *
102: * @param group the group to create
103: * @param parentXPath optional parent xpath of the group
104: * @return <b>assignment id</b> of the group
105: * @throws FxApplicationException on errors
106: * @throws FxCreateException for create errors
107: * @throws FxInvalidParameterException if the given parentXPath is not valid
108: * @throws FxEntryExistsException if a group with this name already exists at the requested parentXPath
109: * @throws FxNoAccessException if the calling user is not permitted to call this method
110: */
111: long createGroup(FxGroupEdit group, String parentXPath)
112: throws FxApplicationException;
113:
114: /**
115: * Create a new group and assign it at the given parentXPath to the given type
116: *
117: * @param typeId id of the type to assign this group to
118: * @param group the group to create
119: * @param parentXPath optional parent xpath of the group
120: * @return <b>assignment id</b> of the group
121: * @throws FxApplicationException on errors
122: * @throws FxCreateException for create errors
123: * @throws FxInvalidParameterException if the given parentXPath is not valid
124: * @throws FxEntryExistsException if a group with this name already exists at the requested parentXPath
125: * @throws FxNoAccessException if the calling user is not permitted to call this method
126: */
127: long createGroup(long typeId, FxGroupEdit group, String parentXPath)
128: throws FxApplicationException;
129:
130: /**
131: * Save an existing or create a new assignment.
132: *
133: * @param assignment instance of FxPropertyAssignmentEdit or FxGroupAssignmentEdit
134: * @param createSubAssignments only used if creating a new group assignment
135: * @return the id of the created or saved assignment
136: * @throws FxApplicationException on errors
137: * @throws FxInvalidParameterException
138: * @throws FxCreateException
139: * @throws FxUpdateException
140: * @throws FxNoAccessException if the calling user is not permitted to call this method
141: * @see com.flexive.shared.structure.FxPropertyAssignmentEdit
142: * @see com.flexive.shared.structure.FxGroupAssignmentEdit
143: */
144: long save(FxAssignment assignment, boolean createSubAssignments)
145: throws FxApplicationException;
146:
147: /**
148: * Remove an assignment
149: *
150: * @param assignmentId assignment to remove
151: * @param removeSubAssignments if assignment is a group, remove all attached properties and groups?
152: * @param removeDerivedAssignments if derivates of this assignment in derived types exist, remove them as well?
153: * @throws FxApplicationException on errors
154: * @throws FxNotFoundException if the assignmentId is invalid
155: * @throws FxRemoveException on remove errors
156: * @throws FxNoAccessException if the calling user is not permitted to call this method
157: */
158: void removeAssignment(long assignmentId,
159: boolean removeSubAssignments,
160: boolean removeDerivedAssignments)
161: throws FxApplicationException;
162:
163: /**
164: * Save an existing property.
165: *
166: * @param property instance of FxPropertyEdit
167: * @return the id of the saved property
168: * @throws FxApplicationException on errors
169: * @throws FxInvalidParameterException
170: * @throws FxCreateException
171: * @throws FxUpdateException
172: * @throws FxNoAccessException if the calling user is not permitted to call this method
173: * @see com.flexive.shared.structure.FxPropertyEdit
174: */
175: long save(FxPropertyEdit property) throws FxApplicationException;
176:
177: /**
178: * Save an existing group.
179: *
180: * @param group instance of FxGroupEdit
181: * @return the id of the saved property
182: * @throws FxApplicationException on errors
183: * @throws FxInvalidParameterException
184: * @throws FxCreateException
185: * @throws FxUpdateException
186: * @throws FxNoAccessException if the calling user is not permitted to call this method
187: * @see com.flexive.shared.structure.FxGroupEdit
188: */
189: long save(FxGroupEdit group) throws FxApplicationException;
190:
191: /**
192: * Get the number of content instances for a given assignment,
193: * (works for group and property assignments)
194: *
195: * @param assignmentId id of the requested assignment
196: * @return number of content instances using the assignment
197: * @throws com.flexive.shared.exceptions.FxApplicationException
198: * on errors
199: */
200: long getAssignmentInstanceCount(long assignmentId)
201: throws FxApplicationException;
202:
203: /**
204: * Get the number of existing content instances using a given property.
205: *
206: * @param propertyId id of the requested assignment
207: * @return number of content instances using the assignment
208: * @throws com.flexive.shared.exceptions.FxDbException on errors
209: */
210: long getPropertyInstanceCount(long propertyId) throws FxDbException;
211: }
|