/** Gets the String value of the Command for deleting allocations. */ public String getString() { return "the deletion of an Allocation for \"" + team.getShortName() + "\" on \"" + project.getShortName() + "\""; }
/** * Method for creating an XML element for the Allocation within report generation * * @return element for XML generation */ @Override public Element generateXML() { Element allocationElement = ReportGenerator.doc.createElement("allocation"); // WorkSpace Elements Element allocationID = ReportGenerator.doc.createElement("ID"); allocationID.appendChild(ReportGenerator.doc.createTextNode(String.valueOf(id))); allocationElement.appendChild(allocationID); Element allocatedTeam = ReportGenerator.doc.createElement("team-name"); allocatedTeam.appendChild(ReportGenerator.doc.createTextNode(team.toString())); allocationElement.appendChild(allocatedTeam); Element allocatedProject = ReportGenerator.doc.createElement("project-name"); allocatedProject.appendChild(ReportGenerator.doc.createTextNode(project.toString())); allocationElement.appendChild(allocatedProject); Element allocationStartDate = ReportGenerator.doc.createElement("allocation-start-date"); allocationStartDate.appendChild( ReportGenerator.doc.createTextNode(getStartDate().format(Global.dateFormatter))); allocationElement.appendChild(allocationStartDate); Element allocationEndDate = ReportGenerator.doc.createElement("allocation-end-date"); allocationEndDate.appendChild( ReportGenerator.doc.createTextNode(getEndDate().format(Global.dateFormatter))); allocationElement.appendChild(allocationEndDate); return allocationElement; }
/** Undoes the command */ public void undo() { team.getProjectAllocations().add(allocation); project.getTeamAllocations().add(allocation); }
/** Executes the command */ public void execute() { team.getProjectAllocations().remove(allocation); project.getTeamAllocations().remove(allocation); }