@Override public EntityReference getEntityType() { DocumentReference fullReference = getEntityXClassReference(); return fullReference.removeParent(fullReference.getRoot()); }
member.getDocumentReference().getRoot());
@Override public void onEvent(Event event, Object source, Object data) { XWikiContext context = (XWikiContext) data; XWikiDocument doc = (XWikiDocument) source; BaseObject patientRecordObj = doc.getXObject(new DocumentReference(doc.getDocumentReference().getRoot().getName(), PHENOTIPS_CODE_SPACE, "PatientClass")); if (patientRecordObj == null) { return; } BaseClass patientRecordClass = patientRecordObj.getXClass(context); for (String targetPropertyName : patientRecordClass.getPropertyList()) { if (!targetPropertyName.contains("phenotype")) { continue; } for (String phenotype : (List<String>) patientRecordObj.getListValue(targetPropertyName)) { if (!phenotype.matches("HP:[0-9]+")) { List<String> category = getParameter(targetPropertyName + "__" + phenotype.replaceAll("[^a-zA-Z0-9_]+", "_") + "__category", patientRecordObj.getNumber()); if (category != null && !category.isEmpty()) { storeCategory(phenotype, category, targetPropertyName, doc, context); } } } } }
@Override public void onEvent(Event event, Object source, Object data) { XWikiDocument doc = (XWikiDocument) source; BaseObject patientRecordObj = doc.getXObject(new DocumentReference(doc.getDocumentReference().getRoot().getName(), "PhenoTips", "PatientClass")); if (patientRecordObj == null) { return; } updateField("phenotype", "extended_phenotype", patientRecordObj); updateField("prenatal_phenotype", "extended_prenatal_phenotype", patientRecordObj); updateField("negative_phenotype", "extended_negative_phenotype", patientRecordObj); }
@Override public void onEvent(Event event, Object source, Object data) { XWikiDocument doc = (XWikiDocument) source; BaseObject patientRecordObj = doc.getXObject(new DocumentReference(doc.getDocumentReference().getRoot().getName(), Constants.CODE_SPACE, "PatientClass")); if (patientRecordObj == null) { return; } updateField("phenotype", "extended_phenotype", patientRecordObj); updateField("prenatal_phenotype", "extended_prenatal_phenotype", patientRecordObj); updateField("negative_phenotype", "extended_negative_phenotype", patientRecordObj); }
@Override public void onEvent(Event event, Object source, Object data) { XWikiDocument doc = (XWikiDocument) source; BaseObject patientRecordObj = doc.getXObject(new DocumentReference( doc.getDocumentReference().getRoot().getName(), "PhenoTips", "PatientClass")); if (patientRecordObj == null) { return; } String targetPropertyName = "date_of_birth"; int year = getParameter("date_of_birth_year", patientRecordObj.getNumber()); int month = getParameter("date_of_birth_month", patientRecordObj.getNumber()); int day = getParameter("date_of_birth_day", patientRecordObj.getNumber()); if (year == -1 || month == -1) { // No values specified in the request, skip this step return; } if (day <= 0) { day = 1; } Date birthdate = patientRecordObj.getDateValue(targetPropertyName); Date newBirthdate = new GregorianCalendar(year, month, day).getTime(); if (!newBirthdate.equals(birthdate)) { patientRecordObj.setDateValue(targetPropertyName, newBirthdate); } }
@Override public void onEvent(Event event, Object source, Object data) { XWikiDocument doc = (XWikiDocument) source; BaseObject patientRecordObj = doc.getXObject(new DocumentReference( doc.getDocumentReference().getRoot().getName(), Constants.CODE_SPACE, "PatientClass")); if (patientRecordObj == null) { return; } String targetPropertyName = "date_of_birth"; int year = getParameter("date_of_birth_year", patientRecordObj.getNumber()); int month = getParameter("date_of_birth_month", patientRecordObj.getNumber()); int day = getParameter("date_of_birth_day", patientRecordObj.getNumber()); if (year == -1 || month == -1) { // No values specified in the request, skip this step return; } if (day <= 0) { day = 1; } Date birthdate = patientRecordObj.getDateValue(targetPropertyName); Date newBirthdate = new GregorianCalendar(year, month, day).getTime(); if (!newBirthdate.equals(birthdate)) { patientRecordObj.setDateValue(targetPropertyName, newBirthdate); } }
String currentWiki = dab.getCurrentDocumentReference().getRoot().getName(); DocumentReference templateReference = dab.getCurrentDocumentReference(); DocumentReference classReference = new DocumentReference(currentWiki, "XWiki", "PDFClass");