public AllergenTypeReactionsCollection listAllergenTypeReactions(ims.core.vo.lookups.AllergenType allergenType) { DomainFactory factory = getDomainFactory(); String whereAnd = " where "; StringBuffer hql = new StringBuffer("from AllergenTypeReaction r "); if (allergenType != null) { hql.append(" where r.allergenType = :allergenType"); whereAnd = " and "; } hql.append(whereAnd + " r.isActive = :isActive"); java.util.List reactions = factory.find(hql.toString(), new String[]{"isActive","allergenType"}, new Object[]{Boolean.TRUE, getDomLookup(allergenType)}); return (AllergenTypeReactionsAssembler.createAllergenTypeReactionsCollectionFromAllergenTypeReaction(reactions)).sort(); }
private void populateAllergyReactionCmb() { form.ctnAllergy().cmbAllergyReaction().clear(); if (form.ctnAllergy().cmbAllergyType().getValue() == null) return; AllergenTypeReactionsCollection voColl = domain.listAllergenTypeReactions(form.ctnAllergy().cmbAllergyType().getValue()); if (voColl == null) return; for (int i=0; i<voColl.size(); i++) { if (voColl.get(i).getIsActive().booleanValue() == true) form.ctnAllergy().cmbAllergyReaction().newRow(voColl.get(i).getReaction(), voColl.get(i).getReaction().getText()); } }
private void fillReactionCombo() { form.ctnAllergy().cmbAllergyReaction().clear(); AllergenType type = form.ctnAllergy().cmbAllergyType().getValue(); if(type != null) { AllergenTypeReactionsCollection reactionsColl = domain.listAllergenTypeReactions(type); if(reactionsColl != null) { for (int i = 0; i < reactionsColl.size(); i++) { if(reactionsColl.get(i).getReaction()!= null) form.ctnAllergy().cmbAllergyReaction().newRow(reactionsColl.get(i).getReaction(), reactionsColl.get(i).getReaction().toString()); } if (reactionsColl.size() == 1) form.ctnAllergy().cmbAllergyReaction().setValue(reactionsColl.get(0).getReaction()); } } form.ctnAllergy().cmbAllergyReaction().getValues(); }
private void populateReactionCmb() { form.ctnDetails().cmbReaction().clear(); if (form.ctnDetails().cmbType().getValue() == null) return; AllergenTypeReactionsCollection voColl = domain.listAllergenTypeReactions(form.ctnDetails().cmbType().getValue()); if (voColl == null) return; for (int i=0; i<voColl.size(); i++) { if (voColl.get(i).getIsActive().booleanValue() == true) form.ctnDetails().cmbReaction().newRow(voColl.get(i).getReaction(), voColl.get(i).getReaction().getText()); } }
private void fillReactionCombo() { form.ctnDetails().cmbReaction().clear(); AllergenType type = form.ctnDetails().cmbType().getValue(); if(type != null) { AllergenTypeReactionsCollection reactionsColl = domain.listAllergenTypeReactions(type); if(reactionsColl != null) { for (int i = 0; i < reactionsColl.size(); i++) { if(reactionsColl.get(i).getReaction()!= null) form.ctnDetails().cmbReaction().newRow(reactionsColl.get(i).getReaction(), reactionsColl.get(i).getReaction().toString()); } if (reactionsColl.size() == 1) form.ctnDetails().cmbReaction().setValue(reactionsColl.get(0).getReaction()); } } form.ctnDetails().cmbReaction().getValues(); }
private void listAllergenReactions(AllergenType allergenType) { AllergenTypeReactionsCollection voCollAllergenTypeReactions = domain.listAllergenTypeReactions(allergenType); if (voCollAllergenTypeReactions == null) return; for (int i = 0; i < voCollAllergenTypeReactions.size(); i++) { AllergenTypeReactions reaction = voCollAllergenTypeReactions.get(i); GenForm.grdAllergenReactionsRow row = form.grdAllergenReactions().getRowByValue(reaction.getReaction()); if (row != null) row.setcolSelected(true); } }
public AllergenTypeReactionsCollection saveAllergenTypeReaction(ims.core.vo.lookups.AllergenType allergenType, AllergenTypeReactionsCollection allergenTypeReactions) throws ForeignKeyViolationException, StaleObjectException { if (!allergenTypeReactions.isValidated()) { throw new DomainRuntimeException("Allergen Type Reaction Collection has not been validated"); } //Quicker and easier to delete all existing reactions for a type, and re-insert them. //Will ensure the uniqueness of AllergenType + Reaction is maintained DomainFactory factory = getDomainFactory(); String hql1 = " from AllergenTypeReaction r " + " where r.allergenType.id = " + allergenType.getId(); factory.delete(hql1); for (int i = 0; i < allergenTypeReactions.size(); i++) { AllergenTypeReactions reaction = allergenTypeReactions.get(i); if (!reaction.getAllergenType().equals(allergenType)) { throw new DomainRuntimeException("All reactions in an AllergenTypeReaction Collection must be for the same Allergen Type "); } reaction.setID_AllergenTypeReaction(null); AllergenTypeReaction domAllergenTypeReaction = AllergenTypeReactionsAssembler.extractAllergenTypeReaction(factory, reaction); factory.save(domAllergenTypeReaction); reaction.setID_AllergenTypeReaction(domAllergenTypeReaction.getId()); } return allergenTypeReactions; }
protected void onBtnSaveClick() throws ims.framework.exceptions.PresentationLogicException { AllergenTypeReactionsCollection voCollAllergenTypeReactions = new AllergenTypeReactionsCollection(); for (int i = 0; i < form.grdAllergenReactions().getRows().size(); i++) { GenForm.grdAllergenReactionsRow row = form.grdAllergenReactions().getRows().get(i); if (row.getcolSelected()) { AllergenTypeReactions reaction = new AllergenTypeReactions(); reaction.setAllergenType(form.grdAllergenType().getValue()); reaction.setReaction(row.getValue()); reaction.setIsActive(Boolean.TRUE); voCollAllergenTypeReactions.add(reaction); } } String[] arrErrors = voCollAllergenTypeReactions.validate(); if (arrErrors != null) { engine.showErrors("Validation Errors", arrErrors); return; } try { domain.saveAllergenTypeReaction(form.grdAllergenType().getValue(), voCollAllergenTypeReactions); } catch (StaleObjectException e) { engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); return; } catch (ForeignKeyViolationException e1) { engine.showMessage("There are data items in the system referencing this item - delete access denied"); open(); return; } open(); }
public AllergenTypeReactionsCollection listAllergenTypeReactions(ims.core.vo.lookups.AllergenType voAllergenType) { AllergenReactions allergenReactionsImpl = (AllergenReactions)getDomainImpl(AllergenReactionsImpl.class); return allergenReactionsImpl.listAllergenTypeReactions(voAllergenType).sort(); }