/** * Adds an Obs Group to the submission stack * * @param group the Obs Group to add * @throws InvalidActionException */ public void beginObsGroup(Obs group) throws InvalidActionException { // there needs to be a Person on the stack before this if (!stackContains(Person.class)) throw new InvalidActionException("No Person on the stack"); if (group.getObsId() == null && !obsToCreate.contains(group)) { obsToCreate.add(group); } Person person = highestOnStack(Person.class); Encounter encounter = highestOnStack(Encounter.class); group.setPerson(person); if (encounter != null) { addObsToEncounterIfNotAlreadyThere(encounter, group); } //this is for obs groups within obs groups Object o = stack.peek(); if (o instanceof Obs) { Obs oParent = (Obs) o; oParent.addGroupMember(group); } stack.push(group); }