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.structure;
034:
035: import com.flexive.shared.scripting.FxScriptInfo;
036: import com.flexive.shared.scripting.FxScriptMapping;
037: import com.flexive.shared.security.ACL;
038: import com.flexive.shared.security.Mandator;
039: import com.flexive.shared.workflow.Route;
040: import com.flexive.shared.workflow.Step;
041: import com.flexive.shared.workflow.StepDefinition;
042: import com.flexive.shared.workflow.Workflow;
043:
044: import java.io.Serializable;
045: import java.util.List;
046:
047: /**
048: * Runtime object for structure metadata held in the cache
049: *
050: * @author Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
051: */
052: public interface FxEnvironment extends Serializable {
053:
054: /**
055: * Get data types
056: *
057: * @return a list of all data types
058: */
059: List<FxDataType> getDataTypes();
060:
061: /**
062: * Get a data type by its id
063: *
064: * @param id data type id
065: * @return FxDataType
066: */
067: FxDataType getDataType(long id);
068:
069: /**
070: * Get an ACL by its id
071: *
072: * @param id ACL id
073: * @return ACL
074: */
075: ACL getACL(long id);
076:
077: /**
078: * Get an ACL by its name
079: *
080: * @param name name of the ACL (case sensitive!)
081: * @return ACL the found ACL
082: */
083: ACL getACL(String name);
084:
085: /**
086: * Get all ACL's
087: *
088: * @return ACL's
089: */
090: List<ACL> getACLs();
091:
092: /**
093: * Return all ACLs of the given category.
094: *
095: * @param category ACL category to be filtered
096: * @return all ACLs of the given category.
097: */
098: List<ACL> getACLs(ACL.Category category);
099:
100: /**
101: * Return all ACLs of a given mandatorId.
102: *
103: * @param mandatorId the function returns all ACLs from this mandatorId
104: * @return all ACLs of the given mandator
105: */
106: List<ACL> getACLs(long mandatorId);
107:
108: /**
109: * Return all ACLs of a given mandatorId and category.
110: * <p/>
111: *
112: * @param mandatorId the function loads all ACLs from this mandatorId.
113: * @param includeForeignAccessible when true, also loads ACLs that the calling user has at least one permission on,
114: * even if they belong to another mandator.
115: * @return the ACLs
116: */
117: List<ACL> getACLs(long mandatorId, boolean includeForeignAccessible);
118:
119: /**
120: * Return all ACLs of a given mandatorId and category.
121: * <p/>
122: *
123: * @param mandatorId the function loads all ACLs from this mandatorId.
124: * @param category a ACL.CATEGORY_... constant or <code>-1</code> if the category should be ignored
125: * @param includeForeignAccessible when true, also loads ACLs that the calling user has at least one permission on,
126: * even if they belong to another mandator.
127: * @return the ACLs
128: */
129: List<ACL> getACLs(long mandatorId, ACL.Category category,
130: boolean includeForeignAccessible);
131:
132: /**
133: * Get the default ACL for given categors
134: *
135: * @param category the category to get a default ACL for
136: * @return the default ACL for given categors
137: */
138: ACL getDefaultACL(ACL.Category category);
139:
140: /**
141: * Get a Workflow by its id
142: *
143: * @param id workflow id
144: * @return Workflow
145: */
146: Workflow getWorkflow(long id);
147:
148: /**
149: * Get all workflows
150: *
151: * @return all workflows
152: */
153: List<Workflow> getWorkflows();
154:
155: /**
156: * Get a mandator by its id
157: *
158: * @param id the mandator id
159: * @return the mandator with the given id
160: */
161: Mandator getMandator(long id);
162:
163: /**
164: * Get a mandator by its name
165: *
166: * @param name the mandator name
167: * @return the mandator of the given name
168: */
169: Mandator getMandator(String name);
170:
171: /**
172: * Get a list of all mandators depending on selection criteria
173: *
174: * @param active return active mandators?
175: * @param inactive return inactive mandators?
176: * @return list of all mandators depending on selection criteria
177: */
178: List<Mandator> getMandators(boolean active, boolean inactive);
179:
180: /**
181: * Get groups depending on selection criteria
182: *
183: * @param returnReferenced return groups that are referenced from a type
184: * @param returnUnreferenced return groups that are not referenced from a type
185: * @param returnRootGroups return groups from the 'root' level (only checked if returning referenced)
186: * @param returnSubGroups return groups that are subgroups of other groups (only checked if returning referenced)
187: * @return FxGroup ArrayList
188: */
189: List<FxGroup> getGroups(boolean returnReferenced,
190: boolean returnUnreferenced, boolean returnRootGroups,
191: boolean returnSubGroups);
192:
193: /**
194: * Get a group identified by its id
195: *
196: * @param id group id
197: * @return FxGroup
198: */
199: FxGroup getGroup(long id);
200:
201: /**
202: * Get a group identified by its name
203: *
204: * @param name group name
205: * @return FxGroup
206: */
207: FxGroup getGroup(String name);
208:
209: /**
210: * Get properties depending on selection criteria
211: *
212: * @param returnReferenced return properties that are referenced from a type
213: * @param returnUnreferenced return properties that are not referenced from a type
214: * @return FxProperty iterator
215: */
216: List<FxProperty> getProperties(boolean returnReferenced,
217: boolean returnUnreferenced);
218:
219: /**
220: * Get a property identified by its id
221: *
222: * @param id property id
223: * @return FxProperty
224: */
225: FxProperty getProperty(long id);
226:
227: /**
228: * Get a property identified by its name
229: *
230: * @param name property name
231: * @return FxProperty
232: */
233: FxProperty getProperty(String name);
234:
235: /**
236: * Get all property assignments that are enabled
237: *
238: * @return enabled property assignments
239: */
240: List<FxPropertyAssignment> getPropertyAssignments();
241:
242: /**
243: * Get all system internal property assignments that are connected
244: * to the virtual root type
245: *
246: * @return system internal property assignments
247: */
248: List<FxPropertyAssignment> getSystemInternalRootPropertyAssignments();
249:
250: /**
251: * Get all property assignments, optionally including disabled
252: *
253: * @param includeDisabled include disabled assignments?
254: * @return property assignments, optionally including disabled
255: */
256: List<FxPropertyAssignment> getPropertyAssignments(
257: boolean includeDisabled);
258:
259: /**
260: * Get all group assignments that are enabled
261: *
262: * @return enabled group assignments
263: */
264: List<FxGroupAssignment> getGroupAssignments();
265:
266: /**
267: * Get all group assignments, optionally including disabled
268: *
269: * @param includeDisabled include disabled assignments?
270: * @return group assignments, optionally including disabled
271: */
272: List<FxGroupAssignment> getGroupAssignments(boolean includeDisabled);
273:
274: /**
275: * Get a FxGroupAssignment or FxPropertyAssignment that matches for XPath (has to include the type/relation name as root)
276: *
277: * @param xPath requested XPath
278: * @return FxGroupAssignment or FxPropertyAssignment that matches for XPath (has to include the type/relation name as root)
279: */
280: FxAssignment getAssignment(String xPath);
281:
282: /**
283: * Get an assignment by its id
284: *
285: * @param assignmentId assignment id
286: * @return the assignment
287: */
288: FxAssignment getAssignment(long assignmentId);
289:
290: /**
291: * Get all assignments that are derived from the requested
292: *
293: * @param assignmentId the assignment whose derived children are sought after
294: * @return derived assignments
295: */
296: List<FxAssignment> getDerivedAssignments(long assignmentId);
297:
298: /**
299: * Get a type or relation identified by its name
300: *
301: * @param name type name
302: * @return type or relation identified by its name
303: */
304: FxType getType(String name);
305:
306: /**
307: * Get types depending on selection criteria
308: *
309: * @param returnBaseTypes return types that are not derived from another type
310: * @param returnDerivedTypes return types that are derived from another type
311: * @param returnTypes return FxTypes
312: * @param returnRelations return FxTypes that are relations
313: * @return FxType iterator
314: */
315: List<FxType> getTypes(boolean returnBaseTypes,
316: boolean returnDerivedTypes, boolean returnTypes,
317: boolean returnRelations);
318:
319: /**
320: * Gets relation types that contain the type with the specified id as source
321: * or destination of their relations.
322: *
323: * @param typeId id which is referenced by relations
324: * @return list of relation types that contain relations to the type with the specified id
325: */
326: List<FxType> getReferencingRelationTypes(long typeId);
327:
328: /**
329: * Get a type or relation identified by its id
330: *
331: * @param id type id
332: * @return type or relation identified by its id
333: */
334: FxType getType(long id);
335:
336: /**
337: * Returns a step defined by its unique id.
338: *
339: * @param id the unique step definition id
340: * @return the step definition object
341: */
342: StepDefinition getStepDefinition(long id);
343:
344: /**
345: * Get all defined step definitions
346: *
347: * @return ArrayList<StepDefinition>
348: */
349: List<StepDefinition> getStepDefinitions();
350:
351: /**
352: * Get all defined steps
353: *
354: * @return sll defined steps
355: */
356: List<Step> getSteps();
357:
358: /**
359: * Return the step defined by its unique step definition id and workflow.
360: *
361: * @param stepDefinitionId the step definition id
362: * @param workflowId the workflow the step has to be in
363: * @return the matching step
364: */
365: Step getStepByDefinition(long workflowId, long stepDefinitionId);
366:
367: /**
368: * Return all steps using a given stepDefinition..
369: *
370: * @param stepDefinitionId the step definition id
371: * @return the matching steps, is a empty result if the stepdefinitionId does not exist or if no steps were found
372: */
373: List<Step> getStepsByDefinition(long stepDefinitionId);
374:
375: /**
376: * Return the steps assigned to a given workflow.
377: *
378: * @param workflowId workflow to return the step definitions for
379: * @return the steps assigned to a given workflow.
380: */
381: List<Step> getStepsByWorkflow(long workflowId);
382:
383: /**
384: * Get a Step by its id
385: *
386: * @param stepId step id
387: * @return Step
388: */
389: Step getStep(long stepId);
390:
391: /**
392: * Load a given route.
393: *
394: * @param routeId the route to be loaded
395: * @return the requested route
396: */
397: Route getRoute(long routeId);
398:
399: /**
400: * Get all available select lists
401: *
402: * @return all available select lists
403: */
404: List<FxSelectList> getSelectLists();
405:
406: /**
407: * Get the selectlist with the given id
408: *
409: * @param id requested select list id
410: * @return select list
411: */
412: FxSelectList getSelectList(long id);
413:
414: /**
415: * Get the selectlist with the given name
416: *
417: * @param name requested select list name
418: * @return select list
419: */
420: FxSelectList getSelectList(String name);
421:
422: /**
423: * Get the selectlist item with the given id
424: *
425: * @param id requested select list item id
426: * @return select list item
427: */
428: FxSelectListItem getSelectListItem(long id);
429:
430: /**
431: * Get all scripts
432: *
433: * @return all scripts
434: */
435: List<FxScriptInfo> getScripts();
436:
437: /**
438: * Get all script mappings
439: *
440: * @return all script mappings
441: */
442: List<FxScriptMapping> getScriptMappings();
443:
444: /**
445: * Get the script mapping for the requested script
446: *
447: * @param scriptId requested script id
448: * @return script mapping
449: */
450: FxScriptMapping getScriptMapping(long scriptId);
451:
452: /**
453: * Get a script by its id
454: *
455: * @param scriptId requested script id
456: * @return the script info object
457: */
458: FxScriptInfo getScript(long scriptId);
459:
460: /**
461: * Get the timestamp when this environment was loaded
462: *
463: * @return timestamp when this environment was loaded
464: */
465: long getTimeStamp();
466:
467: /**
468: * Get a list of all types that have assignments of the requested property
469: *
470: * @param propertyId requested propery
471: * @return list of all types that have assignments of the requested property
472: */
473: List<FxType> getTypesForProperty(long propertyId);
474:
475: /**
476: * Get a comma separated list of inactive mandators
477: *
478: * @return comma separated list of inactive mandators
479: */
480: String getInactiveMandatorList();
481:
482: /**
483: * Get a comma separated list of deactivated FxTypes
484: *
485: * @return comma separated list of deactivated FxTypes
486: */
487: String getDeactivatedTypesList();
488: }
|