/** * @return the previous job fire time */ private Date getPreviousFireTime() { return this.watchListJobObject.getDateValue(WatchListJobClassDocumentInitializer.LAST_FIRE_TIME_FIELD); }
public int compare(com.xpn.xwiki.api.Object entry1, com.xpn.xwiki.api.Object entry2) { BaseObject bobj1 = entry1.getXWikiObject(); BaseObject bobj2 = entry1.getXWikiObject(); if ((bobj1.getDateValue("date") == null) && (bobj2.getDateValue("date") == null)) { return 0; } if (bobj1.getDateValue("date") == null) { return 1; } if (bobj2.getDateValue("date") == null) { return -1; } return (-bobj1.getDateValue("date").compareTo(bobj2.getDateValue("date"))); } }
private String getContentAsDate(BaseObject baseObject, String propertyName) { Date date = baseObject.getDateValue(propertyName); if (date != null) { return IndexFields.dateToString(date); } return ""; } }
private String getLifeStatus(BaseObject data) { String lifeStatus = ALIVE; Date date = data.getDateValue(DATE_OF_DEATH); String dodEntered = data.getStringValue(DATE_OF_DEATH_ENTERED); if (date != null || (StringUtils.isNotBlank(dodEntered) && !"{}".equals(dodEntered))) { lifeStatus = DECEASED; } else { // check if "unknown death date" checkbox is checked Integer deathDateUnknown = data.getIntValue(DATE_OF_DEATH_UNKNOWN); if (deathDateUnknown == 1) { lifeStatus = DECEASED; } } return lifeStatus; } }
private String getLifeStatus(BaseObject data) { String lifeStatus = ALIVE; Date date = data.getDateValue(DATE_OF_DEATH); String dodEntered = data.getStringValue(DATE_OF_DEATH_ENTERED); if (date != null || (StringUtils.isNotBlank(dodEntered) && !"{}".equals(dodEntered))) { lifeStatus = DECEASED; } else { // check if "unknown death date" checkbox is checked Integer deathDateUnknown = data.getIntValue(DATE_OF_DEATH_UNKNOWN); if (deathDateUnknown == 1) { lifeStatus = DECEASED; } } return lifeStatus; } }
private void updatePatientDates(BaseObject patientData, String documentName) { for (Map.Entry<String, String> entry : ASENTERED_FIELDNAMES.entrySet()) { String asEnteredField = entry.getKey(); String dateAsEntered = patientData.getStringValue(asEnteredField); if (!StringUtils.isEmpty(dateAsEntered)) { // if "date as entered" is present, use it and disregard the date field itself. try { JSONObject dateAsEnteredJSON = new JSONObject(dateAsEntered); PhenoTipsDate asEnteredDate = new PhenoTipsDate(dateAsEnteredJSON); // PhenoTipsDate can read data in the old format, and can spit out date in the new format patientData.setStringValue(asEnteredField, asEnteredDate.toString()); } catch (Exception ex) { this.logger.error("Could not process date-as-entered field {} for patient {}: [{}]", asEnteredField, documentName, ex.getMessage()); } } else { // otherwise use the date field (if present) to populate the date as entered String dateField = entry.getValue(); Date date = patientData.getDateValue(dateField); if (date != null) { this.logger.debug("Using the value from the {} field to populate {} field for patient {}", dateField, asEnteredField, documentName); PhenoTipsDate phenotipsDate = new PhenoTipsDate(date); patientData.setStringValue(asEnteredField, phenotipsDate.toString()); } } } }
private void updatePatientDates(BaseObject patientData, String documentName) { for (Map.Entry<String, String> entry : ASENTERED_FIELDNAMES.entrySet()) { String asEnteredField = entry.getKey(); String dateAsEntered = patientData.getStringValue(asEnteredField); if (!StringUtils.isEmpty(dateAsEntered)) { // if "date as entered" is present, use it and disregard the date field itself. try { JSONObject dateAsEnteredJSON = new JSONObject(dateAsEntered); PhenoTipsDate asEnteredDate = new PhenoTipsDate(dateAsEnteredJSON); // PhenoTipsDate can read data in the old format, and can spit out date in the new format patientData.setStringValue(asEnteredField, asEnteredDate.toString()); } catch (Exception ex) { this.logger.error("Could not process date-as-entered field {} for patient {}: [{}]", asEnteredField, documentName, ex.getMessage()); } } else { // otherwise use the date field (if present) to populate the date as entered String dateField = entry.getValue(); Date date = patientData.getDateValue(dateField); if (date != null) { this.logger.debug("Using the value from the {} field to populate {} field for patient {}", dateField, asEnteredField, documentName); PhenoTipsDate phenotipsDate = new PhenoTipsDate(date); patientData.setStringValue(asEnteredField, phenotipsDate.toString()); } } } }
Date date = data.getDateValue(propertyName); if (date != null) { result.put(propertyName, new PhenoTipsDate(date));
Date date = data.getDateValue(propertyName); if (date != null) { result.put(propertyName, new PhenoTipsDate(date));
return; Date birthDate = patientRecordObj.getDateValue("date_of_birth"); continue; Date measurementDate = measurement.getDateValue(DATE_PROPERTY_NAME); if (measurementDate == null || birthDate == null) { measurement.removeField(AGE_PROPERTY_NAME);
return; Date birthDate = patientRecordObj.getDateValue("date_of_birth"); continue; Date measurementDate = measurement.getDateValue(DATE_PROPERTY_NAME); if (measurementDate == null || birthDate == null) { measurement.removeField(AGE_PROPERTY_NAME);
if (obj.getDateValue(WatchListJobClassDocumentInitializer.LAST_FIRE_TIME_FIELD) == null) { obj.setDateValue(WatchListJobClassDocumentInitializer.LAST_FIRE_TIME_FIELD, new Date()); needsupdate = true;
/** * Retrieves the value of a date property. */ protected Date getDateValue(String mapping, Document doc, XWikiContext context) throws XWikiException { XWikiDocument xdoc = context.getWiki().getDocument(doc.getFullName(), context); PropertySelector ps = new PropertySelector(mapping); if (ps.getClassName() == null) { return xdoc.getFirstObject(ps.getPropertyName(), context).getDateValue(ps.getPropertyName()); } else { return xdoc.getObject(ps.getClassName(), ps.getObjectIndex()).getDateValue(ps.getPropertyName()); } }
private void handleObject(List<NotificationFilterPreference> preferencesToConvert, BaseObject obj) { DefaultNotificationFilterPreference preference = new DefaultNotificationFilterPreference(); NotificationFilterType filterType = NotificationFilterType.valueOf( obj.getStringValue(FIELD_FILTER_TYPE).toUpperCase()); Set<NotificationFormat> filterFormats = new HashSet<>(); for (String format : (List<String>) obj.getListValue(FIELD_FILTER_FORMATS)) { filterFormats.add(NotificationFormat.valueOf(format.toUpperCase())); } preference.setProviderHint("userProfile"); preference.setFilterName(obj.getStringValue(FIELD_FILTER_NAME)); preference.setEnabled(obj.getIntValue(FIELD_IS_ENABLED, 1) == 1); preference.setActive(obj.getIntValue(FIELD_IS_ACTIVE, 1) == 1); preference.setFilterType(filterType); preference.setNotificationFormats(filterFormats); preference.setStartingDate(obj.getDateValue(FIELD_STARTING_DATE)); handleProperties(preferencesToConvert, obj, preference); }
return; Date birthDate = patientRecordObj.getDateValue("date_of_birth"); if (birthDate == null) { return; continue; Date measurementDate = measurement.getDateValue(DATE_PROPERTY_NAME); if (measurementDate == null) { measurement.removeField(AGE_PROPERTY_NAME);
@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); } }
return; Date birthDate = patientRecordObj.getDateValue("date_of_birth"); if (birthDate == null) { return; continue; Date measurementDate = measurement.getDateValue("date"); if (measurementDate == null) { PropertyInterface prop = null;
private MemberCandidacy readCandidacyFromObject(BaseObject object, String wikiId) { MemberCandidacy candidacy = new MemberCandidacy(); candidacy.setId(object.getNumber()); candidacy.setWikiId(wikiId); candidacy.setUserId(object.getStringValue(WikiCandidateMemberClassInitializer.FIELD_USER)); candidacy.setUserComment(object.getLargeStringValue(WikiCandidateMemberClassInitializer.FIELD_USER_COMMENT)); candidacy.setAdminId(object.getStringValue(WikiCandidateMemberClassInitializer.FIELD_ADMIN)); candidacy.setAdminComment(object.getLargeStringValue(WikiCandidateMemberClassInitializer.FIELD_ADMIN_COMMENT)); candidacy.setAdminPrivateComment(object.getLargeStringValue( WikiCandidateMemberClassInitializer.FIELD_ADMIN_PRIVATE_COMMENT)); candidacy.setStatus( MemberCandidacy.Status.valueOf( object.getStringValue(WikiCandidateMemberClassInitializer.FIELD_STATUS).toUpperCase())); candidacy.setType( MemberCandidacy.CandidateType.valueOf( object.getStringValue(WikiCandidateMemberClassInitializer.FIELD_TYPE).toUpperCase()) ); candidacy.setDateOfCreation(object.getDateValue(WikiCandidateMemberClassInitializer.FIELD_DATE_OF_CREATION)); candidacy.setDateOfCreation(object.getDateValue(WikiCandidateMemberClassInitializer.FIELD_DATE_OF_CLOSURE)); return candidacy; }
oldObject.getLargeStringValue("reviewerPrivateComment")); newObject.setDateValue(WikiCandidateMemberClassInitializer.FIELD_DATE_OF_CREATION, oldObject.getDateValue("date")); newObject.setDateValue(WikiCandidateMemberClassInitializer.FIELD_DATE_OF_CLOSURE, oldObject.getDateValue("resolutionDate"));