public final class RenameMessage
extends java.lang.Object
RenameMessage
provides the following information for each case:
Case 1) Simple object rename: getOldURL() retrieves the previous Node URL. getRenamedNode() retrieves the Node renamed.
Case 2) Renaming Node changes the Node's type: getOldURL() retrieves the previous Node URL. getRenamedNode() retrieves the Node renamed. getRemovedNode() retrieves the original node being replaced. getNewNode() gets the replacing Node. This could return null if that Node is already in the same container as the original Node being replaced.
Case 3) Node being renamed the same as an existing Node of the same type: getOldURL() retrieves the previous Node URL. getRenamedNode() retrieves the Node renamed. getRemovedNode() retrieves the original node being renamed. getNewNode() may contain the existing node instance if that instance is not part of the project containing the original node.
Case 4) Node being renamed the same as an existing node of different type: Not yet supported. There are 5 cases to be considered when the CHILD_RENAMED message is sent. The RenameMessage
provides the following information for each case:
Case 0) Pre-rename notification. Case 1) Simple object rename: getOldURL() contains the old URL and the child being renamed. getRenamedNode() retrieves the Node renamed.
Case 2) Renaming node changes the node's type getOldURL() retrieves the previous Node URL. getRenamedNode() retrieves the Node renamed. getRemovedNode() retrieves the original node being replaced. getNewNode() gets the replacing Node. This could return null if that Node is already in the same container as the original Node being replaced.
Case 3) Node being renamed the same as an existing node of the same type: getOldURL() retrieves the previous Node URL. getRenamedNode() retrieves the Node renamed. getRemovedNode() retrieves the original node being renamed. getNewNode() get the replacing Node.
Case 4) Node being renamed the same as an existing node of different type: Not yet supported.
UpdateMessage
, Subject
Modifier and Type | Method and Description |
---|---|
static void |
fireChildRenamed(Subject subject, Node doc, java.net.URL oldURL, Node node, Context context)
Case 3) Child renamed notification.
|
static void |
fireChildRenamed(Subject subject, java.net.URL oldURL, Node node, Context context)
Case 1) Child rename notification.
|
static void |
fireChildRenamed(Subject subject, java.net.URL oldURL, Node node, Node duplicate, Context context)
Case 2) Child renamed notification.
|
static void |
fireObjectRenamed(Node doc, java.net.URL oldURL, Node node, Context context)
Case 3) Object renamed notification.
|
static void |
fireObjectRenamed(Subject subject, java.net.URL oldURL, Context context)
Case 1) Object rename notification.
|
static void |
fireObjectRenamed(Subject subject, java.net.URL oldURL, Node node, Node duplicate, Context context)
Case 2) Object renamed notification.
|
static void |
firePreChildRenamed(Subject subject, Context context)
Call this method before the
subject is actually renamed. |
static Node |
getNewNode(UpdateMessage message)
Get the new Node created when an existing one was renamed.
|
static java.net.URL |
getOldURL(UpdateMessage message)
Get the Node's old url.
|
static Node |
getRemovedNode(UpdateMessage message)
Get the Node being removed because the rename caused the creation of a new node.
|
static Node |
getRenamedNode(UpdateMessage message)
Get the renamed Node.
|
static boolean |
isPreRenameMessage(UpdateMessage message)
Check if this notification message is being sent before the actual object rename happened.
|
static void |
setPreRenameMessage(UpdateMessage message, boolean isPreRenameMessage) |
static void |
setRenamedNode(UpdateMessage message, Node renamedNode) |
public static boolean isPreRenameMessage(UpdateMessage message)
public static void setPreRenameMessage(UpdateMessage message, boolean isPreRenameMessage)
public static java.net.URL getOldURL(UpdateMessage message)
public static Node getRenamedNode(UpdateMessage message)
public static void setRenamedNode(UpdateMessage message, Node renamedNode)
public static Node getRemovedNode(UpdateMessage message)
public static Node getNewNode(UpdateMessage message)
public static void fireObjectRenamed(Subject subject, java.net.URL oldURL, Context context)
subject
is the Node being renamed, The oldURL
is the previous Node URL. Observers should use the methods: getOldURL() to get at the old URL.public static void fireChildRenamed(Subject subject, java.net.URL oldURL, Node node, Context context)
subject
is the owner of the Node. The oldURL
is the previous Node URL. Observers should use the methods: getOldURL() to get at the old URL. getRenamedNode to get at the Node renamed.public static void fireObjectRenamed(Subject subject, java.net.URL oldURL, Node node, Node duplicate, Context context)
subject
is the Node being renamed. The doc
is the original Node that after being renamed, should be removed from its owner. The duplicate
is the new Node created with the new URL
. The duplicate
parameter may be null if the original doc
object was renamed to an existing node. Observers should use the methods: getOldURL() to get at the old URL getRemovedNode() to get at the original Node being replaced. getNewNode() to get the replacing Node. This could return null if that Node is already in the same container as the original Node.public static void fireChildRenamed(Subject subject, java.net.URL oldURL, Node node, Node duplicate, Context context)
subject
is the owner of the Node being renamed. The node
is the original Node that after being renamed, should be removed from its owner. The duplicate
is the new Node created with the new URL
. The duplicate
parameter may be null if the original node
object was renamed to an existing node. Observers should use the methods: getOldURL() to get at the old URL getRemovedNode() to get at the original Node being replaced. getNewNode() to get the replacing Node. This could return null if that Node is already in the same container as the original Node.public static void fireObjectRenamed(Node doc, java.net.URL oldURL, Node node, Context context)
subject
is the Node being renamed. The doc
is the original Node that after being renamed, should be removed from its owner. The node
is the new Node created with the new URL
. Observers should use the methods: getOldURL() to get at the old URL getRemovedNode() to get at the original Node being replaced. getNewNode() to get the replacing Node.public static void fireChildRenamed(Subject subject, Node doc, java.net.URL oldURL, Node node, Context context)
subject
is the owner of the Node being renamed. The doc
is the original Node that after being renamed, should be removed from its owner. The node
is the new Node created with the new URL
. Observers should use the methods: getOldURL() to get at the old URL getRemovedNode() to get at the original Node being replaced. getNewNode() to get the replacing Node.