API - Activity
The attribute class provides read and write access to attributes of resources, activities and projects.
Fields
| Field | Type | Description |
|---|---|---|
id | String | Unique identifier |
typeName | String | Activity type name |
name | String | Activity name/content |
begin | ZonedDateTime | Start date |
end | ZonedDateTime | End date |
earliestBegin | ZonedDateTime | Earliest possible start |
latestEnd | ZonedDateTime | Latest possible end |
locationName | String | Activity location |
projectName | String | Associated project |
requestorName | String | Requestor login name |
parentActivityId | String | Parent activity ID |
subActivity | String | Whether this is a sub activity |
activitySeriesId | String | Activity series ID |
attributes | List<Attribute> | Associated attributes |
attributeGroups | List<AttributeGroup> | Attribute groups |
Methods for dynamic attributes
The activity class provides access to all dynamic attributes of the activity. Additionally, the header attributes are also accessible in a dynamic way via the attribute name. The following table lists all header attributes and their corresponding attribute name.
- StaticAttribute.TMS_START
- StaticAttribute.TMS_END
- StaticAttribute.TMS_EARLIEST_START
- StaticAttribute.TMS_LATEST_END
- StaticAttribute.TMS_LOCATION
- StaticAttribute.TMS_PROJECT
- StaticAttribute.TMS_REQUESTOR
- StaticAttribute.TMS_NAME
Look at API_Attribute for more information about attributes and how to access and set values.
/**
* @return Attributes as defined by the administrator and
* static fields referred by {@link StaticAttribute}
*/
List<Attribute> getAttributes();
Methods for header attributes
/**
* the technical UUID of tha activity
*/
String getId();
/**
*
* @return the activity series id of the activity. If the activity
* is not part of a series than null is returned.
*/
String getActivitySeriesId();
/**
*
* The name (former Manual ID) of the activity type
*/
String getTypeName();
/**
*
* @return The name of the activity.
*/
String getName();
/**
*
* @return the name of the project the activity is assigned to.
* If the activity is not assigned to a project than null is returned.
*/
String getProjectName();
/**
*
* @return the login name of the user who requested the activity.
* If the activity is not requested by a user than null is returned.
*/
String getRequestorName();
/**
*
* @return the name (former mmanual id) of the location the activity is assigned to.
*/
String getLocationName();
/**
*
* @param locationName the name of the location (former manual id) to assign the activity to.
* The location needs to be defined by the administrator.
* @throws DataAccessException
*/
void setLocation(String locationName) throws DataAccessException;
/**
* Sets the name of the activity. If administrator has set a display name attribute
* method will raise error
* @param name the name of the activity to be set.
* @throws DataAccessException
*/
void setName(String name) throws DataAccessException;
/**
* Sets the login name of the user who requested the activity. The user needs to
* be defined by the administrator.
* @param loginName the login name of the user who requested the activity.
* @throws DataAccessException
*/
void setRequestor(String loginName) throws DataAccessException;
Methods for timing
/**
*
* @return begin of the activity
*/
ZonedDateTime getBegin();
/**
*
* @return end of the activity
*/
ZonedDateTime getEnd();
/**
*
* @return the earlist start of the activity
*/
ZonedDateTime getEarliestStart();
/**
*
* @return latest posible end of the activtiy
*/
ZonedDateTime getLatestEnd();
/**
* @deprecated use {@link #setStart(ZonedDateTime)}
* @param begin New begin
*/
public void setBegin(ZonedDateTime begin);
/**
* @param start New start
*/
public void setStart(ZonedDateTime start);
/**
* @param end New end
*/
public void setEnd(ZonedDateTime end);
/**
* @param earliestStart New earliest start
*/
public void setEarliestStart(ZonedDateTime earliestStart);
/**
* @param latestEnd New latest end
*/
public void setLatestEnd(ZonedDateTime latestEnd);
Methods for resource assignments
/**
*
* @return all resource assignments of the activity.
* Each resource assignment has a role which can be retrieved
* via {@link Resource#getRole()}
*/
List<Resource> getResourceAssignments();
/**
* Assigns a resource to the activity with a specific role. Resources can be
* assigned several times with different roles. The role is used to
* distinguish between different assignments of the same resource.
* If the administrator has not specified a role than null
* needs to be given as parameter.
*
* @param resource Resource to be assigned to the activity.
* @param role Role of the resource assignment. Can be null
* if no role is specified by the administrator.
* @throws DataAccessException
*/
void addResourceAssignment(Resource resource, String role) throws DataAccessException;
/**
* Removes a resource assignment from the activity. The attribute role of the resource assignment
* is used to identify the specific assignment.
* @param resource Resource to be removed from the activity.
* @throws DataAccessException
*/
void removeResourceAssignment(Resource resource) throws DataAccessException;
Methods for subactivities
/**
* Adds a sub activity to the activity. The sub activity is added to the
* list of sub activities of the activity. See SessionContext.createActivity()
* to create a new sub activity. After adding it as subactivity
* it is persisted in the database.
* @param subActivity Activity to be added as sub activity.
* @throws DataAccessException
*/
void addSubActivity(Activity subActivity) throws DataAccessException;
/**
*
* @return the parent activity id of the activity. If the activity is
* not a sub activity than null is returned.
*/
String getParentActivityId();
/**
*
* @return all sub activities of the activity. If the activity
* has no sub activities than an empty list is returned.
*/
List<Activity> getSubActivities();
/**
* Removes a sub activity from the activity. The sub activity
* is removed from the list of sub activities of the activity
* and deleted from the database.
* @param subActivity
* @throws DataAccessException
*/
void removeSubActivity(Activity subActivity) throws DataAccessException;