Code development platform for open source projects from the European Union institutions

Remove hardcoded content from showAs

SUMMARY

Remove hardcoded content from showAs in the collection body and read it from long title.

Already fixed in development so please check the fix and apply to version 5.2.4.2.

Currently in production (5.2.4.1):

XmlNodeConfigProcessor.java:

//A better way to set showAs as it might be dependent of lang and docType.




switch (leosCategory) {
    case BILL:
        showAs = "Regulation of the European Parliament and of the Council";
        refersToList.addAll(Arrays.asList("~DEC", "~REG", "~DIR"));
        break;
    case MEMORANDUM:
        showAs = "Explanatory Memorandum";
        refersToList.add("~EXPL_MEMORANDUM");
        break;
    case COUNCIL_EXPLANATORY:
        showAs = "Council Explanatory";
        break;
    case STAT_DIGIT_FINANC_LEGIS:
        showAs = "Legislative Financial Statement";
        refersToList.add("~STAT_DIGIT_FINANC_LEGIS");
        break;
    default:
        throw new IllegalArgumentException("Invalid configuration");
}

In development (fix):

public SpecificDocumentInformationDTO getSpecificDocumentInformation(byte xmlContent[]) {
    Document document = createXercesDocument(xmlContent);
    // We really should have this information on xml, if not, there is something wrong in template
    NodeList nodeListForResfersTo = XercesUtils.getElementsByXPath(document, ".//akn:longTitle//*[@refersTo]");
    String refersToOfDocument = nodeListForResfersTo.item(0).getAttributes().getNamedItem("refersTo").getTextContent();
    String showAs = nodeListForResfersTo.item(0).getTextContent();
    return new SpecificDocumentInformationDTO(refersToOfDocument, showAs);
}

ACCEPTANCE CRITERIAS / GOALS

  • showAs is read from long title instead of hardcoded