/** * <p>This method calculates a weight used to decide the object's order in a collection.</p> * @param conceptMapType the ConceptMapType object the weight of which is to be calculated * @return * <ol> * <li>Regular: 0</li> * <li>Retired: 1</li> * <li>Hidden: 2</li> * <li>Retired and Hidden: 3</li> * </ol> */ public static int getConceptMapTypeSortWeight(ConceptMapType conceptMapType) { return ((conceptMapType.getRetired() ? 1 : 0) + (conceptMapType.getIsHidden() ? 2 : 0)); } }
/** * @see ConceptService#retireConceptMapType(ConceptMapType,String) */ @Test public void retireConceptMapType_shouldRetireTheSpecifiedConceptMapTypeWithTheGivenRetireReason() { ConceptMapType mapType = Context.getConceptService().getConceptMapType(1); Assert.assertFalse(mapType.getRetired()); Assert.assertNull(mapType.getRetiredBy()); Assert.assertNull(mapType.getDateRetired()); Assert.assertNull(mapType.getRetireReason()); ConceptMapType retiredMapType = Context.getConceptService().retireConceptMapType(mapType, "test retire reason"); Assert.assertTrue(retiredMapType.getRetired()); Assert.assertEquals(retiredMapType.getRetireReason(), "test retire reason"); Assert.assertNotNull(retiredMapType.getRetiredBy()); Assert.assertNotNull(retiredMapType.getDateRetired()); }
/** * @see ConceptService#unretireConceptMapType(ConceptMapType) */ @Test public void unretireConceptMapType_shouldUnretireTheSpecifiedConceptMapTypeAndDropAllRetireRelatedFields() { ConceptMapType mapType = Context.getConceptService().getConceptMapType(6); Assert.assertTrue(mapType.getRetired()); Assert.assertNotNull(mapType.getRetiredBy()); Assert.assertNotNull(mapType.getDateRetired()); Assert.assertNotNull(mapType.getRetireReason()); ConceptMapType unRetiredMapType = Context.getConceptService().unretireConceptMapType(mapType); Assert.assertFalse(unRetiredMapType.getRetired()); Assert.assertNull(unRetiredMapType.getRetireReason()); Assert.assertNull(unRetiredMapType.getRetiredBy()); Assert.assertNull(unRetiredMapType.getDateRetired()); }