KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > bridge > Node


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10
11 package org.mmbase.bridge;
12 import java.util.*;
13 import java.io.InputStream JavaDoc;
14 import org.w3c.dom.Element JavaDoc;
15 import org.w3c.dom.Document JavaDoc;
16 import org.mmbase.util.functions.Function;
17 import org.mmbase.util.functions.Parameters;
18
19 /**
20  * Describes an object in the cloud.
21  *
22  * @author Rob Vermeulen
23  * @author Pierre van Rooden
24  * @version $Id: Node.java,v 1.70 2006/07/11 09:17:48 michiel Exp $
25  */

26 public interface Node extends Comparable JavaDoc {
27
28     /**
29      * Returns the cloud this node belongs to.
30      * @return the Cloud
31      */

32     public Cloud getCloud();
33
34     /**
35      * Returns the node manager for this node.
36      * @return the node manager
37      */

38     public NodeManager getNodeManager();
39
40     /**
41      * Returns the unique number for this node. Every node has a unique number
42      * which can be used to refer to it. In addition to this number a node can
43      * have one or more aliases.
44      * A value of -1 indicates an invalid number.
45      * Other negative values may be used for temporary ids (but not true node numbers).
46      * This may differ by implementation.
47      *
48      * @return the unique number for this node
49      * @see #createAlias(String alias)
50      */

51     public int getNumber();
52
53     /**
54      * Determine whether this Node is a Relation.
55      * @since MMBase-1.6
56      * @return <code>true</code> if this Node is a Relation.
57      */

58     public boolean isRelation();
59
60     /**
61      * Returns this as a Relation.
62      * @since MMBase-1.6
63      * @return a <code>Relation</code> object
64      * @throws ClassCastException if the Node is not a Relation
65      */

66     public Relation toRelation();
67
68     /**
69      * Determine whether this Node is a NodeManager.
70      * @since MMBase-1.6
71      * @return <code>true</code> if this Node is a NodeManager.
72      */

73     public boolean isNodeManager();
74
75     /**
76      * Returns this as a NodeManager.
77      * @since MMBase-1.6
78      * @return a <code>NodeManager</code> object
79      * @throws ClassCastException if the Node is not a NodeManager
80      */

81     public NodeManager toNodeManager();
82
83     /**
84      * Determine whether this Node is a RelationManager.
85      * @since MMBase-1.6
86      * @return <code>true</code> if this Node is a RelationManager.
87      */

88     public boolean isRelationManager();
89
90     /**
91      * Returns this as a RelationManager.
92      * @since MMBase-1.6
93      * @return a <code>NodeManager</code> object
94      * @throws ClassCastException if the Node is not a RelationManager
95      */

96     public RelationManager toRelationManager();
97
98     /**
99      * Sets the value of the specified field using an object, but delegated to the right
100      * set--Value depending on the type of the field.
101      * For example a field of type <code>int</code> can be set using an
102      * <code>Integer</code>.
103      * This change will not be visible to the cloud until the commit method is
104      * called.
105      *
106      * @param fieldName the name of the field to be updated
107      * @param value the new value for the given field
108      */

109     public void setValue(String JavaDoc fieldName, Object JavaDoc value);
110
111     /**
112      * Like setValue, but skips any processing that MMBase would normally perform on a field.
113      * You can use this to set data on fields that are 'system' defined, to prevent (among other
114      * things) infinite recursion. Use with care - in general processing of a field has a purpose!
115
116      * @param fieldName name of field
117      * @param value new value of the field
118      * @since MMBase-1.8
119      */

120     public void setValueWithoutProcess(String JavaDoc fieldName, Object JavaDoc value);
121
122     /**
123      * Sets the value of the specified field using an object, but without dispatching to the right
124      * type first.
125      *
126      * @param fieldName the name of the field to be updated
127      * @param value the new value for the given field
128      * @since MMBase-1.7
129      */

130     public void setObjectValue(String JavaDoc fieldName, Object JavaDoc value);
131
132     /**
133      * Sets the value of the specified field using an <code>boolean</code>.
134      * This change will not be visible to the cloud until the commit method is
135      * called.
136      *
137      * @since MMBase-1.6
138      * @param fieldName the name of the field to be updated
139      * @param value the new value for the given field
140      */

141     public void setBooleanValue(String JavaDoc fieldName, boolean value);
142
143     /**
144      * Sets the value of the specified field using an <code>Node</code>.
145      * This change will not be visible to the cloud until the commit method is
146      * called.
147      *
148      * @since MMBase-1.6
149      * @param fieldName the name of the field to be updated
150      * @param value the new value for the given field
151      */

152     public void setNodeValue(String JavaDoc fieldName, Node value);
153
154     /**
155      * Sets the value of the specified field using an <code>int</code>.
156      * This change will not be visible to the cloud until the commit method is
157      * called.
158      *
159      * @param fieldName the name of the field to be updated
160      * @param value the new value for the given field
161      */

162     public void setIntValue(String JavaDoc fieldName, int value);
163
164     /**
165      * Sets the value of the specified field using a <code>float</code>.
166      * This change will not be visible to the cloud until the commit method is
167      * called.
168      *
169      * @param fieldName the name of the field to be updated
170      * @param value the new value for the given field
171      */

172     public void setFloatValue(String JavaDoc fieldName, float value);
173
174     /**
175      * Sets the value of the specified field using a <code>double</code>.
176      * This change will not be visible to the cloud until the commit method is
177      * called.
178      *
179      * @param fieldName the name of the field to be updated
180      * @param value the new value for the given field
181      */

182     public void setDoubleValue(String JavaDoc fieldName, double value);
183
184     /**
185      * Sets the value of the specified field using a <code>byte array</code>.
186      * This change will not be visible to the cloud until the commit method is
187      * called.
188      *
189      * @param fieldName the name of the field to be updated
190      * @param value the new value for the given field
191      */

192     public void setByteValue(String JavaDoc fieldName, byte[] value);
193
194     /**
195      * Sets the value of the specified field using a <code>java.io.InputStream</code>.
196      * @since MMBase-1.8.
197      */

198     public void setInputStreamValue(String JavaDoc fieldName, InputStream JavaDoc value, long size);
199
200     /**
201      * Sets the value of the specified field using a <code>long</code>.
202      * This change will not be visible to the cloud until the commit method is
203      * called.
204      *
205      * @param fieldName the name of the field to be updated
206      * @param value the new value for the given field
207      */

208     public void setLongValue(String JavaDoc fieldName, long value);
209
210     /**
211      * Sets the value of the specified field using a <code>String</code>.
212      * This change will not be visible to the cloud until the commit method is
213      * called.
214      *
215      * @param fieldName the name of the field to be updated
216      * @param value the new value for the given field
217      */

218     public void setStringValue(String JavaDoc fieldName, String JavaDoc value);
219
220     /**
221      * Sets the value of the specified field using a <code>Date</code>.
222      * This change will not be visible to the cloud until the commit method is
223      * called.
224      *
225      * @param fieldName the name of the field to be updated
226      * @param value the new value for the given field
227      * @since MMBase-1.8
228      */

229     public void setDateValue(String JavaDoc fieldName, Date value);
230
231
232     /**
233      * Sets the value of the specified field using a <code>List</code>.
234      * This change will not be visible to the cloud until the commit method is
235      * called.
236      *
237      * @param fieldName the name of the field to be updated
238      * @param value the new value for the given field
239      * // not yet working
240      * @since MMBase-1.8
241      */

242     public void setListValue(String JavaDoc fieldName, List value);
243
244     /**
245      * Whether the value for the speficied field is <code>null</code>. This avoids acquiring the
246      * complete value if you only want to check if for emptyness.
247      * @since MMBase-1.8
248      */

249     public boolean isNull(String JavaDoc fieldName);
250
251
252     /**
253      * Returns the 'size' (e.g. the number of bytes of a byte array) for the specified field. This
254      * avoids acquiring the complete value if you only want to know how big the value of the field is.
255      * @since MMBase-1.8
256      */

257     public long getSize(String JavaDoc fieldName);
258
259
260     /**
261      * Returns the value of the specified field as an object. For example a
262      * field of type <code>int</code> is returned as an <code>Integer</code>.
263      * The object type may vary and is dependent on how data was stored in a field.
264      * I.e. It may be possible for an Integer field to return it's value as a String
265      * if it was stored that way in the first place.
266      *
267      * @param fieldName the name of the field to be returned
268      * @return the value of the specified field
269      */

270     public Object JavaDoc getValue(String JavaDoc fieldName);
271
272     /**
273      * Returns the field's value as an object. It is not delegated to the right get--Value.
274      * @param fieldName name of the field
275      * @return object value
276      * @since MMBase-1.7
277      */

278     public Object JavaDoc getObjectValue(String JavaDoc fieldName);
279
280     /**
281      * Like getObjectValue, but skips any processing that MMBase would normally perform on a field.
282      * You can use this to get data from a field for validation purposes.
283      *
284      * @param fieldName name of field
285      * @since MMBase-1.8
286      */

287     public Object JavaDoc getValueWithoutProcess(String JavaDoc fieldName);
288
289     /**
290      * Returns the value of the specified field as a <code>boolean</code>.
291      * If the actual value is numeric, this call returns <code>true</code>
292      * if the value is a positive, non-zero, value. In other words, values '0'
293      * and '-1' are considered <code>false</code>.
294      * If the value is a string, this call returns <code>true</code> if
295      * the value is "true" or "yes" (case-insensitive).
296      * In all other cases (including calling byte fields), <code>false</code>
297      * is returned.
298      *
299      * @param fieldName the name of the field to be returned
300      * @return the value of the specified field
301      */

302     public boolean getBooleanValue(String JavaDoc fieldName);
303
304     /**
305      * Returns the value of the specified field as a <code>Node</code>.
306      * If the value is not itself a Node, this call attempts to convert the
307      * original field value to a Node, by trying to retrieve a Node using
308      * the field value as a Node number or alias.<br />
309      * For instance, getNodeValue("destination"), when run on a OAlias object,
310      * returns the referenced destination node (instead of the number, which is
311      * what it normally holds).<br />
312      * Mostly, this call is used in cluster nodes (nodes retrieved by using the
313      * Cloud.getList method. A cluster node returns one of its compound nodes
314      * when an appropriate nodemanager name (name from the nodepath) is specified.
315      * I.e. getNodeValue("people") will return the people-node in the cluster.
316      * If this fails, the method returns <code>null</code>.
317      * <br />
318      * Notes: the behavior of getNodeValue when called on a field that is not
319      * intended to be a node reference is currently undefined and is not
320      * encouraged.
321      * <br />
322      * Calling this method with field "number" or <code>null</code> lets the
323      * Node return a reference to itself, regardless of the actual value of the
324      * number field or status of the Node.
325      *
326      * @param fieldName the name of the field to be returned
327      * @return the value of the specified field
328      * @see Cloud#getList(String, String, String, String, String, String, String, boolean)
329      */

330     public Node getNodeValue(String JavaDoc fieldName);
331
332     /**
333      * Returns the value of the specified field as an <code>int</code>.
334      * Numeric fields are simply converted. Double and float values may be truncated.
335      * For Node values, the numeric key is returned.
336      * Long values return -1 of the value is too large.
337      * Boolean fields return 0 if false, and 1 if true.
338      * String fields are parsed.
339      * If a parsed string contains an error, ot the field value is not of a type that can be converted
340      * (i.e. a byte array), this function returns -1
341      *
342      * @param fieldName the name of the field to be returned
343      * @return the value of the specified field
344      */

345     public int getIntValue(String JavaDoc fieldName);
346
347     /**
348      * Returns the value of the specified field as a <code>float</code>.
349      * This function attempts to convert the value to a float.
350      * Numeric fields are simply converted.
351      * Boolean fields return 0.0 if false, and 1.0 if true.
352      * String fields are parsed.
353      * If a parsed string contains an error, ot the field value is not of a type that can be converted
354      * (i.e. a byte array), this function returns -1.0.
355      *
356      * @param fieldName the name of the field to be returned
357      * @return the value of the specified field
358      */

359     public float getFloatValue(String JavaDoc fieldName);
360
361     /**
362      * Returns the value of the specified field as a <code>long</code>.
363      * This function attempts to convert the value to a long.
364      * Numeric fields are simply converted. Double and float values may be truncated.
365      * Boolean fields return 0 if false, and 1 if true.
366      * String fields are parsed.
367      * If a parsed string contains an error, ot the field value is not of a type that can be converted
368      * (i.e. a byte array), this function returns -1
369      *
370      * @param fieldName the name of the field to be returned
371      * @return the value of the specified field
372      */

373     public long getLongValue(String JavaDoc fieldName);
374
375     /**
376      * Returns the value of the specified field as a <code>double</code>.
377      * This function attempts to convert the value to a double.
378      * Numeric fields are simply converted. Double may be truncated.
379      * Boolean fields return 0.0 if false, and 1.0 if true.
380      * String fields are parsed.
381      * If a parsed string contains an error, ot the field value is not of a type that can be converted
382      * (i.e. a byte array), this function returns -1.0.
383      *
384      * @param fieldName the name of the field to be returned
385      * @return the value of the specified field
386      */

387     public double getDoubleValue(String JavaDoc fieldName);
388
389     /**
390      * Returns the value of the specified field as a <code>byte array</code>.
391      * This function returns either the value of a byte field, or the byte value of a string
392      * (converted using the default encoding, i.e. UTF8)
393      * Other types of values return an empty byte-array.
394      *
395      * @param fieldName the name of the field to be returned
396      * @return the value of the specified field
397      */

398     public byte[] getByteValue(String JavaDoc fieldName);
399
400
401     /**
402      * Returns the value of the specified field as a <code>java.io.InputStream</code> This is
403      * especially usefull for large byte-array fields. By this you can avoid them to be completely
404      * stored in memory.
405      * @since MMBase-1.8
406      */

407     public InputStream JavaDoc getInputStreamValue(String JavaDoc fieldName);
408
409
410     /**
411      * Returns the value of the specified field as a <code>String</code>.
412      * Byte arrays are converted to string using the default encoding (UTF8).
413      * Node values return a string representation of their numeric key.
414      * For other values the result is calling the toString() method on the actual object.
415      *
416      * @param fieldName the name of the field to be returned
417      * @return the value of the specified field
418      */

419     public String JavaDoc getStringValue(String JavaDoc fieldName);
420
421     /**
422      * @param fieldName the name of the field to be returned
423      * @return the value of the specified field
424      * @since MMBase-1.8
425      */

426     public Date getDateValue(String JavaDoc fieldName);
427
428     /**
429      * @param fieldName the name of the field to be returned
430      * @return the value of the specified field
431      * not yet working
432      * @since MMBase-1.8
433      */

434     public List getListValue(String JavaDoc fieldName);
435
436
437     /**
438      * Returns the value of the specified field as a <code>FieldValue</code> object.
439      *
440      * @since MMBase-1.6
441      * @param fieldName the name of the field whose value to return
442      * @return the value of the specified field
443      * @throws NotFoundException is the field does not exist
444      */

445     public FieldValue getFieldValue(String JavaDoc fieldName) throws NotFoundException;
446
447     /**
448      * Returns the value of the specified field as a <code>FieldValue</code> object.
449      *
450      * @since MMBase-1.6
451      * @param field the Field object whose value to return
452      * @return the value of the specified field
453      */

454     public FieldValue getFieldValue(Field field);
455
456     /**
457      * Validates a node by checking the values from it's field against the constraints of
458      * each field's datatype.
459      * This method is called by the {@link #commit} method, after commit processors are run.
460      * Note that because commit processors may make necessary changes to field values, it is possible for
461      * validate() to fail when used outside the commit process if the constraints are set too strict.
462      * @return Collection of errors as <code>String</code> (in the current locale of the cloud) or an empty collection if everything ok.
463      * @since MMBase-1.8
464      */

465     public Collection validate();
466
467     /**
468      * Commit the node to the database.
469      * Prior to committing, the values are processed by any commit-processors associated with the datatype of the node's fields),
470      * then validated.
471      * Makes this node and/or the changes made to this node visible to the cloud.
472      * If this method is called for the first time on this node it will make
473      * this node visible to the cloud, otherwise the modifications made to
474      * this node using the set methods will be made visible to the cloud.
475      * This action fails if the current node is not in edit mode.
476      * If the node is in a transaction, nothing happens - actual committing occurs through the transaction.
477      * @throws BridgeException
478      * @throws IllegalArgumentException If certain value of the node are invalid according to their data type.
479      */

480     public void commit();
481
482     /**
483      * Cancel changes to a node
484      * This 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      */

487     public void cancel();
488
489     /**
490      * Removes the Node. Throws an exception if still has relations. Like delete(false).
491      */

492     public void delete();
493
494     /**
495      * Whether this Node is new (not yet commited).
496      * @since MMBase-1.8
497      */

498     public boolean isNew();
499
500     /**
501      * Whether a certain field's value was changed since the last commit.
502      * @since MMBase-1.8
503      */

504     public boolean isChanged(String JavaDoc fieldName);
505
506     /**
507      * A Set of Strings containing the names of all changed fields.
508      * @since MMBase-1.8
509      */

510     public Set getChanged();
511
512     /**
513      * Whether field values were changed since the last commit.
514      * @since MMBase-1.8
515      */

516     public boolean isChanged();
517
518     /**
519      * Removes the Node.
520      * @param deleteRelations a boolean. If true, then first all
521      * existing relations with this node will be removed.
522      */

523
524     public void delete(boolean deleteRelations);
525
526     /**
527      * Converts the node to a string
528      * @return string representation of a node
529      */

530     public String JavaDoc toString();
531
532     /**
533      * Returns the value of the specified field as a <code>dom.Document</code>
534      * If the node value is not itself a Document, the method attempts to
535      * attempts to convert the String value into an XML.
536      * This included the empty string, but not the 'null' value.
537      * If the value is null, this method returns <code>null</code>
538      *
539      * @param fieldName the name of the field to be returned
540      * @return the value of the specified field as a DOM Element or <code>null</code>
541      * @throws IllegalArgumentException if the value cannot be converted to xml.
542      * @since MMBase-1.6
543      */

544     public Document JavaDoc getXMLValue(String JavaDoc fieldName) throws IllegalArgumentException JavaDoc;
545
546     /**
547      * Returns the value of the specified field as a <code>dom.Element</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 method fails (throws a IllegalArgumentException) if the Field is not of type TYPE_XML.
551      * If the value cannot be converted, this method returns <code>null</code>
552      *
553      * @param fieldName the name of the field to be returned
554      * @param tree the DOM Document to which the Element is added
555      * (as the document root element)
556      * @return the value of the specified field as a DOM Element or <code>null</code>
557      * @throws IllegalArgumentException if the value cannot be converted to xml.
558      * @since MMBase-1.6
559      */

560
561     public Element JavaDoc getXMLValue(String JavaDoc fieldName, Document JavaDoc tree) throws IllegalArgumentException JavaDoc;
562
563     /**
564      * Set's the value of the specified field as a <code>dom.Element</code>
565      *
566      * @param fieldName the name of the field to be returned
567      * @param value the DOM Document to has to be set, if not correct doc-type,
568      * system will try to convert it to the wanted type.
569      * @since MMBase-1.6
570      */

571     public void setXMLValue(String JavaDoc fieldName, Document JavaDoc value);
572
573     /**
574      * Checks whether this node has any relations.
575      *
576      * @return <code>true</code> if the node has relations
577      */

578     public boolean hasRelations();
579
580     /**
581      * Removes all relation nodes attached to this node.
582      */

583     public void deleteRelations();
584
585     /**
586       * Removes all relation nodes with a certain relation manager that are
587      * attached to this node.
588      *
589      * @param relationManager the name of the relation manager the removed
590      * relation nodes should have
591      */

592     public void deleteRelations(String JavaDoc relationManager);
593
594     /**
595      * Returns all relation nodes attached to this node.
596      *
597      * @return a list of relation nodes
598      */

599     public RelationList getRelations();
600
601     /**
602      * Returns all relation nodes attached to this node that have a specific
603      * role
604      *
605      * @param role the name of the role the returned
606      * relation nodes should have
607      * @return a list of relation nodes
608      */

609     public RelationList getRelations(String JavaDoc role);
610
611     /**
612      * Returns all relation nodes attached to this node that have a specific
613      * role, or refer a node from a specific nodemanager
614      *
615      * @param role the name of the role the returned
616      * relation nodes should have
617      * @param nodeManager the name of the nodemanager for the nodes the returned
618      * relation nodes should have a relation to
619      * @return a list of relation nodes
620      */

621     public RelationList getRelations(String JavaDoc role, String JavaDoc nodeManager);
622
623     /**
624      * Returns all relation nodes attached to this node that have a specific
625      * role, or refer a node from a specific nodemanager
626      *
627      * @param role the name of the role the returned
628      * relation nodes should have
629      * @param nodeManager the nodemanager for the nodes the returned
630      * relation nodes should have a relation to (can be null)
631      * @return a list of relation nodes
632      */

633     public RelationList getRelations(String JavaDoc role, NodeManager nodeManager);
634
635
636     /**
637      * @param role forward role of a relation
638      * @param nodeManager node manager on the other side of the relation
639      * @param searchDir the direction of the relation
640      * @return List of relations
641      * @since MMBase-1.7
642      */

643     public RelationList getRelations(String JavaDoc role, NodeManager nodeManager, String JavaDoc searchDir);
644
645     /**
646      * Returns the number of relations this node has with other nodes.
647      *
648      * @return the number of relations this node has with other nodes
649      */

650     public int countRelations();
651
652     /**
653      * Returns the number of relation nodes attached to this node that have a
654      * specific relation manager.
655      * @param relationManager relation manager
656      * @return the number of relation nodes attached to this node that have a
657      * specific relation manager
658      */

659     public int countRelations(String JavaDoc relationManager);
660
661
662     /**
663      * Returns all related nodes.
664      * The returned nodes are not the nodes directly attached to this node (the
665      * relation nodes) but the nodes attached to the relation nodes of this
666      * node.
667      *
668      * @return a list of all related nodes
669      */

670     public NodeList getRelatedNodes();
671
672     /**
673      * Returns all related nodes that have a specific node manager.
674      * The returned nodes are not the nodes directly attached to this node (the
675      * relation nodes) but the nodes attached to the relation nodes of this
676      * node.
677      *
678      * @param nodeManager the name of the node manager the returned nodes
679      * should have
680      * @return a list of related nodes
681      */

682     public NodeList getRelatedNodes(String JavaDoc nodeManager);
683
684     /**
685      * Returns all related nodes that have a specific node manager.
686      * The returned nodes are not the nodes directly attached to this node (the
687      * relation nodes) but the nodes attached to the relation nodes of this
688      * node.
689      *
690      * @param nodeManager the node manager the returned nodes should have, can be null
691      * @return a list of related nodes
692      */

693     public NodeList getRelatedNodes(NodeManager nodeManager);
694
695     /**
696      * Returns all related nodes that have a specific node manager and role.
697      * The returned nodes are not the nodes directly attached to this node (the
698      * relation nodes) but the nodes attached to the relation nodes of this
699      * node.
700      *
701      * @since MMBase-1.6
702      * @param nodeManager the name of the node manager the returned nodes
703      * should have
704      * @param role the role of the relation
705      * @param searchDir the direction of the relation
706      * @return a list of related nodes
707      */

708     public NodeList getRelatedNodes(String JavaDoc nodeManager, String JavaDoc role, String JavaDoc searchDir);
709
710     /**
711      * Returns all related nodes that have a specific node manager and role.
712      * The returned nodes are not the nodes directly attached to this node (the
713      * relation nodes) but the nodes attached to the relation nodes of this
714      * node.
715      *
716      * @since MMBase-1.6
717      * @param nodeManager the node manager the returned nodes should have
718      * @param role the role of the relation
719      * @param searchDir the direction of the relation
720      * @return a list of related nodes
721      */

722     public NodeList getRelatedNodes(NodeManager nodeManager, String JavaDoc role, String JavaDoc searchDir);
723
724
725
726     /**
727      * Returns a query to reretrieve this node. It is not very usefull 'as is' because you already
728      * have the node. The result can however be changed (with addRelationsStep), to find 'related nodes'.
729      *
730      * @since MMBase-1.7.
731      * @see NodeManager#getList
732      * @see Query#addRelationStep
733      */

734     //public Query createQuery();
735

736     /**
737      * Returns the number of related nodes that have a specific node manager.
738      * The counted nodes are not the nodes directly attached to this node (the
739      * relation nodes) but the nodes attached to the relation nodes of this
740      * node.
741      *
742      * @param nodeManager the name of the node manager the counted nodes
743      * should have
744      * @return the number of related nodes that have a specific node
745      * manager
746      */

747     public int countRelatedNodes(String JavaDoc nodeManager);
748
749
750     /**
751      * @param otherNodeManager the node manager the nodes should have
752      * @param role the role of the relation
753      * @param searchDir the direction of the relation
754      * @return number of related nodes
755      * @since MMBase-1.7
756      */

757     public int countRelatedNodes(NodeManager otherNodeManager, String JavaDoc role, String JavaDoc searchDir);
758
759
760
761     /**
762      * Returns all aliases for this node.
763      *
764      * @return a list of alias names for this node
765      */

766     public StringList getAliases();
767
768     /**
769      * Create an alias for this node. An alias can be used to refer to a node in
770      * addition to his number.
771      *
772      * @param alias the alias to be created for this node
773      * @throws BridgeException if the alias allready exists
774      */

775     public void createAlias(String JavaDoc alias);
776
777     /**
778      * Delete an alias for this node.
779      *
780      * @param alias the alias to be removed for this node
781      */

782     public void deleteAlias(String JavaDoc alias);
783
784     /**
785      * Adds a relation between this node and a specified node to the cloud.
786      *
787      * @param destinationNode the node to which you want to relate this node
788      * @param relationManager the relation manager you want to use
789      * @return the added relation
790      * @throws BridgeException if the relation manager is not the right one
791      * for this type of relation
792      */

793     public Relation createRelation(Node destinationNode,
794                                    RelationManager relationManager);
795
796     /**
797      * Sets the security context of this Node (AKA the 'owner' field)
798      *
799      * @param context The security context to which this node should belong,
800      * @throws SecurityException When appropriate rights to perform this are lacking (write / change context rights)
801      */

802     public void setContext(String JavaDoc context);
803
804     /**
805      * Get the security context of the current Node
806      *
807      * @return the current context of the node (as a String)
808      * @throws SecurityException When appropriate rights to perform this are lacking (read rights)
809      */

810     public String JavaDoc getContext();
811
812     /**
813      * Contacts the security implementation to find out to which other possible contexts the
814      * context of this node may be set.
815      *
816      * @return A StringList containing the contexts which can be used in setContext on this node.
817      * @throws SecurityException When appropriate rights to perform this are lacking (read rights)
818      */

819     public StringList getPossibleContexts();
820
821     /**
822      * Check write rights on this node.
823      *
824      * @return Whether the node may be changed by the current user
825      */

826
827     public boolean mayWrite();
828
829     /**
830      * Check delete rights on this node.
831      *
832      * @return Whether the node may be deleted by the current user
833      */

834
835     public boolean mayDelete();
836
837
838     /**
839      * Check context-change rights on this node.
840      *
841      * @return Whether the current user may change the context of this node
842      */

843     public boolean mayChangeContext();
844
845     /**
846      * Returns all the Function objects of this Node
847      *
848      * @since MMBase-1.8
849      * @return a Collection of {@link org.mmbase.util.functions.Function} objects.
850      */

851     public Collection getFunctions();
852
853     /**
854      * Returns a Fuction object.
855      * The object returned is a {@link org.mmbase.util.functions.Function} object.
856      * You need to explixitly cast the result to this object, since not all bridge
857      * implementations (i.e. the RMMCI) support this class.
858      *
859      * @since MMBase-1.8
860      * @param functionName name of the function
861      * @return a {@link org.mmbase.util.functions.Function} object.
862      * @throws NotFoundException if the function does not exist
863      */

864     public Function getFunction(String JavaDoc functionName);
865
866     /**
867      * Creates a parameter list for a function.
868      * The list can be filled with parameter values by either using the List set(int, Object) method, to
869      * set values for parameters by psoition, or by using the set(String, Object) method to
870      * set parameters by name.<br />
871      * This object can then be passed to the getFunctionValue method.
872      * Note that adding extra parameters (with the add(Object) method) won't work and may cause exceptions.<br />
873      * @since MMBase-1.8
874      * @param functionName name of the function
875      * @return a {@link org.mmbase.util.functions.Parameters} object.
876      * @throws NotFoundException if the function does not exist
877      */

878     public Parameters createParameters(String JavaDoc functionName);
879
880     /**
881      * Returns the value of the specified function on the node. A
882      * function normally has arguments, which can be supplied with a
883      * List.
884      * @since MMBase-1.6
885      * @param functionName name of the function
886      * @param parameters list with parameters for the fucntion
887      * @return the result value of executing the function
888      * @throws NotFoundException if the function does not exist
889      */

890     public FieldValue getFunctionValue(String JavaDoc functionName, List parameters);
891
892 }
893
Popular Tags