net.sourceforge.ganttproject.resource
Interface ResourceManager

All Known Implementing Classes:
HumanResourceManager

public interface ResourceManager

This interface is used to isolate the implementation of a resource manager from the application. The interface is defined against an abstract class the ProjectResource class. Normally only one instance of the Resourcemanager should be instantiated.

Author:
barmeier

Method Summary
 void add(ProjectResource resource)
          Adds the resource to the internal list of available resources.
 void addView(ResourceView view)
          Adds a new view of this manager
 void clear()
          Removes all resources from the manager.
 ProjectResource create(java.lang.String name)
          The only thing that must be known when creating a new resource is the name of the resource.
 ProjectResource create(java.lang.String name, int i)
           
 ProjectResource getById(int id)
          Retrieves an ancestor of ProjectResource identified by an identity value.
 java.util.ArrayList getResources()
          Retrieves a list of all resources available.
 java.util.ArrayList load(java.io.InputStream source)
          Loads resources from the InputStreamReader.
 void remove(ProjectResource resource)
          Removes the resource.
 void removeById(int Id)
          Removes the resource by its id.
 void save(java.io.OutputStream target)
          Writes all resources stored in the OutputStreamWriter.
 

Method Detail

create

public ProjectResource create(java.lang.String name)
The only thing that must be known when creating a new resource is the name of the resource. This methods creates a ProjectResource conform object, sets the id to an unused value and sets the name to the name given by the parameter name after alle the object will be added to the list of available resources. The methods returns the generated object or null when something fails. BE AWARE Null Pointer Exceptions are waiting here ;)

Parameters:
name - The name of the resource that should be added.
Returns:
A ProjectResource object with name and id set.
See Also:
ProjectResource

create

public ProjectResource create(java.lang.String name,
                              int i)

add

public void add(ProjectResource resource)
Adds the resource to the internal list of available resources.

Parameters:
resource - The resource that should be added to the list.

getById

public ProjectResource getById(int id)
Retrieves an ancestor of ProjectResource identified by an identity value.

Parameters:
id - The id is an integer value that is unique for every resource.
Returns:
Ancestor of ProjectResource containing the requested resource.
See Also:
ProjectResource

remove

public void remove(ProjectResource resource)
Removes the resource.

Parameters:
resource - The resource to remove.

removeById

public void removeById(int Id)
Removes the resource by its id.

Parameters:
Id - Id of the resource to remove.

getResources

public java.util.ArrayList getResources()
Retrieves a list of all resources available.

Returns:
ArrayList filled with ProjectResource ancestors.
See Also:
ProjectResource

load

public java.util.ArrayList load(java.io.InputStream source)
Loads resources from the InputStreamReader. All resources already stored in the Resourcemanager are lost and will be replace with the resources loaded from the stream.

Parameters:
source - The InputStreamReader from which the data will be read. The format and kind of data read is subject of the class implementing this interface.
Returns:
The ArrayLisr returned contains all ProjectResource ancestor that were read from the InputStreamReader.

save

public void save(java.io.OutputStream target)
Writes all resources stored in the OutputStreamWriter. The format and kind of data written in the stream are subject of the class that implements this interface.

Parameters:
target - Stream to write the data to.

clear

public void clear()
Removes all resources from the manager.


addView

public void addView(ResourceView view)
Adds a new view of this manager

Parameters:
view -


${copyright}