@Override public void setAsText(String text) throws IllegalArgumentException { log.debug("Setting text: " + text); if (StringUtils.hasText(text)) { try { setValue(Context.getConceptService().getConceptMapType(Integer.valueOf(text))); } catch (Exception ex) { ConceptMapType value = Context.getConceptService().getConceptMapTypeByUuid(text); setValue(value); if (value == null) { throw new IllegalArgumentException("ConceptMapType not found: " + text, ex); } } } else { setValue(null); } }
/** * @see ConceptService#getConceptMapTypeByUuid(String) */ @Test public void getConceptMapTypeByUuid_shouldReturnAConceptMapTypeMatchingTheSpecifiedUuid() { Assert.assertEquals("is-parent-to", Context.getConceptService().getConceptMapTypeByUuid( "0e7a8536-49d6-11e0-8fed-18a905e044dc").getName()); }
/** * Fetches a conceptMapType by uuid, if no match is found, it tries to look up one with a * matching name with the assumption that the passed parameter is a conceptMapType name * * @see DelegatingCrudResource#getByUniqueId(java.lang.String) */ @Override public ConceptMapType getByUniqueId(String uuid) { ConceptMapType conceptMapType = Context.getConceptService().getConceptMapTypeByUuid(uuid); //We assume the caller was fetching by name if (conceptMapType == null) conceptMapType = Context.getConceptService().getConceptMapTypeByName(uuid); return conceptMapType; }
String[] uuids = StringUtils.split(mapTypesUuids, ","); for (String uuid : uuids) { ConceptMapType mapType = conceptService.getConceptMapTypeByUuid(uuid.trim()); if (mapType == null) { throw new ObjectNotFoundException();
String[] uuids = StringUtils.split(mapTypesUuids, ","); for (String uuid : uuids) { ConceptMapType mapType = conceptService.getConceptMapTypeByUuid(uuid.trim()); if (mapType == null) { throw new ObjectNotFoundException();
@Override public ConceptMapType newObject() { return Context.getConceptService().getConceptMapTypeByUuid(getUuidProperty()); }
@Test public void shouldEditingAConceptMapType() throws Exception { final String newName = "updated name"; SimpleObject conceptMapTypeType = new SimpleObject(); conceptMapTypeType.add("name", newName); String json = new ObjectMapper().writeValueAsString(conceptMapTypeType); MockHttpServletRequest req = request(RequestMethod.POST, getURI() + "/" + getUuid()); req.setContent(json.getBytes()); handle(req); assertEquals(newName, service.getConceptMapTypeByUuid(getUuid()).getName()); }
@Test public void shouldRetireAConceptMapType() throws Exception { assertEquals(false, service.getConceptMapTypeByUuid(getUuid()).isRetired()); MockHttpServletRequest req = request(RequestMethod.DELETE, getURI() + "/" + getUuid()); req.addParameter("!purge", ""); final String reason = "none"; req.addParameter("reason", reason); handle(req); assertEquals(true, service.getConceptMapTypeByUuid(getUuid()).isRetired()); assertEquals(reason, service.getConceptMapTypeByUuid(getUuid()).getRetireReason()); }
@Test public void shouldGetAnConceptMapTypeByUuid() throws Exception { MockHttpServletRequest req = request(RequestMethod.GET, getURI() + "/" + getUuid()); SimpleObject result = deserialize(handle(req)); ConceptMapType conceptMapTypeType = service.getConceptMapTypeByUuid(getUuid()); assertEquals(conceptMapTypeType.getUuid(), PropertyUtils.getProperty(result, "uuid")); assertEquals(conceptMapTypeType.getName(), PropertyUtils.getProperty(result, "name")); assertEquals(conceptMapTypeType.isHidden(), PropertyUtils.getProperty(result, "isHidden")); assertEquals(conceptMapTypeType.getDescription(), PropertyUtils.getProperty(result, "description")); }
ConceptMapType conceptMapType = conceptService.getConceptMapTypeByUuid(maptype); if (conceptMapType == null) { conceptMapType = conceptService.getConceptMapTypeByName(maptype);
@Test public void shouldPurgeAConceptMapType() throws Exception { MockHttpServletRequest req = request(RequestMethod.DELETE, getURI() + "/" + getUuid()); req.addParameter("purge", "true"); handle(req); assertNull(service.getConceptMapTypeByUuid(getUuid())); }