private void populateInstanceControlsFromData(ManchesterTriageProtocolConfigVo selectedTriageProtocol) { if (selectedTriageProtocol == null) { return; } clearInstanceControls(); form.txtProtocolName().setValue(selectedTriageProtocol.getProtocolName()); form.txtDescription().setValue(selectedTriageProtocol.getProtocolDescription()); form.qmbProblem().newRow(selectedTriageProtocol.getProblem(), selectedTriageProtocol.getProblem().getPCName()); form.qmbProblem().setValue(selectedTriageProtocol.getProblem()); form.cmbPriority().setValue(selectedTriageProtocol.getDefaultPriority()); removePreactiveOrActiveLookup(); form.cmbStatus().setValue(selectedTriageProtocol.getActiveStatus()); form.ccMappings().setValue(selectedTriageProtocol.getTaxonomyMap()); populateDiscriminatorsGrid(form.getLocalContext().getSelectedTriageProtocol().getDiscriminators()); }
public ManchesterTriageProtocolConfigVo getTriageProtocol(ManchesterTriageProtocolConfigLiteVo selectedTriageProtocol) { if (selectedTriageProtocol == null || selectedTriageProtocol.getID_ManchesterTriageProtocolConfiguration() == null) { throw new CodingRuntimeException("Cannot get ManchesterTriageProtocolConfigVo on null Id "); } DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); hql.append(" select protocol from ManchesterTriageProtocolConfiguration as protocol where protocol.id = :protocolID"); List<?> list = factory.find(hql.toString(), new String[] { "protocolID" }, new Object[] { selectedTriageProtocol.getID_ManchesterTriageProtocolConfiguration() }); if (list != null && list.size() > 0) return ManchesterTriageProtocolConfigVoAssembler.createManchesterTriageProtocolConfigVoCollectionFromManchesterTriageProtocolConfiguration(list).get(0); return null; }
@Override protected void onGrdProtocolSelectionChanged() { ManchesterTriageProtocolConfigVo selectedTriageProtocol = domain.getTriageProtocol(form.grdProtocol().getValue()); form.getLocalContext().setSelectedTriageProtocol(selectedTriageProtocol); populateInstanceControlsFromData(selectedTriageProtocol); updateControlsState(); }
private boolean isStatusActive() { ManchesterTriageProtocolConfigVo voTriageProtocol = form.getLocalContext().getSelectedTriageProtocol(); return voTriageProtocol != null && voTriageProtocol.getActiveStatusIsNotNull() && voTriageProtocol.getActiveStatus().equals(PreActiveActiveInactiveStatus.ACTIVE); }
private boolean isStatusInactive() { ManchesterTriageProtocolConfigVo voTriageProtocol = form.getLocalContext().getSelectedTriageProtocol(); return voTriageProtocol != null && voTriageProtocol.getActiveStatusIsNotNull() && voTriageProtocol.getActiveStatus().equals(PreActiveActiveInactiveStatus.INACTIVE); }
public ManchesterTriageProtocolConfigVo saveTriage(ManchesterTriageProtocolConfigVo triageProtocol) throws StaleObjectException, UniqueKeyViolationException { if (triageProtocol == null) throw new CodingRuntimeException("Cannot save null TriageProtocol"); if (!triageProtocol.isValidated()) throw new DomainRuntimeException("triageProtocolVo Not Validated."); DomainFactory factory = getDomainFactory(); triageProtocol.setProtocolName(triageProtocol.getProtocolName().trim()); ManchesterTriageProtocolConfigVo savedProtocol = null; ManchesterTriageProtocolConfiguration domProtocol = ManchesterTriageProtocolConfigVoAssembler.extractManchesterTriageProtocolConfiguration(factory, triageProtocol); if (triageProtocol.getTaxonomyMapIsNotNull()) { boolean found = false; StringBuilder errors = new StringBuilder(); for (int i = 0; i < triageProtocol.getTaxonomyMap().size(); i++) { TaxonomyMap code = triageProtocol.getTaxonomyMap().get(i); ManchesterTriageProtocolConfiguration triageRole = getDiscriminatorRoleByTaxonomy(code.getTaxonomyCode(), code.getTaxonomyName()); if (triageRole != null && !triageRole.getId().equals(triageProtocol.getID_ManchesterTriageProtocolConfiguration())) { found = true; errors.append("\nProtocol '" + triageRole.getProtocolName() + "' already has mapped :"); errors.append(" External Code Type '" + code.getTaxonomyName() + "' and code '" + code.getTaxonomyCode() + "'"); } } if (found) throw new UniqueKeyViolationException(errors.toString()); } factory.save(domProtocol); savedProtocol = ManchesterTriageProtocolConfigVoAssembler.create(domProtocol); return savedProtocol; }