com.sonyericsson.hudson.plugins.metadata.model
Class MetadataBuildAction

java.lang.Object
  extended by com.sonyericsson.hudson.plugins.metadata.model.MetadataBuildAction
All Implemented Interfaces:
MetadataContainer<MetadataValue>, MetadataParent<MetadataValue>, hudson.model.Action, hudson.model.ModelObject, jenkins.model.RunAction2

public class MetadataBuildAction
extends Object
implements jenkins.model.RunAction2, MetadataContainer<MetadataValue>

Holds the meta data for a run.

Author:
Robert Sandell <robert.sandell@sonyericsson.com>

Constructor Summary
MetadataBuildAction()
          Default constructor.
MetadataBuildAction(hudson.model.Run run)
          Deprecated. 
MetadataBuildAction(hudson.model.Run run, List<MetadataValue> values)
          Deprecated. 
 
Method Summary
 Collection<MetadataValue> addChild(MetadataValue value)
          Adds the child to the list of children.
 Collection<MetadataValue> addChildren(Collection<MetadataValue> childValues)
          Adds the children to this parent's list of children.
 hudson.security.ACL getACL()
          Returns the ACL for the owner of the container..
 MetadataValue getChild(String name)
          Returns the child with the given name, or null if there is none.
 Collection<String> getChildNames()
          The child names of this parent.
 Collection<MetadataValue> getChildren()
          The children of this parent.
 String getDisplayName()
           
 String getFullName()
          The full name of the element.
 String getFullName(String separator)
          The full name of the element, using the chosen separator string.
 String getFullNameFrom(MetadataParent base)
          Gives the full name from the given parent.
 String getIconFileName()
           
 hudson.model.Run getRun()
          The run that this action is added to.
 String getUrlName()
           
 List<MetadataValue> getValues()
          The meta data in this action.
 int indexOf(String name)
          The index of the child with the provided name.
 void onAttached(hudson.model.Run<?,?> r)
           
 void onLoad(hudson.model.Run<?,?> r)
           
 boolean requiresReplacement()
          If this parent type requires to be replaced or not when a replacement command is issued.
 void save()
          Saves the container to disc, usually achieved by calling save on whatever Saveable this container is in.
 MetadataValue setChild(int index, MetadataValue value)
          Sets the child on index with the provided value, replacing any object currently on that index.
 net.sf.json.JSON toJson()
          Convert this object into a JSON object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetadataBuildAction

@Deprecated
public MetadataBuildAction(hudson.model.Run run,
                                      List<MetadataValue> values)
Deprecated. 


MetadataBuildAction

@Deprecated
public MetadataBuildAction(hudson.model.Run run)
Deprecated. 


MetadataBuildAction

public MetadataBuildAction()
Default constructor.

Method Detail

getIconFileName

public String getIconFileName()
Specified by:
getIconFileName in interface hudson.model.Action

getDisplayName

public String getDisplayName()
Specified by:
getDisplayName in interface hudson.model.Action
Specified by:
getDisplayName in interface hudson.model.ModelObject

getUrlName

public String getUrlName()
Specified by:
getUrlName in interface hudson.model.Action

onAttached

public void onAttached(hudson.model.Run<?,?> r)
Specified by:
onAttached in interface jenkins.model.RunAction2

onLoad

public void onLoad(hudson.model.Run<?,?> r)
Specified by:
onLoad in interface jenkins.model.RunAction2

getRun

public hudson.model.Run getRun()
The run that this action is added to.

Returns:
the run.

getValues

public List<MetadataValue> getValues()
The meta data in this action.

Returns:
the meta data.
See Also:
getChildren()

getChild

public MetadataValue getChild(String name)
Description copied from interface: MetadataParent
Returns the child with the given name, or null if there is none. comparison is case insensitive.

Specified by:
getChild in interface MetadataParent<MetadataValue>
Parameters:
name - the name to search for.
Returns:
the child.

indexOf

public int indexOf(String name)
Description copied from interface: MetadataParent
The index of the child with the provided name.

Specified by:
indexOf in interface MetadataParent<MetadataValue>
Parameters:
name - the name of the child to find.
Returns:
the index of the child or -1 if no child with that name was found.

setChild

public MetadataValue setChild(int index,
                              MetadataValue value)
Description copied from interface: MetadataParent
Sets the child on index with the provided value, replacing any object currently on that index.

Specified by:
setChild in interface MetadataParent<MetadataValue>
Parameters:
index - the index to set.
value - the child to set.
Returns:
the value previous at the specified index.

addChild

public Collection<MetadataValue> addChild(MetadataValue value)
Description copied from interface: MetadataParent
Adds the child to the list of children. If a child with the same name is already present, the children should try to be merged. The returned child is either the child itself if it is a leaf or a clone of itself with the children that failed to be merged if it contains children, null indicates a fully successful merge/add.

Specified by:
addChild in interface MetadataParent<MetadataValue>
Parameters:
value - the child to add.
Returns:
null if the operation was successful.

addChildren

public Collection<MetadataValue> addChildren(Collection<MetadataValue> childValues)
Description copied from interface: MetadataParent
Adds the children to this parent's list of children. If a child with the same name is already present, the children should try to be merged.

Specified by:
addChildren in interface MetadataParent<MetadataValue>
Parameters:
childValues - the children to add.
Returns:
the children that failed to be added/merged or null if all succeeded.

getChildren

public Collection<MetadataValue> getChildren()
Description copied from interface: MetadataParent
The children of this parent.

Specified by:
getChildren in interface MetadataParent<MetadataValue>
Returns:
the children.

getChildNames

public Collection<String> getChildNames()
Description copied from interface: MetadataParent
The child names of this parent.

Specified by:
getChildNames in interface MetadataParent<MetadataValue>
Returns:
the child names of this parent.

getFullName

public String getFullName()
Description copied from interface: MetadataParent
The full name of the element.

Specified by:
getFullName in interface MetadataParent<MetadataValue>
Returns:
the fullName.

getFullName

public String getFullName(String separator)
Description copied from interface: MetadataParent
The full name of the element, using the chosen separator string.

Specified by:
getFullName in interface MetadataParent<MetadataValue>
Parameters:
separator - the separator string.
Returns:
the fullName.

getFullNameFrom

public String getFullNameFrom(MetadataParent base)
Description copied from interface: MetadataParent
Gives the full name from the given parent.

Specified by:
getFullNameFrom in interface MetadataParent<MetadataValue>
Parameters:
base - the parent to base the tree structure from.
Returns:
a dot separated path from the base up to this item.

toJson

public net.sf.json.JSON toJson()
Description copied from interface: MetadataParent
Convert this object into a JSON object.

Specified by:
toJson in interface MetadataParent<MetadataValue>
Returns:
the JSON version.

requiresReplacement

public boolean requiresReplacement()
Description copied from interface: MetadataParent
If this parent type requires to be replaced or not when a replacement command is issued. I.e. If this is just a holder of children then it is not necessary, but if it contains more complex structures it might want to.

Specified by:
requiresReplacement in interface MetadataParent<MetadataValue>
Returns:
true if it needs to be replaced by fresher instances or false if it can be reused.
See Also:
MetadataValue.replacementOf( com.sonyericsson.hudson.plugins.metadata.model.values.MetadataValue)

save

public void save()
          throws IOException
Description copied from interface: MetadataContainer
Saves the container to disc, usually achieved by calling save on whatever Saveable this container is in.

Specified by:
save in interface MetadataContainer<MetadataValue>
Throws:
IOException - if the persistence.

getACL

public hudson.security.ACL getACL()
Description copied from interface: MetadataContainer
Returns the ACL for the owner of the container..

Specified by:
getACL in interface MetadataContainer<MetadataValue>
Returns:
the ACL.


Copyright © 2004-2013. All Rights Reserved.