private FieldSpec convertToFieldSpec(FormEntryPrompt questionPrompt) { QuestionDef question = questionPrompt.getQuestion(); final int dataType = questionPrompt.getDataType(); TreeReference reference = (TreeReference) question.getBind().getReference(); String tag = reference.getNameLast(); String questionLabel = questionPrompt.getQuestion().getLabelInnerText(); if (questionPrompt.isReadOnly()) return FieldSpec.createCustomField(tag, questionLabel, new FieldTypeMessage()); if (isNormalFieldType(dataType)) return FieldSpec.createCustomField(tag, questionLabel, new FieldTypeNormal()); if (dataType == Constants.DATATYPE_DATE) return FieldSpec.createCustomField(tag, questionLabel, new FieldTypeDate()); if (shouldTreatSingleItemChoiceListAsBooleanField(dataType, question)) return FieldSpec.createCustomField(tag, questionLabel, new FieldTypeBoolean()); if (dataType == Constants.DATATYPE_CHOICE) { Vector<ChoiceItem> convertedChoices = new Vector<ChoiceItem>(); List<SelectChoice> choicesToConvert = question.getChoices(); for (SelectChoice choiceToConvert : choicesToConvert) { // String choiceItemCode = choiceToConvert.getValue(); String choiceItemLabel = choiceToConvert.getLabelInnerText(); // Martus doesn't keep Code's when exporting so use Label twice instead convertedChoices.add(new ChoiceItem(choiceItemLabel, choiceItemLabel)); } FieldSpec fieldSpec = new CustomDropDownFieldSpec(convertedChoices); fieldSpec.setTag(tag); fieldSpec.setLabel(questionLabel); return fieldSpec; } MartusLogger.log( "Warning: BulletinFromXFormsLoader.convertToFieldSpec unknown Field Type:" + String.valueOf(dataType)); return null; }