/** Gets or creates a Concept with a given UUID and name. */ public static Concept getConcept(String name, String uuid, String typeUuid) { ConceptService conceptService = Context.getConceptService(); Concept concept = conceptService.getConceptByUuid(uuid); if (concept == null) { concept = new Concept(); concept.setUuid(uuid); concept.setShortName(new ConceptName(name, new Locale("en"))); concept.setDatatype(conceptService.getConceptDatatypeByUuid(typeUuid)); concept.setConceptClass(conceptService.getConceptClassByUuid(ConceptClass.MISC_UUID)); conceptService.saveConcept(concept); } return concept; }
/* * Loads a concept group from XML element */ private Group loadGroup(Element element) { Group group = new Group(); group.name = element.getAttributeValue("name"); List children = element.getChildren("concept"); for (Iterator it = children.iterator(); it.hasNext(); ) { Concept concept = new Concept(); Element e = (Element) it.next(); concept.id = (e.getAttributeValue("id")); concept.rubric = (e.getAttributeValue("rubric")); group.addConcept(concept); } return group; }