Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed Retireable from DrugReferenceMap.
Renamed the column drug_reference_map.map_type to drug_reference_map.concept_map_type. Added equals() and toString() methods to api/src/main/java/org/openmrs/DrugReferenceMap.java. Added DrugTest.java class. Removed toString(), equals() and hashCode() methods fromDrugReferenceMap. Improved tests for the Drug class.
- Loading branch information
1 parent
d27777b
commit 4854047
Showing
4 changed files
with
81 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,6 @@ | |
*/ | ||
package org.openmrs; | ||
|
||
import org.simpleframework.xml.Attribute; | ||
|
||
import java.io.Serializable; | ||
import java.util.Date; | ||
|
||
|
@@ -23,7 +21,7 @@ | |
* | ||
* @since 1.10 | ||
*/ | ||
public class DrugReferenceMap extends BaseOpenmrsObject implements Auditable, Retireable, Serializable { | ||
public class DrugReferenceMap extends BaseOpenmrsObject implements Auditable, Serializable { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
wluyima
Member
|
||
|
||
public static final long serialVersionUID = 1L; | ||
|
||
|
@@ -39,17 +37,18 @@ public class DrugReferenceMap extends BaseOpenmrsObject implements Auditable, Re | |
|
||
private Date dateCreated; | ||
|
||
private Boolean retired = false; | ||
|
||
private User retiredBy; | ||
|
||
private Date dateRetired; | ||
|
||
private User changedBy; | ||
|
||
private Date dateChanged; | ||
|
||
private String retireReason; | ||
/** default constructor */ | ||
public DrugReferenceMap() { | ||
} | ||
|
||
/** constructor with concept reference term map id */ | ||
public DrugReferenceMap(Integer drugReferenceMapId) { | ||
this.drugReferenceMapId = drugReferenceMapId; | ||
} | ||
|
||
/** | ||
* @return Returns the drugReferenceMapId. | ||
|
@@ -186,81 +185,4 @@ public Date getDateChanged() { | |
public void setDateChanged(Date dateChanged) { | ||
this.dateChanged = dateChanged; | ||
} | ||
|
||
/** | ||
* @return Boolean - whether of not this object is retired | ||
*/ | ||
@Override | ||
public Boolean isRetired() { | ||
This comment has been minimized.
Sorry, something went wrong.
rkorytkowski
Member
|
||
return this.retired; | ||
} | ||
|
||
/** | ||
* This method exists to satisfy spring and hibernates slightly bung use of Boolean object | ||
* getters and setters. | ||
* | ||
* @see org.openmrs.Concept#isRetired() | ||
* @deprecated Use the "proper" isRetired method. | ||
*/ | ||
@Deprecated | ||
@Attribute | ||
public Boolean getRetired() { | ||
return isRetired(); | ||
} | ||
|
||
/** | ||
* @param retired - whether of not this object is retired | ||
*/ | ||
@Override | ||
public void setRetired(Boolean retired) { | ||
this.retired = retired; | ||
} | ||
|
||
/** | ||
* @return User - the user who retired the object | ||
*/ | ||
@Override | ||
public User getRetiredBy() { | ||
return this.retiredBy; | ||
} | ||
|
||
/** | ||
* @param retiredBy - the user who retired the object | ||
*/ | ||
@Override | ||
public void setRetiredBy(User retiredBy) { | ||
this.retiredBy = retiredBy; | ||
} | ||
|
||
/** | ||
* @return Date - the date the object was retired | ||
*/ | ||
@Override | ||
public Date getDateRetired() { | ||
return dateRetired; | ||
} | ||
|
||
/** | ||
* @param dateRetired - the date the object was retired | ||
*/ | ||
@Override | ||
public void setDateRetired(Date dateRetired) { | ||
this.dateRetired = dateRetired; | ||
} | ||
|
||
/** | ||
* @return String - the reason the object was retired | ||
*/ | ||
@Override | ||
public String getRetireReason() { | ||
return this.retireReason; | ||
} | ||
|
||
/** | ||
* @param retireReason - the reason the object was retired | ||
*/ | ||
@Override | ||
public void setRetireReason(String retireReason) { | ||
this.retireReason = retireReason; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/** | ||
* The contents of this file are subject to the OpenMRS Public License | ||
* Version 1.0 (the "License"); you may not use this file except in | ||
* compliance with the License. You may obtain a copy of the License at | ||
* http://license.openmrs.org | ||
* | ||
* Software distributed under the License is distributed on an "AS IS" | ||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing rights and limitations | ||
* under the License. | ||
* | ||
* Copyright (C) OpenMRS, LLC. All Rights Reserved. | ||
*/ | ||
package org.openmrs; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Contains test methods for {@link org.openmrs.Drug}. | ||
*/ | ||
public class DrugTest { | ||
|
||
private final static String UUID_1 = "333cd82c-7d3d-11e3-8633-13f177b345d8"; | ||
|
||
private final static String UUID_2 = "4eef1530-7d3d-11e3-ac6d-e388e198a21e"; | ||
|
||
/** | ||
* @verifies set drug as the drug to which a mapping is being added | ||
* @see Drug#addDrugReferenceMap(DrugReferenceMap) | ||
*/ | ||
@Test | ||
public void addDrugReferenceMap_shouldSetDrugAsTheDrugToWhichAMappingIsBeingAdded() throws Exception { | ||
Drug drug1 = new Drug(); | ||
drug1.setUuid(UUID_1); | ||
Drug drug2 = new Drug(); | ||
drug2.setUuid(UUID_2); | ||
|
||
DrugReferenceMap map = new DrugReferenceMap(1); | ||
map.setDrug(drug2); | ||
drug1.addDrugReferenceMap(map); | ||
Assert.assertEquals(drug1, drug1.getDrugReferenceMaps().iterator().next().getDrug()); | ||
} | ||
|
||
/** | ||
* @verifies should not add duplicate drug reference maps | ||
* @see Drug#addDrugReferenceMap(DrugReferenceMap) | ||
*/ | ||
@Test | ||
public void addDrugReferenceMap_shouldShouldNotAddDuplicateDrugReferenceMaps() throws Exception { | ||
Drug drug = new Drug(); | ||
|
||
DrugReferenceMap map1 = new DrugReferenceMap(); | ||
map1.setUuid(UUID_1); | ||
DrugReferenceMap map2 = new DrugReferenceMap(); | ||
map2.setUuid(UUID_2); | ||
DrugReferenceMap map2Duplicate = new DrugReferenceMap(); | ||
map2Duplicate.setUuid(UUID_2); | ||
|
||
drug.addDrugReferenceMap(map1); | ||
drug.addDrugReferenceMap(map2); | ||
drug.addDrugReferenceMap(map2Duplicate); | ||
|
||
Assert.assertEquals(2, drug.getDrugReferenceMaps().size()); | ||
} | ||
} |
Shouldn't this be BaseOpenmrsData?