com.sonymobile.jenkins.plugins.teamview
Class Team

java.lang.Object
  extended by hudson.model.AbstractModelObject
      extended by com.sonymobile.jenkins.plugins.teamview.Team
All Implemented Interfaces:
hudson.model.DescriptorByNameOwner, hudson.model.ModelObject, hudson.model.Saveable, hudson.search.SearchableModelObject, hudson.search.SearchItem, Comparable<Team>, jenkins.model.ModelObjectWithContextMenu

public class Team
extends hudson.model.AbstractModelObject
implements hudson.model.Saveable, hudson.model.DescriptorByNameOwner, jenkins.model.ModelObjectWithContextMenu, Comparable<Team>

A team in Jenkins that can contain views.

Author:
Tomas Westling <tomas.westling@sonymobile.com>

Nested Class Summary
 
Nested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
jenkins.model.ModelObjectWithContextMenu.ContextMenu, jenkins.model.ModelObjectWithContextMenu.MenuItem
 
Field Summary
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Constructor Summary
Team(String name, String description)
          Standard constructor.
 
Method Summary
 void addProperty(TeamViewsProperty p)
          Updates the user object by adding a property.
 int compareTo(Team o)
           
 hudson.util.FormValidation doCheckUserName(String userName)
          FormValidation for the userName in /teams/name/import.
 void doConfigSubmit(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Run when the user saves a reconfigured team.
 jenkins.model.ModelObjectWithContextMenu.ContextMenu doContextMenu(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
           
 void doImportViewsSubmit(String userName, org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          The form submit for /teams/name/import imports the views from the userName.
 void doSubmitDescription(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Accepts the new description.
 boolean equals(Object o)
           
protected  hudson.XmlFile getConfigFile()
          Gets the file in which we save our configuration.
 String getDescription()
          Standard getter.
 hudson.model.Descriptor getDescriptorByName(String s)
           
 String getDisplayName()
           
 Object getDynamic(String token, org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Dynamic Stapler URL binding.
 String getName()
          Standard getter.
 List<TeamProperty> getProperties()
          Getter for the list of properties.
<T extends TeamProperty>
T
getProperty(Class<T> clazz)
          Gets the specific property, or null.
 String getSearchUrl()
           
static String[] getTeamNames()
          Gets all the saved team names from disk.
 String getUrl()
          Getter for the Url, relative to the Jenkins root to this team.
 String getUrlName()
          Getter for the Url, relative to nearest ancestor, will not end in a '/'.
 int hashCode()
           
 void load()
          Loads the other data from disk if it's available.
 void save()
          Save the settings to a file.
 
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Team

public Team(String name,
            String description)
Standard constructor.

Parameters:
name - the name of the team.
description - the description of this team.
Method Detail

load

public void load()
Loads the other data from disk if it's available.


getName

public String getName()
Standard getter.

Returns:
the name.

getDescription

public String getDescription()
Standard getter.

Returns:
the description.

getUrl

public String getUrl()
Getter for the Url, relative to the Jenkins root to this team. Will end in a '/'.

Returns:
the Url.

getUrlName

public String getUrlName()
Getter for the Url, relative to nearest ancestor, will not end in a '/'.

Returns:
the Url.

getDisplayName

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

getProperties

public List<TeamProperty> getProperties()
Getter for the list of properties.

Returns:
the properties.

getDynamic

public Object getDynamic(String token,
                         org.kohsuke.stapler.StaplerRequest req,
                         org.kohsuke.stapler.StaplerResponse rsp)
Dynamic Stapler URL binding. Provides the ability to navigate to a team via for example: /jenkins/teams/team1

Parameters:
token - the team name.
req - the StaplerRequest
rsp - the StaplerResponse
Returns:
a Team.

addProperty

public void addProperty(TeamViewsProperty p)
                 throws IOException
Updates the user object by adding a property.

Parameters:
p - the property to add.
Throws:
IOException - if the Team cannot be saved.

getProperty

public <T extends TeamProperty> T getProperty(Class<T> clazz)
Gets the specific property, or null.

Type Parameters:
T - the TeamProperty subtype to find.
Parameters:
clazz - the Class to get the property for.
Returns:
the property.

getTeamNames

public static String[] getTeamNames()
Gets all the saved team names from disk.

Returns:
an Array of team names or null if no teams exist.

getConfigFile

protected final hudson.XmlFile getConfigFile()
Gets the file in which we save our configuration.

Returns:
the XmlFile in which we save our configuration for the Team.

save

public void save()
          throws IOException
Save the settings to a file.

Specified by:
save in interface hudson.model.Saveable
Throws:
IOException - if the file cannot be saved.

doConfigSubmit

public void doConfigSubmit(org.kohsuke.stapler.StaplerRequest request,
                           org.kohsuke.stapler.StaplerResponse response)
                    throws Exception
Run when the user saves a reconfigured team.

Parameters:
request - the StaplerRequest.
response - the StaplerResponse.
Throws:
Exception - if anything goes wrong with the form.

getDescriptorByName

public hudson.model.Descriptor getDescriptorByName(String s)
Specified by:
getDescriptorByName in interface hudson.model.DescriptorByNameOwner

doContextMenu

public jenkins.model.ModelObjectWithContextMenu.ContextMenu doContextMenu(org.kohsuke.stapler.StaplerRequest request,
                                                                          org.kohsuke.stapler.StaplerResponse response)
                                                                   throws Exception
Specified by:
doContextMenu in interface jenkins.model.ModelObjectWithContextMenu
Throws:
Exception

doCheckUserName

public hudson.util.FormValidation doCheckUserName(@QueryParameter
                                                  String userName)
FormValidation for the userName in /teams/name/import.

Parameters:
userName - the username
Returns:
the validation result.

doImportViewsSubmit

public void doImportViewsSubmit(@QueryParameter
                                String userName,
                                org.kohsuke.stapler.StaplerRequest request,
                                org.kohsuke.stapler.StaplerResponse response)
                         throws hudson.model.Descriptor.FormException,
                                TransformerException,
                                IOException,
                                SAXException,
                                ParserConfigurationException
The form submit for /teams/name/import imports the views from the userName.

Parameters:
userName - the userName to fetch the private views from
request - the request
response - the response
Throws:
Descriptor.FormException - if the user does not exist
TransformerException - See importViews(String)
IOException - if so.
SAXException - See importViews(String)
ParserConfigurationException - See importViews(String)

doSubmitDescription

public void doSubmitDescription(org.kohsuke.stapler.StaplerRequest req,
                                org.kohsuke.stapler.StaplerResponse rsp)
                         throws IOException,
                                javax.servlet.ServletException
Accepts the new description.

Parameters:
req - the request
rsp - the response
Throws:
IOException - if so
javax.servlet.ServletException - if so

compareTo

public int compareTo(Team o)
Specified by:
compareTo in interface Comparable<Team>

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getSearchUrl

public String getSearchUrl()
Specified by:
getSearchUrl in interface hudson.search.SearchItem


Copyright © 2004-2013. All Rights Reserved.