/** * This will return a list of Pair objects, with each pair consiting of the <code>displayName * </code> of the field and its associated <code>value</code>. * * @param fieldGroup - An InputFieldGroup * @param command - The BeanWrapper instance wrapping {@link ReportDefinitionCommand} * @param exclusions - A list of <code>displayName</code> to be eliminated from the display. * @return List<Pair> objects. */ public List<Pair> fetchFieldValues( InputFieldGroup fieldGroup, BeanWrapper command, String... exclusions) { List<Pair> fieldList = new ArrayList<Pair>(); if (fieldGroup == null) return fieldList; for (InputField field : fieldGroup.getFields()) { if (exclusions != null && ArrayUtils.contains(exclusions, field.getDisplayName())) continue; fieldList.add(fetchFieldValue(field, command)); } return fieldList; }
@Override public InputFieldGroupMap createFieldGroups(SubmitExpeditedAdverseEventCommand command) { InputFieldGroupMap map = new InputFieldGroupMap(); InputFieldGroup ccReport = new DefaultInputFieldGroup("ccReport"); InputField cc = InputFieldFactory.createTextArea("report.lastVersion.ccEmails", "Cc"); InputFieldAttributes.setColumns(cc, 50); ccReport.getFields().add(cc); map.addInputFieldGroup(ccReport); return map; }
@Override public Map<String, InputFieldGroup> createFieldGroups(final T command) { InputFieldGroup participantFieldGroup; Map<Object, Object> options = null; participantFieldGroup = new DefaultInputFieldGroup(PARTICIPANT_FIELD_GROUP); FieldValidator fv = FieldValidator.ALPHANUMERIC_VALIDATOR; if (!command.isUnidentifiedMode()) { participantFieldGroup .getFields() .add( InputFieldFactory.createTextField( "participant.firstName", "First Name", FieldValidator.NOT_NULL_VALIDATOR, fv)); participantFieldGroup .getFields() .add( InputFieldFactory.createTextField( "participant.lastName", "Last Name", FieldValidator.NOT_NULL_VALIDATOR, fv)); participantFieldGroup .getFields() .add(InputFieldFactory.createTextField("participant.maidenName", "Maiden Name", fv)); participantFieldGroup .getFields() .add(InputFieldFactory.createTextField("participant.middleName", "Middle Name", fv)); } InputField dobYear = InputFieldFactory.createTextField("yearString", "Year", true); InputFieldAttributes.setSize(dobYear, 4); InputField dobMonth = InputFieldFactory.createTextField("monthString", "Month", true); InputFieldAttributes.setSize(dobMonth, 2); InputField dobDay = InputFieldFactory.createTextField("dayString", "Day"); InputFieldAttributes.setSize(dobDay, 2); CompositeField dobField; if (command.isUnidentifiedMode()) dobField = new CompositeField( "participant.dateOfBirth", new DefaultInputFieldGroup(null, "Date of birth") .addField(dobYear) .addField(dobMonth)); else dobField = new CompositeField( "participant.dateOfBirth", new DefaultInputFieldGroup(null, "Date of birth") .addField(dobYear) .addField(dobMonth) .addField(dobDay)); dobField.setRequired(true); dobField .getAttributes() .put(InputField.HELP, "par.par_create_participant.participant.dateOfBirth"); participantFieldGroup.getFields().add(dobField); participantFieldGroup .getFields() .add( InputFieldFactory.createSelectField( "participant.gender", "Gender", true, collectOptions(listValues.getParticipantGender()))); participantFieldGroup .getFields() .add( InputFieldFactory.createSelectField( "participant.ethnicity", "Ethnicity", true, collectOptions(listValues.getParticipantEthnicity()))); participantFieldGroup .getFields() .add( InputFieldFactory.createSelectField( "participant.race", "Race", true, collectOptions(listValues.getParticipantRace()))); /* repeatingFieldGroupFactory = new RepeatingFieldGroupFactory("main", "participant.identifiers"); repeatingFieldGroupFactory.addField(InputFieldFactory.createTextField("value", "Identifier", true)); */ options = new LinkedHashMap<Object, Object>(); List<Lov> list = configurationProperty.getMap().get("participantIdentifiersType"); options.put("", "Please select"); options.putAll(WebUtils.collectOptions(list, "code", "desc")); InputFieldGroupMap map = new InputFieldGroupMap(); if (!command.isUnidentifiedMode()) { byte i = 0; byte j = 0; InputFieldGroup idtFieldGroupOrg; InputFieldGroup idtFieldGroupSys; for (Identifier idt : command.participant.getIdentifiers()) { if (idt instanceof SystemAssignedIdentifier) { String s = "participant.systemAssignedIdentifiers[" + i + "]."; idtFieldGroupSys = new DefaultInputFieldGroup("mainSys" + i); idtFieldGroupSys .getFields() .add( InputFieldFactory.createTextField( s + "value", "Identifier", FieldValidator.NOT_NULL_VALIDATOR, FieldValidator.IDENTIFIER_VALIDATOR)); idtFieldGroupSys .getFields() .add( InputFieldFactory.createSelectField( s + "type", "Identifier Type", true, options)); idtFieldGroupSys .getFields() .add(InputFieldFactory.createTextField(s + "systemName", "System Name", true)); map.addInputFieldGroup(idtFieldGroupSys); i++; } else { String s = "participant.organizationIdentifiers[" + j + "]."; idtFieldGroupOrg = new DefaultInputFieldGroup("mainOrg" + j); idtFieldGroupOrg .getFields() .add( InputFieldFactory.createTextField( s + "value", "Identifier", FieldValidator.NOT_NULL_VALIDATOR, FieldValidator.IDENTIFIER_VALIDATOR)); idtFieldGroupOrg .getFields() .add( InputFieldFactory.createSelectField( s + "type", "Identifier Type", true, options)); idtFieldGroupOrg .getFields() .add( InputFieldFactory.createAutocompleterField( s + "organization", "Organization", true)); map.addInputFieldGroup(idtFieldGroupOrg); j++; } } } map.addInputFieldGroup(participantFieldGroup); return map; }