| 41 | | /** |
|---|
| 42 | | * Convenience method to get a workflow by name. |
|---|
| 43 | | * @param name the workflow's name, in any locale |
|---|
| 44 | | * @return a workflow which has that name in any locale |
|---|
| | 57 | /** Constructor with id */ |
|---|
| | 58 | public Program(Integer programId) { |
|---|
| | 59 | setProgramId(programId); |
|---|
| | 60 | } |
|---|
| | 61 | |
|---|
| | 62 | // ****************** |
|---|
| | 63 | // Instance methods |
|---|
| | 64 | // ****************** |
|---|
| | 65 | |
|---|
| | 66 | /** |
|---|
| | 67 | * Adds a new {@link ProgramWorkflow} to this Program |
|---|
| | 68 | * @param workflow - the {@link ProgramWorkflow} to add |
|---|
| | 69 | */ |
|---|
| | 70 | public void addWorkflow(ProgramWorkflow workflow) { |
|---|
| | 71 | workflow.setProgram(this); |
|---|
| | 72 | getWorkflows().add(workflow); |
|---|
| | 73 | } |
|---|
| | 74 | |
|---|
| | 75 | /** |
|---|
| | 76 | * Removes a {@link ProgramWorkflow} from this Program |
|---|
| | 77 | * @param workflow - the {@link ProgramWorkflow} to remove |
|---|
| | 78 | */ |
|---|
| | 79 | public void removeWorkflow(ProgramWorkflow workflow) { |
|---|
| | 80 | if (getWorkflows().contains(workflow)) { |
|---|
| | 81 | getWorkflows().remove(workflow); |
|---|
| | 82 | workflow.setProgram(null); |
|---|
| | 83 | } |
|---|
| | 84 | } |
|---|
| | 85 | |
|---|
| | 86 | /** |
|---|
| | 87 | * Retires a {@link ProgramWorkflow} |
|---|
| | 88 | * @param workflow - the {@link ProgramWorkflow} to retire |
|---|
| | 89 | */ |
|---|
| | 90 | public void retireWorkflow(ProgramWorkflow workflow) { |
|---|
| | 91 | workflow.setRetired(true); |
|---|
| | 92 | } |
|---|
| | 93 | |
|---|
| | 94 | /** |
|---|
| | 95 | * Returns a {@link ProgramWorkflow} whose {@link Concept} has any {@link ConceptName} that matches the given <code>name</name> |
|---|
| | 96 | * @param name the {@link ProgramWorkflow} name, in any {@link Locale} |
|---|
| | 97 | * @return a {@link ProgramWorkflow} which has the passed <code>name</code> in any {@link Locale} |
|---|
| | 107 | |
|---|
| | 108 | /** @see Object#equals(Object) */ |
|---|
| | 109 | public boolean equals(Object obj) { |
|---|
| | 110 | if (obj != null && obj instanceof Program) { |
|---|
| | 111 | Program p = (Program)obj; |
|---|
| | 112 | if (this.getProgramId() == null) { |
|---|
| | 113 | return p.getProgramId() == null; |
|---|
| | 114 | } |
|---|
| | 115 | return (this.getProgramId().equals(p.getProgramId())); |
|---|
| | 116 | } |
|---|
| | 117 | return false; |
|---|
| | 118 | } |
|---|
| | 119 | |
|---|
| | 120 | /** @see Object#toString() */ |
|---|
| | 121 | public String toString() { |
|---|
| | 122 | return "Program(id=" + getProgramId() + ", concept=" + getConcept() + ", workflows=" + getWorkflows() + ")"; |
|---|
| | 123 | } |
|---|
| | 124 | |
|---|
| | 125 | // ****************** |
|---|
| | 126 | // Property Access |
|---|
| | 127 | // ****************** |
|---|
| | 128 | |
|---|
| | 129 | public String getName() { |
|---|
| | 130 | return name; |
|---|
| | 131 | } |
|---|
| | 132 | |
|---|
| | 133 | public void setName(String name) { |
|---|
| | 134 | this.name = name; |
|---|
| | 135 | } |
|---|
| | 136 | |
|---|
| | 137 | public String getDescription() { |
|---|
| | 138 | return description; |
|---|
| | 139 | } |
|---|
| | 140 | |
|---|
| | 141 | public void setDescription(String description) { |
|---|
| | 142 | this.description = description; |
|---|
| | 143 | } |
|---|
| 91 | | } |
|---|
| 92 | | |
|---|
| 93 | | public Date getDateVoided() { |
|---|
| 94 | | return dateVoided; |
|---|
| 95 | | } |
|---|
| 96 | | |
|---|
| 97 | | public void setDateVoided(Date dateVoided) { |
|---|
| 98 | | this.dateVoided = dateVoided; |
|---|
| 99 | | } |
|---|
| 100 | | |
|---|
| 101 | | public Boolean getVoided() { |
|---|
| 102 | | return isVoided(); |
|---|
| 103 | | } |
|---|
| 104 | | |
|---|
| 105 | | public Boolean isVoided() { |
|---|
| 106 | | return voided; |
|---|
| 107 | | } |
|---|
| 108 | | |
|---|
| 109 | | public void setVoided(Boolean voided) { |
|---|
| 110 | | this.voided = voided; |
|---|
| 111 | | } |
|---|
| 112 | | |
|---|
| 113 | | public User getVoidedBy() { |
|---|
| 114 | | return voidedBy; |
|---|
| 115 | | } |
|---|
| 116 | | |
|---|
| 117 | | public void setVoidedBy(User voidedBy) { |
|---|
| 118 | | this.voidedBy = voidedBy; |
|---|
| 119 | | } |
|---|
| 120 | | |
|---|
| 121 | | public String getVoidReason() { |
|---|
| 122 | | return voidReason; |
|---|
| 123 | | } |
|---|
| 124 | | |
|---|
| 125 | | public void setVoidReason(String voidReason) { |
|---|
| 126 | | this.voidReason = voidReason; |
|---|