Source Code Cross Referenced for Node.java in  » Database-ORM » MMBase » org » mmbase » bridge » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database ORM » MMBase » org.mmbase.bridge 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:        This software is OSI Certified Open Source Software.
004:        OSI Certified is a certification mark of the Open Source Initiative.
005:
006:        The license (Mozilla version 1.0) can be read at the MMBase site.
007:        See http://www.MMBase.org/license
008:
009:         */
010:
011:        package org.mmbase.bridge;
012:
013:        import java.util.*;
014:        import java.io.InputStream;
015:        import org.w3c.dom.Element;
016:        import org.w3c.dom.Document;
017:        import org.mmbase.util.functions.Function;
018:        import org.mmbase.util.functions.Parameters;
019:
020:        /**
021:         * Describes an object in the cloud.
022:         *
023:         * @author Rob Vermeulen
024:         * @author Pierre van Rooden
025:         * @version $Id: Node.java,v 1.76 2008/02/16 22:13:53 nklasens Exp $
026:         */
027:        public interface Node extends Comparable<Node> {
028:
029:            /**
030:             * Returns the cloud this node belongs to.
031:             * @return the Cloud
032:             */
033:            public Cloud getCloud();
034:
035:            /**
036:             * Returns the node manager for this node.
037:             * @return the node manager
038:             */
039:            public NodeManager getNodeManager();
040:
041:            /**
042:             * Returns the unique number for this node. Every node has a unique number
043:             * which can be used to refer to it. In addition to this number a node can
044:             * have one or more aliases.
045:             * A value of -1 indicates an invalid number.
046:             * Other negative values may be used for temporary ids (but not true node numbers).
047:             * This may differ by implementation.
048:             *
049:             * @return the unique number for this node
050:             * @see    #createAlias(String alias)
051:             */
052:            public int getNumber();
053:
054:            /**
055:             * Determine whether this Node is a Relation.
056:             * @since MMBase-1.6
057:             * @return <code>true</code> if this Node is a Relation.
058:             */
059:            public boolean isRelation();
060:
061:            /**
062:             * Returns this as a Relation.
063:             * @since MMBase-1.6
064:             * @return a <code>Relation</code> object
065:             * @throws ClassCastException if the Node is not a Relation
066:             */
067:            public Relation toRelation();
068:
069:            /**
070:             * Determine whether this Node is a NodeManager.
071:             * @since MMBase-1.6
072:             * @return <code>true</code> if this Node is a NodeManager.
073:             */
074:            public boolean isNodeManager();
075:
076:            /**
077:             * Returns this as a NodeManager.
078:             * @since MMBase-1.6
079:             * @return a <code>NodeManager</code> object
080:             * @throws ClassCastException if the Node is not a NodeManager
081:             */
082:            public NodeManager toNodeManager();
083:
084:            /**
085:             * Determine whether this Node is a RelationManager.
086:             * @since MMBase-1.6
087:             * @return <code>true</code> if this Node is a RelationManager.
088:             */
089:            public boolean isRelationManager();
090:
091:            /**
092:             * Returns this as a RelationManager.
093:             * @since MMBase-1.6
094:             * @return a <code>NodeManager</code> object
095:             * @throws ClassCastException if the Node is not a RelationManager
096:             */
097:            public RelationManager toRelationManager();
098:
099:            /**
100:             * Sets the value of the specified field using an object, but delegated to the right
101:             * set--Value depending on the type of the field.
102:             * For example a field of type <code>int</code> can be set using an
103:             * <code>Integer</code>.
104:             * This change will not be visible to the cloud until the commit method is
105:             * called.
106:             *
107:             * @param fieldName  the name of the field to be updated
108:             * @param value      the new value for the given field
109:             */
110:            public void setValue(String fieldName, Object value);
111:
112:            /**
113:             * Like setValue, but skips any processing that MMBase would normally perform on a field.
114:             * You can use this to set data on fields that are 'system' defined, to prevent (among other
115:             * things) infinite recursion. Use with care - in general processing of a field has a purpose!
116:
117:             * @param fieldName name of field
118:             * @param value new value of the field
119:             * @since MMBase-1.8
120:             */
121:            public void setValueWithoutProcess(String fieldName, Object value);
122:
123:            /**
124:             * Sets the value of the specified field using an object, but without dispatching to the right
125:             * type first.
126:             *
127:             * @param fieldName  the name of the field to be updated
128:             * @param value      the new value for the given field
129:             * @since MMBase-1.7
130:             */
131:            public void setObjectValue(String fieldName, Object value);
132:
133:            /**
134:             * Sets the value of the specified field using an <code>boolean</code>.
135:             * This change will not be visible to the cloud until the commit method is
136:             * called.
137:             *
138:             * @since MMBase-1.6
139:             * @param fieldName  the name of the field to be updated
140:             * @param value      the new value for the given field
141:             */
142:            public void setBooleanValue(String fieldName, boolean value);
143:
144:            /**
145:             * Sets the value of the specified field using an <code>Node</code>.
146:             * This change will not be visible to the cloud until the commit method is
147:             * called.
148:             *
149:             * @since MMBase-1.6
150:             * @param fieldName  the name of the field to be updated
151:             * @param value      the new value for the given field
152:             */
153:            public void setNodeValue(String fieldName, Node value);
154:
155:            /**
156:             * Sets the value of the specified field using an <code>int</code>.
157:             * This change will not be visible to the cloud until the commit method is
158:             * called.
159:             *
160:             * @param fieldName  the name of the field to be updated
161:             * @param value      the new value for the given field
162:             */
163:            public void setIntValue(String fieldName, int value);
164:
165:            /**
166:             * Sets the value of the specified field using a <code>float</code>.
167:             * This change will not be visible to the cloud until the commit method is
168:             * called.
169:             *
170:             * @param fieldName  the name of the field to be updated
171:             * @param value      the new value for the given field
172:             */
173:            public void setFloatValue(String fieldName, float value);
174:
175:            /**
176:             * Sets the value of the specified field using a <code>double</code>.
177:             * This change will not be visible to the cloud until the commit method is
178:             * called.
179:             *
180:             * @param fieldName  the name of the field to be updated
181:             * @param value      the new value for the given field
182:             */
183:            public void setDoubleValue(String fieldName, double value);
184:
185:            /**
186:             * Sets the value of the specified field using a <code>byte array</code>.
187:             * This change will not be visible to the cloud until the commit method is
188:             * called.
189:             *
190:             * @param fieldName  the name of the field to be updated
191:             * @param value      the new value for the given field
192:             */
193:            public void setByteValue(String fieldName, byte[] value);
194:
195:            /**
196:             * Sets the value of the specified field using a <code>java.io.InputStream</code>.
197:             * @param fieldName  the name of the field to be updated
198:             * @param value      the new value for the given field
199:             * @param size       size of input stream
200:             * @since MMBase-1.8.
201:             */
202:            public void setInputStreamValue(String fieldName,
203:                    InputStream value, long size);
204:
205:            /**
206:             * Sets the value of the specified field using a <code>long</code>.
207:             * This change will not be visible to the cloud until the commit method is
208:             * called.
209:             *
210:             * @param fieldName  the name of the field to be updated
211:             * @param value      the new value for the given field
212:             */
213:            public void setLongValue(String fieldName, long value);
214:
215:            /**
216:             * Sets the value of the specified field using a <code>String</code>.
217:             * This change will not be visible to the cloud until the commit method is
218:             * called.
219:             *
220:             * @param fieldName  the name of the field to be updated
221:             * @param value      the new value for the given field
222:             */
223:            public void setStringValue(String fieldName, String value);
224:
225:            /**
226:             * Sets the value of the specified field using a <code>Date</code>.
227:             * This change will not be visible to the cloud until the commit method is
228:             * called.
229:             *
230:             * @param fieldName  the name of the field to be updated
231:             * @param value      the new value for the given field
232:             * @since MMBase-1.8
233:             */
234:            public void setDateValue(String fieldName, Date value);
235:
236:            /**
237:             * Sets the value of the specified field using a <code>List</code>.
238:             * This change will not be visible to the cloud until the commit method is
239:             * called.
240:             *
241:             * @param fieldName  the name of the field to be updated
242:             * @param value      the new value for the given field
243:             * // not yet working
244:             * @since MMBase-1.8
245:             */
246:            public void setListValue(String fieldName, List value);
247:
248:            /**
249:             * Whether the value for the specified field is <code>null</code>. This avoids acquiring the
250:             * complete value if you only want to check if for emptiness.
251:             * @param fieldName   the name of the field
252:             * @return <code>true</code> when value is <code>null</code>
253:             * @since MMBase-1.8
254:             */
255:            public boolean isNull(String fieldName);
256:
257:            /**
258:             * Returns the 'size' (e.g. the number of bytes of a byte array) for the specified field. This
259:             * avoids acquiring the complete value if you only want to know how big the value of the field is.
260:             * @param fieldName    the name of the field
261:             * @return  the 'size'
262:             * @since MMBase-1.8
263:             */
264:            public long getSize(String fieldName);
265:
266:            /**
267:             * Returns the value of the specified field as an object. For example a
268:             * field of type <code>int</code> is returned as an <code>Integer</code>.
269:             * The object type may vary and is dependent on how data was stored in a field.
270:             * I.e. It may be possible for an Integer field to return it's value as a String
271:             * if it was stored that way in the first place.
272:             *
273:             * @param fieldName  the name of the field to be returned
274:             * @return           the value of the specified field
275:             */
276:            public Object getValue(String fieldName);
277:
278:            /**
279:             * Returns the field's value as an object. It is not delegated to the right get--Value.
280:             * @param fieldName name of the field
281:             * @return object value
282:             * @since MMBase-1.7
283:             */
284:            public Object getObjectValue(String fieldName);
285:
286:            /**
287:             * Like getObjectValue, but skips any processing that MMBase would normally perform on a field.
288:             * You can use this to get data from a field for validation purposes.
289:             *
290:             * @param fieldName name of field
291:             * @return value without processing
292:             * @since MMBase-1.8
293:             */
294:            public Object getValueWithoutProcess(String fieldName);
295:
296:            /**
297:             * Returns the value of the specified field as a <code>boolean</code>.
298:             * If the actual value is numeric, this call returns <code>true</code>
299:             * if the value is a positive, non-zero, value. In other words, values '0'
300:             * and '-1' are considered <code>false</code>.
301:             * If the value is a string, this call returns <code>true</code> if
302:             * the value is "true" or "yes" (case-insensitive).
303:             * In all other cases (including calling byte fields), <code>false</code>
304:             * is returned.
305:             *
306:             * @param fieldName  the name of the field to be returned
307:             * @return           the value of the specified field
308:             */
309:            public boolean getBooleanValue(String fieldName);
310:
311:            /**
312:             * Returns the value of the specified field as a <code>Node</code>.
313:             * If the value is not itself a Node, this call attempts to convert the
314:             * original field value to a Node, by trying to retrieve a Node using
315:             * the field value as a Node number or alias.<br />
316:             * For instance, getNodeValue("destination"), when run on a OAlias object,
317:             * returns the referenced destination node (instead of the number, which is
318:             * what it normally holds).<br />
319:             * Mostly, this call is used in cluster nodes (nodes retrieved by using the
320:             * Cloud.getList method. A cluster node returns one of its compound nodes
321:             * when an appropriate nodemanager name (name from the nodepath) is specified.
322:             * I.e. getNodeValue("people") will return the people-node in the cluster.
323:             * If this fails, the method returns <code>null</code>.
324:             * <br />
325:             * Notes: the behavior of getNodeValue when called on a field that is not
326:             * intended to be a node reference is currently undefined and is not
327:             * encouraged.
328:             * <br />
329:             * Calling this method with field "number" or <code>null</code> lets the
330:             * Node return a reference to itself, regardless of the actual value of the
331:             * number field or status of the Node.
332:             *
333:             * @param fieldName  the name of the field to be returned
334:             * @return           the value of the specified field
335:             * @see Cloud#getList(String, String, String, String, String, String, String, boolean)
336:             */
337:            public Node getNodeValue(String fieldName);
338:
339:            /**
340:             * Returns the value of the specified field as an <code>int</code>.
341:             * Numeric fields are simply converted. Double and float values may be truncated.
342:             * For Node values, the numeric key is returned.
343:             * Long values return -1 of the value is too large.
344:             * Boolean fields return 0 if false, and 1 if true.
345:             * String fields are parsed.
346:             * If a parsed string contains an error, ot the field value is not of a type that can be converted
347:             * (i.e. a byte array), this function returns -1
348:             *
349:             * @param fieldName  the name of the field to be returned
350:             * @return           the value of the specified field
351:             */
352:            public int getIntValue(String fieldName);
353:
354:            /**
355:             * Returns the value of the specified field as a <code>float</code>.
356:             * This function attempts to convert the value to a float.
357:             * Numeric fields are simply converted.
358:             * Boolean fields return 0.0 if false, and 1.0 if true.
359:             * String fields are parsed.
360:             * If a parsed string contains an error, ot the field value is not of a type that can be converted
361:             * (i.e. a byte array), this function returns -1.0.
362:             *
363:             * @param fieldName  the name of the field to be returned
364:             * @return           the value of the specified field
365:             */
366:            public float getFloatValue(String fieldName);
367:
368:            /**
369:             * Returns the value of the specified field as a <code>long</code>.
370:             * This function attempts to convert the value to a long.
371:             * Numeric fields are simply converted. Double and float values may be truncated.
372:             * Boolean fields return 0 if false, and 1 if true.
373:             * String fields are parsed.
374:             * If a parsed string contains an error, ot the field value is not of a type that can be converted
375:             * (i.e. a byte array), this function returns -1
376:             *
377:             * @param fieldName  the name of the field to be returned
378:             * @return           the value of the specified field
379:             */
380:            public long getLongValue(String fieldName);
381:
382:            /**
383:             * Returns the value of the specified field as a <code>double</code>.
384:             * This function attempts to convert the value to a double.
385:             * Numeric fields are simply converted. Double may be truncated.
386:             * Boolean fields return 0.0 if false, and 1.0 if true.
387:             * String fields are parsed.
388:             * If a parsed string contains an error, ot the field value is not of a type that can be converted
389:             * (i.e. a byte array), this function returns -1.0.
390:             *
391:             * @param fieldName  the name of the field to be returned
392:             * @return           the value of the specified field
393:             */
394:            public double getDoubleValue(String fieldName);
395:
396:            /**
397:             * Returns the value of the specified field as a <code>byte array</code>.
398:             * This function returns either the value of a byte field, or the byte value of a string
399:             * (converted using the default encoding, i.e. UTF8)
400:             * Other types of values return an empty byte-array.
401:             *
402:             * @param fieldName  the name of the field to be returned
403:             * @return           the value of the specified field
404:             */
405:            public byte[] getByteValue(String fieldName);
406:
407:            /**
408:             * Returns the value of the specified field as a <code>java.io.InputStream</code> This is
409:             * especially useful for large byte-array fields. By this you can avoid them to be completely
410:             * stored in memory.
411:             * @param fieldName  the name of the field
412:             * @return value of field as a input stream
413:             * @since MMBase-1.8
414:             */
415:            public InputStream getInputStreamValue(String fieldName);
416:
417:            /**
418:             * Returns the value of the specified field as a <code>String</code>.
419:             * Byte arrays are converted to string using the default encoding (UTF8).
420:             * Node values return a string representation of their numeric key.
421:             * For other values the result is calling the toString() method on the actual object.
422:             *
423:             * @param fieldName  the name of the field to be returned
424:             * @return           the value of the specified field
425:             */
426:            public String getStringValue(String fieldName);
427:
428:            /**
429:             * @param fieldName  the name of the field to be returned
430:             * @return           the value of the specified field
431:             * @since MMBase-1.8
432:             */
433:            public Date getDateValue(String fieldName);
434:
435:            /**
436:             * @param fieldName  the name of the field to be returned
437:             * @return           the value of the specified field
438:             * not yet working
439:             * @since MMBase-1.8
440:             */
441:            public List getListValue(String fieldName);
442:
443:            /**
444:             * Returns the value of the specified field as a <code>FieldValue</code> object.
445:             *
446:             * @since MMBase-1.6
447:             * @param fieldName  the name of the field whose value to return
448:             * @return           the value of the specified field
449:             * @throws NotFoundException is the field does not exist
450:             */
451:            public FieldValue getFieldValue(String fieldName)
452:                    throws NotFoundException;
453:
454:            /**
455:             * Returns the value of the specified field as a <code>FieldValue</code> object.
456:             *
457:             * @since MMBase-1.6
458:             * @param field  the Field object whose value to return
459:             * @return       the value of the specified field
460:             */
461:            public FieldValue getFieldValue(Field field);
462:
463:            /**
464:             * Validates a node by checking the values from it's fields against the constraints of
465:             * each field's datatype.
466:             * For performance reasons, it only validates fields that actually changed (as of MMBase 1.8.4),
467:             * or when a new node is created.
468:             * This method is called by the {@link #commit} method, after commit processors are run.
469:             * Note that because commit processors may make necessary changes to field values, it is possible for
470:             * validate() to fail when used outside the commit process if the constraints are set too strict.
471:             * @return Collection of errors as <code>String</code> (in the current locale of the cloud) or an empty collection if everything ok.
472:             * @since MMBase-1.8
473:             */
474:            public Collection<String> validate();
475:
476:            /**
477:             * Commit the node to the database.
478:             * Prior to committing, the values are processed by any commit-processors associated with the datatype of the node's fields),
479:             * then validated.
480:             * Makes this node and/or the changes made to this node visible to the cloud.
481:             * If this method is called for the first time on this node it will make
482:             * this node visible to the cloud, otherwise the modifications made to
483:             * this node using the set methods will be made visible to the cloud.
484:             * This action fails if the current node is not in edit mode.
485:             * If the node is in a transaction, nothing happens - actual committing occurs through the transaction.
486:             * @throws BridgeException
487:             * @throws IllegalArgumentException If certain value of the node are invalid according to their data type.
488:             */
489:            public void commit();
490:
491:            /**
492:             * Cancel changes to a node
493:             * This fails if the current node is not in edit mode.
494:             * If the node is in a transaction, nothing happens - actual committing occurs through the transaction.
495:             */
496:            public void cancel();
497:
498:            /**
499:             * Removes the Node. Throws an exception if still has relations. Like delete(false).
500:             */
501:            public void delete();
502:
503:            /**
504:             * Whether this Node is new (not yet committed).
505:             * @return <code>true</code> when new
506:             * @since MMBase-1.8
507:             */
508:            public boolean isNew();
509:
510:            /**
511:             * Whether a certain field's value was changed since the last commit.
512:             * @param fieldName  the name of the field
513:             * @return <code>true</code> when field's value was changed
514:             * @since MMBase-1.8
515:             */
516:            public boolean isChanged(String fieldName);
517:
518:            /**
519:             * A Set of Strings containing the names of all changed fields.
520:             * @return Set of changed fields
521:             * @since MMBase-1.8
522:             */
523:            public Set<String> getChanged();
524:
525:            /**
526:             * Whether  field values were changed since the last commit.
527:             * @return <code>true</code> when  changed
528:             * @since MMBase-1.8
529:             */
530:            public boolean isChanged();
531:
532:            /**
533:             * Removes the Node.
534:             * @param deleteRelations a boolean. If true, then first all
535:             * existing relations with this node will be removed.
536:             */
537:
538:            public void delete(boolean deleteRelations);
539:
540:            /**
541:             * Converts the node to a string
542:             * @return string representation of a node
543:             */
544:            public String toString();
545:
546:            /**
547:             * Returns the value of the specified field as a <code>dom.Document</code>
548:             * If the node value is not itself a Document, the method attempts to
549:             * attempts to convert the String value into an XML.
550:             * This included the empty string, but not the 'null' value.
551:             * If the value is null, this method returns <code>null</code>
552:             *
553:             * @param fieldName  the name of the field to be returned
554:             * @return the value of the specified field as a DOM Element or <code>null</code>
555:             * @throws  IllegalArgumentException if the value cannot be converted to xml.
556:             * @since MMBase-1.6
557:             */
558:            public Document getXMLValue(String fieldName)
559:                    throws IllegalArgumentException;
560:
561:            /**
562:             * Returns the value of the specified field as a <code>dom.Element</code>
563:             * If the node value is not itself a Document, the method attempts to
564:             * attempts to convert the String value into an XML.
565:             * This method fails (throws a IllegalArgumentException) if the Field is not of type TYPE_XML.
566:             * If the value cannot be converted, this method returns <code>null</code>
567:             *
568:             * @param fieldName  the name of the field to be returned
569:             * @param tree the DOM Document to which the Element is added
570:             *             (as the document root element)
571:             * @return  the value of the specified field as a DOM Element or <code>null</code>
572:             * @throws  IllegalArgumentException  if the value cannot be converted to xml.
573:             * @since MMBase-1.6
574:             */
575:
576:            public Element getXMLValue(String fieldName, Document tree)
577:                    throws IllegalArgumentException;
578:
579:            /**
580:             * Set's the value of the specified field as a <code>dom.Element</code>
581:             *
582:             * @param fieldName  the name of the field to be returned
583:             * @param value      the DOM Document to has to be set, if not correct doc-type,
584:             *                   system will try to convert it to the wanted type.
585:             * @since MMBase-1.6
586:             */
587:            public void setXMLValue(String fieldName, Document value);
588:
589:            /**
590:             * Checks whether this node has any relations.
591:             *
592:             * @return <code>true</code> if the node has relations
593:             */
594:            public boolean hasRelations();
595:
596:            /**
597:             * Removes all relation nodes attached to this node.
598:             */
599:            public void deleteRelations();
600:
601:            /**
602:             * Removes all relation nodes with a certain relation manager that are
603:             * attached to this node.
604:             *
605:             * @param relationManager  the name of the relation manager the removed
606:             *                         relation nodes should have
607:             */
608:            public void deleteRelations(String relationManager);
609:
610:            /**
611:             * Returns all relation nodes attached to this node.
612:             *
613:             * @return a list of relation nodes
614:             */
615:            public RelationList getRelations();
616:
617:            /**
618:             * Returns all relation nodes attached to this node that have a specific
619:             * role
620:             *
621:             * @param role  the name of the role the returned
622:             *              relation nodes should have
623:             * @return      a list of relation nodes
624:             */
625:            public RelationList getRelations(String role);
626:
627:            /**
628:             * Returns all relation nodes attached to this node that have a specific
629:             * role, or refer a node from a specific nodemanager
630:             *
631:             * @param role  the name of the role the returned
632:             *              relation nodes should have
633:             * @param nodeManager  the name of the nodemanager for the nodes the returned
634:             *                     relation nodes should have a relation to
635:             * @return      a list of relation nodes
636:             */
637:            public RelationList getRelations(String role, String nodeManager);
638:
639:            /**
640:             * Returns all relation nodes attached to this node that have a specific
641:             * role, or refer a node from a specific nodemanager
642:             *
643:             * @param role  the name of the role the returned
644:             *              relation nodes should have
645:             * @param nodeManager  the nodemanager for the nodes the returned
646:             *                     relation nodes should have a relation to (can be null)
647:             * @return      a list of relation nodes
648:             */
649:            public RelationList getRelations(String role,
650:                    NodeManager nodeManager);
651:
652:            /**
653:             * @param role forward role of a relation
654:             * @param nodeManager node manager on the other side of the relation
655:             * @param searchDir the direction of the relation
656:             * @return List of relations
657:             * @since MMBase-1.7
658:             */
659:            public RelationList getRelations(String role,
660:                    NodeManager nodeManager, String searchDir);
661:
662:            /**
663:             * Returns the number of relations this node has with other nodes.
664:             *
665:             * @return the number of relations this node has with other nodes
666:             */
667:            public int countRelations();
668:
669:            /**
670:             * Returns the number of relation nodes attached to this node that have a
671:             * specific relation manager.
672:             * @param relationManager relation manager
673:             * @return the number of relation nodes attached to this node that have a
674:             *         specific relation manager
675:             */
676:            public int countRelations(String relationManager);
677:
678:            /**
679:             * Returns all related nodes.
680:             * The returned nodes are not the nodes directly attached to this node (the
681:             * relation nodes) but the nodes attached to the relation nodes of this
682:             * node.
683:             *
684:             * @return a list of all related nodes
685:             */
686:            public NodeList getRelatedNodes();
687:
688:            /**
689:             * Returns all related nodes that have a specific node manager.
690:             * The returned nodes are not the nodes directly attached to this node (the
691:             * relation nodes) but the nodes attached to the relation nodes of this
692:             * node.
693:             *
694:             * @param nodeManager  the name of the node manager the returned nodes
695:             *                     should have
696:             * @return             a list of related nodes
697:             */
698:            public NodeList getRelatedNodes(String nodeManager);
699:
700:            /**
701:             * Returns all related nodes that have a specific node manager.
702:             * The returned nodes are not the nodes directly attached to this node (the
703:             * relation nodes) but the nodes attached to the relation nodes of this
704:             * node.
705:             *
706:             * @param nodeManager  the node manager the returned nodes should have, can be null
707:             * @return             a list of related nodes
708:             */
709:            public NodeList getRelatedNodes(NodeManager nodeManager);
710:
711:            /**
712:             * Returns all related nodes that have a specific node manager and role.
713:             * The returned nodes are not the nodes directly attached to this node (the
714:             * relation nodes) but the nodes attached to the relation nodes of this
715:             * node.
716:             *
717:             * @since MMBase-1.6
718:             * @param nodeManager  the name of the node manager the returned nodes
719:             *                     should have
720:             * @param role         the role of the relation
721:             * @param searchDir    the direction of the relation
722:             * @return             a list of related nodes
723:             */
724:            public NodeList getRelatedNodes(String nodeManager, String role,
725:                    String searchDir);
726:
727:            /**
728:             * Returns all related nodes that have a specific node manager and role.
729:             * The returned nodes are not the nodes directly attached to this node (the
730:             * relation nodes) but the nodes attached to the relation nodes of this
731:             * node.
732:             *
733:             * @since MMBase-1.6
734:             * @param nodeManager  the node manager the returned nodes should have
735:             * @param role         the role of the relation
736:             * @param searchDir    the direction of the relation
737:             * @return             a list of related nodes
738:             */
739:            public NodeList getRelatedNodes(NodeManager nodeManager,
740:                    String role, String searchDir);
741:
742:            /**
743:             * Returns a query to reretrieve this node. It is not very usefull 'as is' because you already
744:             * have the node. The result can however be changed (with addRelationsStep), to find 'related nodes'.
745:             *
746:             * @since MMBase-1.7.
747:             * @see   NodeManager#getList
748:             * @see   Query#addRelationStep
749:             */
750:            //public Query    createQuery();
751:            /**
752:             * Returns the number of related nodes that have a specific node manager.
753:             * The counted nodes are not the nodes directly attached to this node (the
754:             * relation nodes) but the nodes attached to the relation nodes of this
755:             * node.
756:             *
757:             * @param nodeManager  the name of the node manager the counted nodes
758:             *                     should have
759:             * @return             the number of related nodes that have a specific node
760:             *                     manager
761:             */
762:            public int countRelatedNodes(String nodeManager);
763:
764:            /**
765:             * @param otherNodeManager the node manager the nodes should have
766:             * @param role the role of the relation
767:             * @param searchDir the direction of the relation
768:             * @return number of related nodes
769:             * @since MMBase-1.7
770:             */
771:            public int countRelatedNodes(NodeManager otherNodeManager,
772:                    String role, String searchDir);
773:
774:            /**
775:             * Returns all aliases for this node.
776:             *
777:             * @return a list of alias names for this node
778:             */
779:            public StringList getAliases();
780:
781:            /**
782:             * Create an alias for this node. An alias can be used to refer to a node in
783:             * addition to his number.
784:             *
785:             * @param alias             the alias to be created for this node
786:             * @throws BridgeException  if the alias allready exists
787:             */
788:            public void createAlias(String alias);
789:
790:            /**
791:             * Delete an alias for this node.
792:             *
793:             * @param alias  the alias to be removed for this node
794:             */
795:            public void deleteAlias(String alias);
796:
797:            /**
798:             * Adds a relation between this node and a specified node to the cloud.
799:             *
800:             * @param destinationNode   the node to which you want to relate this node
801:             * @param relationManager   the relation manager you want to use
802:             * @return                  the added relation
803:             * @throws BridgeException  if the relation manager is not the right one
804:             *                          for this type of relation
805:             */
806:            public Relation createRelation(Node destinationNode,
807:                    RelationManager relationManager);
808:
809:            /**
810:             * Sets the security context of this Node (AKA the 'owner' field)
811:             *
812:             * @param context	    	   The security context to which this node should belong,
813:             * @throws SecurityException   When appropriate rights to perform this are lacking (write / change context rights)
814:             */
815:            public void setContext(String context);
816:
817:            /**
818:             * Get the security context of the current Node
819:             *
820:             * @return the current context of the node (as a String)
821:             * @throws SecurityException   When appropriate rights to perform this are lacking (read rights)
822:             */
823:            public String getContext();
824:
825:            /**
826:             * Contacts the security implementation to find out to which other possible contexts the
827:             * context of this node may be set.
828:             *
829:             * @return A StringList containing the contexts which can be used in setContext on this node.
830:             * @throws SecurityException   When appropriate rights to perform this are lacking (read rights)
831:             */
832:            public StringList getPossibleContexts();
833:
834:            /**
835:             * Check write rights on this node.
836:             *
837:             * @return                      Whether the node may be changed by the current user
838:             */
839:
840:            public boolean mayWrite();
841:
842:            /**
843:             * Check delete rights on this node.
844:             *
845:             * @return                      Whether the node may be deleted by the current user
846:             */
847:
848:            public boolean mayDelete();
849:
850:            /**
851:             * Check context-change rights on this node.
852:             *
853:             * @return                      Whether the current user may change the context of this node
854:             */
855:            public boolean mayChangeContext();
856:
857:            /**
858:             * Returns all the Function objects of this Node
859:             *
860:             * @since MMBase-1.8
861:             * @return a Collection of {@link org.mmbase.util.functions.Function} objects.
862:             */
863:            public Collection<Function<?>> getFunctions();
864:
865:            /**
866:             * Returns a Fuction object.
867:             * The object returned is a {@link org.mmbase.util.functions.Function} object.
868:             * You need to explixitly cast the result to this object, since not all bridge
869:             * implementations (i.e. the RMMCI) support this class.
870:             *
871:             * @since MMBase-1.8
872:             * @param functionName name of the function
873:             * @return a {@link org.mmbase.util.functions.Function} object.
874:             * @throws NotFoundException if the function does not exist
875:             */
876:            public Function<?> getFunction(String functionName);
877:
878:            /**
879:             * Creates a parameter list for a function.
880:             * The list can be filled with parameter values by either using the List set(int, Object) method, to
881:             * set values for parameters by psoition, or by using the set(String, Object) method to
882:             * set parameters by name.<br />
883:             * This object can then be passed to the getFunctionValue method.
884:             * Note that adding extra parameters (with the add(Object) method) won't work and may cause exceptions.<br />
885:             * @since MMBase-1.8
886:             * @param functionName name of the function
887:             * @return a {@link org.mmbase.util.functions.Parameters} object.
888:             * @throws NotFoundException if the function does not exist
889:             */
890:            public Parameters createParameters(String functionName);
891:
892:            /**
893:             * Returns the value of the specified function on the node.  A
894:             * function normally has arguments, which can be supplied with a
895:             * List.
896:             * @since MMBase-1.6
897:             * @param functionName name of the function
898:             * @param parameters list with parameters for the fucntion
899:             * @return the result value of executing the function
900:             * @throws NotFoundException if the function does not exist
901:             */
902:            public FieldValue getFunctionValue(String functionName,
903:                    List parameters);
904:
905:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.