Show StoryCardDataObject.java syntax highlighted
package persister.impl.data;
import java.io.Serializable;
import persister.StoryCard;
public class StoryCardDataObject implements StoryCard, Serializable {
private static final long serialVersionUID = -2801250845252360635L;
private long id, parent;
private float actualEffort, bestCaseEstimate, mostLikelyEstimate, worstCaseEstimate;
private int width, height, locationX, locationY;
private String name, description, status;
public StoryCardDataObject() {
this.id = 0;
this.parent = 0;
this.name = "Default StoryCard";
this.description = "description";
this.width = DEFAULT_WIDTH;
this.height = DEFAULT_HEIGHT;
this.locationX = DEFAULT_LOCATION_X;
this.locationY = DEFAULT_LOCATION_Y;
this.bestCaseEstimate = 0f;
this.mostLikelyEstimate = 0f;
this.worstCaseEstimate = 0f;
this.actualEffort = 0f;
this.status = STATUS_DEFINED;
}
public StoryCardDataObject(long id, long parentid, String name, String description, int width, int height,
int locationX, int locationY, float bestCaseEstimate, float mostlikelyEstimate, float worstCaseEstimate, float actualEffort, String status) {
this.id = id;
this.parent = parentid;
this.name = name;
this.description = description;
this.width = width;
this.height = height;
this.locationX = locationX;
this.locationY = locationY;
this.bestCaseEstimate = bestCaseEstimate;
this.mostLikelyEstimate = mostlikelyEstimate;
this.worstCaseEstimate = worstCaseEstimate;
this.actualEffort = actualEffort;
this.status = STATUS_DEFINED;
}
public StoryCardDataObject(long parentid, String name, String description, int width, int height,
int locationX, int locationY, float bestCaseEstimate, float mostlikelyEstimate, float worstCaseEstimate, float actualEffort, String status) {
this.id = 0;
this.parent = parentid;
this.name = name;
this.description = description;
this.width = width;
this.height = height;
this.locationX = locationX;
this.locationY = locationY;
this.bestCaseEstimate = bestCaseEstimate;
this.mostLikelyEstimate = mostlikelyEstimate;
this.worstCaseEstimate = worstCaseEstimate;
this.actualEffort = actualEffort;
this.status = STATUS_DEFINED;
}
@Override
public Object clone() {
return new StoryCardDataObject(this.id, this.parent,
new String(this.name), new String(this.description),
this.width, this.height, this.locationX, this.locationY,
this.bestCaseEstimate, this.mostLikelyEstimate,
this.worstCaseEstimate, this.actualEffort, this.getStatus());
}
public boolean equals (Object o){
if (o instanceof StoryCardDataObject){
StoryCardDataObject storycard = (StoryCardDataObject) o;
return ((this.id == storycard.getId()) &&
(this.parent == storycard.getParent()) &&
(this.height ==storycard.getHeight()) &&
(this.width == storycard.getWidth()) &&
(this.locationX == storycard.getLocationX()) &&
(this.locationY == storycard.getLocationY()) &&
(this.bestCaseEstimate == storycard.getBestCaseEstimate()) &&
(this.mostLikelyEstimate == storycard.getMostlikelyEstimate()) &&
(this.worstCaseEstimate == storycard.getWorstCaseEstimate()) &&
(this.actualEffort == storycard.getActualEffort()) &&
(this.name.equals(storycard.getName())) &&
(this.description.equals(storycard.getDescription())));
}
else
return false;
}
public float getActualEffort() {
return this.actualEffort;
}
public float getBestCaseEstimate() {
return this.bestCaseEstimate;
}
public String getDescription() {
return this.description;
}
public int getHeight() {
return this.height;
}
public long getId() {
return this.id;
}
public int getLocationX() {
return this.locationX;
}
public int getLocationY() {
return this.locationY;
}
public float getMostlikelyEstimate() {
return this.mostLikelyEstimate;
}
public String getName() {
return this.name;
}
public long getParent() {
return this.parent;
}
//TODO check if that is the right formula for remaining effort
public float getRemainingEffort() {
return (mostLikelyEstimate - actualEffort);
}
public String getStatus() {
return this.status;
}
public int getWidth() {
return this.width;
}
public float getWorstCaseEstimate() {
return this.worstCaseEstimate;
}
public boolean isCompleted()
{
return this.status.equals(STATUS_COMPLETED);
}
public boolean isStarted() {
return this.status.equals(STATUS_IN_PROGRESS);
}
public void setActualEffort(float actual) {
this.actualEffort = actual;
}
public void setBestCaseEstimate(float bestcase) {
this.bestCaseEstimate = bestcase;
}
public void setDescription(String description) {
this.description = description;
}
public void setHeight(int height) {
this.height = height;
}
public void setId(long id) {
this.id = id;
}
public void setLocationX(int locationX) {
this.locationX = locationX;
}
public void setLocationY(int locationY) {
this.locationY = locationY;
}
public void setMostlikelyEstimate(float mostlikely) {
this.mostLikelyEstimate = mostlikely;
}
public void setName(String name) {
this.name = name;
}
public void setParent(long id) {
this.parent = id;
}
public void setStatus(String status) {
this.status = status;
}
public void setWidth(int width) {
this.width = width;
}
public void setWorstCaseEstimate(float worstcase) {
this.worstCaseEstimate = worstcase;
}
public String toString() {
String storycard = "###################################\n"+
"# StoryCard #\n" +
"###################################\n\n" +
"ID:\t\t"+this.id+"\n"+
"Name:\t\t"+this.name+"\n"+
"Parent:\t\t"+this.parent+"\n"+
"Size:\t\t"+this.width+" x "+this.height+"\n"+
"Location:\t("+this.locationX+" , "+this.locationY+")\n"+
"Best case:\t"+this.bestCaseEstimate+"\n"+
"Most likely:\t"+this.mostLikelyEstimate+"\n"+
"Worst case:\t"+this.worstCaseEstimate+"\n"+
"Actual:\t\t"+this.actualEffort+"\n"+
"Status:\t"+this.status+"\n\n";
return storycard;
}
//DOES NOT UPDATE PARENT-CHILD RELATIONS!
public void update(StoryCard storycard) {
this.actualEffort = storycard.getActualEffort();
this.bestCaseEstimate = storycard.getBestCaseEstimate();
this.status = storycard.getStatus();
this.description = storycard.getDescription();
this.height = storycard.getHeight();
this.locationX = storycard.getLocationX();
this.locationY = storycard.getLocationY();
this.mostLikelyEstimate = storycard.getMostlikelyEstimate();
this.name = storycard.getName();
this.width = storycard.getWidth();
this.worstCaseEstimate = storycard.getWorstCaseEstimate();
}
}
See more files for this project here