|
From: Johan T. <jt...@us...> - 2006-10-11 14:41:29
|
Update of /cvsroot/vienti/vienti/source/se/biobanksregistersyd/vienti/datafiles In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv20228/source/se/biobanksregistersyd/vienti/datafiles Modified Files: DfXML_RBBR.java Log Message: Handle the element 'rbbr:multiplicity'. Adhere to version 0.2 of the RBBR and RBBR-Exchange schemas. Javadoc and CheckStyle fixes. Index: DfXML_RBBR.java =================================================================== RCS file: /cvsroot/vienti/vienti/source/se/biobanksregistersyd/vienti/datafiles/DfXML_RBBR.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- DfXML_RBBR.java 20 Jun 2006 14:24:28 -0000 1.22 +++ DfXML_RBBR.java 11 Oct 2006 14:41:23 -0000 1.23 @@ -24,6 +24,11 @@ ** liable for any use that may be made of the information contained herein. ** ** $Log$ + ** Revision 1.23 2006/10/11 14:41:23 jtorin + ** Handle the element 'rbbr:multiplicity'. + ** Adhere to version 0.2 of the RBBR and RBBR-Exchange schemas. + ** Javadoc and CheckStyle fixes. + ** ** Revision 1.22 2006/06/20 14:24:28 amijdema ** Removed the inline class CurrentClassGetter. Now they use CurrentContext.java ** in its place. @@ -144,8 +149,9 @@ private String revision = null; /** Current classname. - * "se.biobanksregistersyd.vienti.datafiles.DfXML_RBBR" */ - private static final String CLASSNAME = CurrentContext.getCurrentClassName(); + * "se.biobanksregistersyd.vienti.datafiles.DfXML_RBBR" */ + private static final String CLASSNAME = + CurrentContext.getCurrentClassName(); /** The country which this biobank belongs to. */ private String countryId = null; @@ -164,19 +170,26 @@ */ private Boolean complete = null; + /** A regexp pattern that matches normal swedish person identification + * numbers. */ private Pattern personIdPnoPattern = Pattern.compile("[0-9]{12}"); + /** A regexp pattern that matches swedish person identification + * numbers of a more deviant kind. */ private Pattern personIdPnoDeviantPattern = Pattern .compile("[0-9,A-Z,a-z]{12}"); /** The namespace name of the schema RBBR-Exchange. */ - private String xchngNS = "http://www.biobanksregistersyd.se/XML-schema/ns/RBBR-Exchange/0.1/"; + private String xchngNS = + "http://www.biobanksregistersyd.se/XML-schema/ns/RBBR-Exchange/0.2/"; /** The namespace name of the schema RBBR. */ - private String rbbrNS = "http://www.biobanksregistersyd.se/XML-schema/ns/RBBR/0.1/"; + private String rbbrNS = + "http://www.biobanksregistersyd.se/XML-schema/ns/RBBR/0.2/"; /** The namespace name of the schema BASE. */ - private String baseNS = "http://www.biobanksregistersyd.se/XML-schema/ns/Base/0.1/"; + private String baseNS = + "http://www.biobanksregistersyd.se/XML-schema/ns/Base/0.1/"; /** The namespace name of the schema XMLSchema-instance. */ private String xsiNS = "http://www.w3.org/2001/XMLSchema-instance"; @@ -383,8 +396,8 @@ // appropriate for its contents. Match timestamps with both ' ' // and 'T' as the intermeditate character between the date and time // part, and correct it (to 'T') below. - Pattern datePattern = Pattern - .compile("\\d\\d\\d\\d-\\d\\d-\\d\\d(?: |T)\\d\\d:\\d\\d:\\d\\d"); + Pattern datePattern = Pattern.compile( + "\\d\\d\\d\\d-\\d\\d-\\d\\d(?: |T)\\d\\d:\\d\\d:\\d\\d"); Matcher matcher = datePattern.matcher(startdate); // Check if the timestamp is in ISO 8601 format. if (matcher.matches()) { @@ -525,7 +538,8 @@ * @throws GenerationException * if an error was detected while writing XML to the stream. */ - public void writeEntry(final Hashtable dataset) throws GenerationException { + public void writeEntry(final Hashtable dataset) + throws GenerationException { try { // System.out.println(dataset.toString() + "\n"); @@ -686,6 +700,22 @@ xmlw.writeCharacters("\n"); // + // multiplicity + // + if (dataset.containsKey("rbbr:multiplicity")) { + xmlw.writeCharacters(" "); + xmlw.writeStartElement(rbbrNS, "multiplicity"); + if (dataset.containsKey("rbbr:multiplicity-type")) { + xmlw.writeAttribute("type", + (String) dataset.get("rbbr:multiplicity-type")); + } + xmlw.writeCharacters((String) dataset.get("rbbr:multiplicity")); + xmlw.writeEndElement(); + xmlw.writeCharacters("\n"); + } + + + // // sampleExistence // if (sampleIsDestructed) { @@ -768,9 +798,8 @@ if (dataset.containsKey("rbbr:sampleOrderer")) { xmlw.writeCharacters(" "); xmlw.writeStartElement(rbbrNS, "sampleOrderer"); - xmlw - .writeCharacters((String) dataset - .get("rbbr:sampleOrderer")); + xmlw.writeCharacters((String) dataset + .get("rbbr:sampleOrderer")); xmlw.writeEndElement(); xmlw.writeCharacters("\n"); } @@ -849,7 +878,8 @@ // If there is no consent decision values at all a special one // is generated. See below. if (consentValues.isEmpty() - && (consentSpecificPurposeReference == null && consentSpecificPurposeStoreId == null)) { + && (consentSpecificPurposeReference == null + && consentSpecificPurposeStoreId == null)) { writeConsentHistory = true; } @@ -1032,44 +1062,62 @@ xmlw.writeCharacters(" "); xmlw.writeStartElement(rbbrNS, "consentCareAndTreatment"); - xmlw.writeCharacters((tmp.indexOf("f") == -1) ? "true" - : "false"); + if (tmp.indexOf("f") == -1) { + xmlw.writeCharacters("true"); + } else { + xmlw.writeCharacters("false"); + } xmlw.writeEndElement(); xmlw.writeCharacters("\n"); xmlw.writeCharacters(" "); xmlw.writeStartElement(rbbrNS, "consentEducation"); - xmlw.writeCharacters((tmp.indexOf("e") == -1) ? "true" - : "false"); + if (tmp.indexOf("e") == -1) { + xmlw.writeCharacters("true"); + } else { + xmlw.writeCharacters("false"); + } xmlw.writeEndElement(); xmlw.writeCharacters("\n"); xmlw.writeCharacters(" "); xmlw.writeStartElement(rbbrNS, "consentQualityAssurance"); - xmlw.writeCharacters((tmp.indexOf("d") == -1) ? "true" - : "false"); + if (tmp.indexOf("d") == -1) { + xmlw.writeCharacters("true"); + } else { + xmlw.writeCharacters("false"); + } xmlw.writeEndElement(); xmlw.writeCharacters("\n"); xmlw.writeCharacters(" "); xmlw.writeStartElement(rbbrNS, "consentDevelopment"); - xmlw.writeCharacters((tmp.indexOf("c") == -1) ? "true" - : "false"); + if (tmp.indexOf("c") == -1) { + xmlw.writeCharacters("true"); + } else { + xmlw.writeCharacters("false"); + } xmlw.writeEndElement(); xmlw.writeCharacters("\n"); xmlw.writeCharacters(" "); xmlw.writeStartElement(rbbrNS, "consentResearch"); - xmlw.writeCharacters((tmp.indexOf("a") == -1) ? "true" - : "false"); + if (tmp.indexOf("a") == -1) { + xmlw.writeCharacters("true"); + } else { + xmlw.writeCharacters("false"); + } xmlw.writeEndElement(); xmlw.writeCharacters("\n"); xmlw.writeCharacters(" "); xmlw.writeStartElement(rbbrNS, "consentClinicalTrial"); - xmlw.writeCharacters((tmp.indexOf("b") == -1) ? "true" - : "false"); + if (tmp.indexOf("b") == -1) { + xmlw.writeCharacters("true"); + } else { + xmlw.writeCharacters("false"); + } xmlw.writeEndElement(); xmlw.writeCharacters("\n"); @@ -1152,8 +1200,8 @@ if (creationDate.compareTo("2004-11-01") < 0) { xmlw.writeCharacters("HISTORICAL_SAMPLE"); } else { - xmlw - .writeCharacters("SAMPLE_PROVIDER_NOT_CONSULTED"); + xmlw.writeCharacters( + "SAMPLE_PROVIDER_NOT_CONSULTED"); } xmlw.writeEndElement(); xmlw.writeCharacters("\n"); @@ -1171,7 +1219,8 @@ } } } else if (consentValues.isEmpty() - && (consentSpecificPurposeReference == null && consentSpecificPurposeStoreId == null)) { + && (consentSpecificPurposeReference == null + && consentSpecificPurposeStoreId == null)) { xmlw.writeCharacters(" "); xmlw.writeStartElement(rbbrNS, "consentDecision"); xmlw.writeAttribute("storeId", "ID-AUTOGENERATED"); |