private NonUniqueTaxonomyMapVoCollection getMappingsNoWarnings() { NonUniqueTaxonomyMapVoCollection voTaxonomyMapCollection = new NonUniqueTaxonomyMapVoCollection(); for (int i = 0; i < form.grdMappings().getRows().size(); i++) { ims.admin.forms.nonuniquetaxonomymappings.GenForm.grdMappingsRow row = form.grdMappings().getRows().get(i); NonUniqueTaxonomyMapVo voTaxonomyMap = row.getValue() != null ? row.getValue() : new NonUniqueTaxonomyMapVo(); voTaxonomyMap.setTaxonomyCode(row.getcolCode()); voTaxonomyMap.setTaxonomyName((TaxonomyType) row.getcolExtCodeType()); if (row.getcolCode() != null || row.getcolExtCodeType() != null) voTaxonomyMapCollection.add(voTaxonomyMap); } return voTaxonomyMapCollection; }
private void populateTaxonomyMappings(NonUniqueTaxonomyMapVoCollection coll) { clear(); if (coll != null) { ims.admin.forms.nonuniquetaxonomymappings.GenForm.grdMappingsRow row = null; for (int i=0; i < coll.size(); i++) { row = form.grdMappings().getRows().newRow(); row.setcolExtCodeType(coll.get(i).getTaxonomyName()); row.setcolCode(coll.get(i).getTaxonomyCode()); row.setValue(coll.get(i)); row.setReadOnly(true); } } }
private NonUniqueTaxonomyMapVoCollection getMappingsNoWarnings() { NonUniqueTaxonomyMapVoCollection voTaxonomyMapCollection = new NonUniqueTaxonomyMapVoCollection(); for (int i = 0; i < form.grdMappings().getRows().size(); i++) { ims.admin.forms.nonuniquetaxonomymappings.GenForm.grdMappingsRow row = form.grdMappings().getRows().get(i); NonUniqueTaxonomyMapVo voTaxonomyMap = row.getValue() != null ? row.getValue() : new NonUniqueTaxonomyMapVo(); voTaxonomyMap.setTaxonomyCode(row.getcolCode()); voTaxonomyMap.setTaxonomyName((TaxonomyType) row.getcolExtCodeType()); if (row.getcolCode() != null || row.getcolExtCodeType() != null) { if(taxonomyIsNotAdded(voTaxonomyMapCollection, voTaxonomyMap)) { voTaxonomyMapCollection.add(voTaxonomyMap); } } } return voTaxonomyMapCollection; }
private boolean taxonomyIsNotAdded(NonUniqueTaxonomyMapVoCollection coll, NonUniqueTaxonomyMapVo record) { if(coll == null) return false; if(record == null) return false; for(NonUniqueTaxonomyMapVo item : coll) { if(item == null) continue; if(item.getTaxonomyName().equals(record.getTaxonomyName()) && item.getTaxonomyCode().equals(record.getTaxonomyCode())) return false; } return true; }
private void populateDataFromAnswerOptions(QuestionAnswerTypeVo voQAnswerType) { AnswerOptionVoCollection voColl = new AnswerOptionVoCollection(); for (int i = 0; i < form.grdAnswerOption().getRows().size(); i++) { grdAnswerOptionRow row = form.grdAnswerOption().getRows().get(i); AnswerOptionVo voAnswerOption = row.getValue() != null ? row.getValue() : new AnswerOptionVo(); voAnswerOption.setOptionText(row.getcolOptionText()); voAnswerOption.setOptionDescription(row.getcolOptionDesc()); voAnswerOption.setScore(row.getcolScore()); Object objCol = row.getcolColour(); if (objCol instanceof Color) voAnswerOption.setColour((Color) objCol); else voAnswerOption.setColour(null); NonUniqueTaxonomyMapVoCollection voTaxonomyColl = new NonUniqueTaxonomyMapVoCollection(); NonUniqueTaxonomyMapVo voTaxonomyMap = new NonUniqueTaxonomyMapVo(); if (row.getcolExtCodeType()==null&&(row.getcolCode()==null||row.getcolCode().equals(""))) voAnswerOption.setTaxonomyMappings(null); else { voTaxonomyMap.setTaxonomyName(row.getcolExtCodeType()); voTaxonomyMap.setTaxonomyCode(row.getcolCode()); voTaxonomyColl.add(voTaxonomyMap); voAnswerOption.setTaxonomyMappings(voTaxonomyColl); } voColl.add(voAnswerOption); } voQAnswerType.setOptions(voColl); }
/** * @param newRow * @param voAnswerOption */ private void setColTaxonomy(GenForm.grdAnswerOptionRow newRow, NonUniqueTaxonomyMapVo voTaxonomyMap) { if (newRow != null && voTaxonomyMap != null) { newRow.setcolExtCodeType(voTaxonomyMap.getTaxonomyName()); newRow.setcolCode(voTaxonomyMap.getTaxonomyCode()); AnswerOptionVo voAnswerOption = newRow.getValue() != null ? newRow.getValue() : new AnswerOptionVo(); NonUniqueTaxonomyMapVoCollection voTaxonomyColl = new NonUniqueTaxonomyMapVoCollection(); voTaxonomyColl.add(voTaxonomyMap); voAnswerOption.setTaxonomyMappings(voTaxonomyColl); newRow.setValue(voAnswerOption); } }
private NonUniqueTaxonomyMapVoCollection getMappings() { NonUniqueTaxonomyMapVoCollection voTaxonomyMapCollection = new NonUniqueTaxonomyMapVoCollection(); for (int i = 0; i < form.grdMappings().getRows().size(); i++) { ims.admin.forms.nonuniquetaxonomymappings.GenForm.grdMappingsRow row = form.grdMappings().getRows().get(i); NonUniqueTaxonomyMapVo voTaxonomyMap = row.getValue() != null ? row.getValue() : new NonUniqueTaxonomyMapVo(); voTaxonomyMap.setTaxonomyCode(row.getcolCode()); voTaxonomyMap.setTaxonomyName((TaxonomyType) row.getcolExtCodeType()); if (row.getcolCode() != null && row.getcolExtCodeType() != null) voTaxonomyMapCollection.add(voTaxonomyMap); else { StringBuffer sb = new StringBuffer(); sb.append("The taxonomy mapping of Type "); sb.append(row.getcolExtCodeType() != null ? "'" + ((TaxonomyType) row.getcolExtCodeType()).getText()+ "'" : "???"); sb.append(" and Value of "); sb.append(row.getcolCode() != null ? "'" + row.getcolCode().toString()+ "'" : "???"); sb.append(" will not be held for saving due to missing data."); engine.showMessage(sb.toString(),"Missing data", MessageButtons.OK, MessageIcon.WARNING); } } return voTaxonomyMapCollection; }
private NonUniqueTaxonomyMapVoCollection getMappings() { NonUniqueTaxonomyMapVoCollection voTaxonomyMapCollection = new NonUniqueTaxonomyMapVoCollection(); for (int i = 0; i < form.grdMappings().getRows().size(); i++) { ims.admin.forms.nonuniquetaxonomymappings.GenForm.grdMappingsRow row = form.grdMappings().getRows().get(i); NonUniqueTaxonomyMapVo voTaxonomyMap = row.getValue() != null ? row.getValue() : new NonUniqueTaxonomyMapVo(); voTaxonomyMap.setTaxonomyCode(row.getcolCode()); voTaxonomyMap.setTaxonomyName((TaxonomyType) row.getcolExtCodeType()); if (row.getcolCode() != null && row.getcolExtCodeType() != null) { if(voTaxonomyMapCollection.indexOf(voTaxonomyMap) < 0) { voTaxonomyMapCollection.add(voTaxonomyMap); } } else { StringBuffer sb = new StringBuffer(); sb.append("The taxonomy mapping of Type "); sb.append(row.getcolExtCodeType() != null ? "'" + ((TaxonomyType) row.getcolExtCodeType()).getText()+ "'" : "???"); sb.append(" and Value of "); sb.append(row.getcolCode() != null ? "'" + row.getcolCode().toString()+ "'" : "???"); sb.append(" will not be held for saving due to missing data."); engine.showMessage(sb.toString(),"Missing data", MessageButtons.OK, MessageIcon.WARNING); } } return voTaxonomyMapCollection; }
public void setValue(NonUniqueTaxonomyMapVoCollection coll) { form.getLocalContext().setSetComponentValue(coll); initialize(); }
public NonUniqueTaxonomyMapVoCollection getValue() { return getMappings(); }
public NonUniqueTaxonomyMapVoCollection getValueNoWarnings() { return getMappingsNoWarnings(); }