/** * The custom configuration can specify a different phenotype mapping to use, as a serialized reference to the * mapping document. * * @return a serialized document reference, possibly empty or {@code null} */ public String getPhenotypeMapping() { return this.configuration.getStringValue("mapping"); } }
private void setRights(DocumentReference editor, XWikiDocument doc, XWikiContext context) throws XWikiException { BaseObject rights = doc.newXObject(RIGHTS_CLASS_REFERENCE, context); rights.setIntValue("allow", 1); rights.setStringValue("levels", "edit"); rights.setLargeStringValue("groups", editor.toString()); } }
private boolean updatePedigree(BaseObject pedigreeXObject, XWikiContext context, String docName) { String oldPedigreeAsText = pedigreeXObject.getStringValue(PEDIGREECLASS_JSONDATA_KEY); if (!StringUtils.isEmpty(oldPedigreeAsText)) { if (pedigreeIsInSimpleJSONFormat(oldPedigreeAsText)) { String convertedPedigree = this.convertPedigreeData(oldPedigreeAsText); pedigreeXObject.set(PEDIGREECLASS_JSONDATA_KEY, convertedPedigree, context); return true; } } return false; }
private void migrateValue(BaseObject parentalObject, BaseObject obstetricObject, Integer propValue, String propName) { parentalObject.removeField(OLD_PREFIX + propName); if (propValue != null) { obstetricObject.setIntValue(propName, propValue); } } }
public TableDataSource(BaseObject defObject, XWikiContext context) throws DataSourceException { init(defObject.getName(), defObject.getIntValue(TABLE_NUMBER), defObject.getStringValue(RANGE) == "" ? DEFAULT_RANGE : defObject.getStringValue(RANGE), defObject.getIntValue(HAS_HEADER_ROW) == 1, defObject .getIntValue(HAS_HEADER_COLUMN) == 1, defObject.getStringValue(DECIMAL_SYMBOL) == "" ? DEFAULT_DECIMAL_SYMBOL : defObject.getStringValue(DECIMAL_SYMBOL), defObject.getIntValue(IGNORE_ALPHA) == 1, context); }
/** * @param baseObject the object containing the component definition * @param roleType the role Type implemented * @param roleHint the role hint for this role implementation */ public AbstractAsyncBaseObjectWikiComponent(BaseObject baseObject, Type roleType, String roleHint) { super(baseObject, roleType, roleHint); this.async = baseObject.getIntValue(XPROPERTY_ASYNC_ENABLED, 0) == 1; this.cached = baseObject.getIntValue(XPROPERTY_ASYNC_CACHED, 0) == 1; List<String> contextEntriesList = baseObject.getListValue(XPROPERTY_ASYNC_CONTEXT); this.contextEntries = contextEntriesList != null ? new HashSet<>(contextEntriesList) : null; } }
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 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; }
@Override public String getWarningMessage() { BaseObject familyObject = this.familyDocument.getXObject(Family.CLASS_REFERENCE); if (familyObject.getIntValue(WARNING) == 0) { return ""; } else { return familyObject.getStringValue("warning_message"); } }
/** * @since 2.2.3 */ public void setStringValue(EntityReference classReference, String fieldName, String value) { BaseObject bobject = prepareXObject(classReference); bobject.setStringValue(fieldName, value); }
private String getMacroName(BaseObject macroDefinition, String macroId) { String macroName = macroDefinition.getStringValue(MACRO_NAME_PROPERTY); // Verify macro name. if (StringUtils.isEmpty(macroName)) { macroName = macroId; this.logger.debug("Incomplete macro definition in [{}], macro name is empty", macroDefinition.getReference()); } return macroName; }
/** * Set family object properties. */ private void setFamilyObject(XWikiDocument familyXDocument, XWikiDocument patientXDoc, long id) throws XWikiException { BaseObject familyObject = familyXDocument.newXObject(Family.CLASS_REFERENCE, this.context); familyObject.setLongValue("identifier", id); familyObject.setStringListValue("members", Arrays.asList(patientXDoc.getDocumentReference().getName())); familyObject.setStringValue("external_id", this.getPropertyValue(patientXDoc, Patient.CLASS_REFERENCE, "last_name", "")); familyObject.setIntValue("warning", 0); familyObject.setStringValue("warning_message", ""); }
@Override public void onEvent(Event event, Object source, Object data) { XWikiDocument document = (XWikiDocument) source; String currentWiki = wikiDescriptorManager.getCurrentWikiId(); DocumentReference ssxDocRef = new DocumentReference(currentWiki, "XWiki", "StyleSheetExtension"); List<BaseObject> ssxObjects = document.getXObjects(ssxDocRef); if (ssxObjects != null && !ssxObjects.isEmpty()) { for (BaseObject obj : ssxObjects) { if (obj == null) { continue; } if ("LESS".equals(obj.getStringValue("contentType"))) { ObjectPropertyReference objectPropertyReference = new ObjectPropertyReference("code", new BaseObjectReference(ssxDocRef, obj.getNumber(), document.getDocumentReference())); LESSResourceReference lessResourceReference = lessResourceReferenceFactory.createReferenceForXObjectProperty(objectPropertyReference); lessResourcesCache.clearFromLESSResource(lessResourceReference); colorThemeCache.clearFromLESSResource(lessResourceReference); } } } } }
public void setConsents(List<String> consents) { this.consentHolder.set(GRANTED, consents, this.context); }
private void migrateSolvedGenes(XWikiDocument doc, XWikiContext context, List<String> geneList) throws HibernateException, XWikiException { BaseObject patient = doc.getXObject(this.patientClassReference); StringProperty oldTarget = (StringProperty) patient.get(SOLVED_NAME); if (oldTarget == null) { return; } patient.removeField(SOLVED_NAME); String geneName = oldTarget.getValue(); if (!StringUtils.isBlank(geneName)) { BaseObject gene = doc.newXObject(this.geneClassReference, context); gene.setStringValue(GENE_NAME, geneName); gene.setStringValue(STATUS_NAME, "solved"); geneList.add(geneName); } }
/** * Helper method - set permissions object properties for one access level. */ private void setRights(XWikiDocument familyXDocument, XWikiDocument patientXDoc, String rightLevel) throws XWikiException { BaseObject permissionsObject = familyXDocument.newXObject(this.rightsClassReference, this.context); String[] rightHolders = this.familyPermissions.getEntitiesWithAccessAsString(patientXDoc, VIEW_RIGHT); permissionsObject.setStringValue("users", rightHolders[0]); permissionsObject.setStringValue("groups", rightHolders[1]); permissionsObject.setStringValue("levels", rightLevel); permissionsObject.setIntValue("allow", 1); }
/** * @since 2.2M2 */ public int getIntValue(DocumentReference classReference, String fieldName) { BaseObject obj = getXObject(classReference, 0); if (obj == null) { return 0; } return obj.getIntValue(fieldName); }
private static void fillObjectSummary(ObjectSummary objectSummary, ObjectFactory objectFactory, URI baseUri, Document doc, BaseObject xwikiObject) throws XWikiException { objectSummary.setId(String.format("%s:%s", doc.getPrefixedFullName(), xwikiObject.getGuid())); objectSummary.setGuid(xwikiObject.getGuid()); objectSummary.setPageId(doc.getPrefixedFullName()); objectSummary.setWiki(doc.getWiki()); objectSummary.setSpace(doc.getSpace()); objectSummary.setPageName(doc.getName()); objectSummary.setClassName(xwikiObject.getClassName()); objectSummary.setNumber(xwikiObject.getNumber()); String[] propertyNames = xwikiObject.getPropertyNames(); if (propertyNames.length > 0) { objectSummary.setHeadline(xwikiObject.get(propertyNames[0]).toFormString()); } }
@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); } }
@SuppressWarnings("unchecked") public List<String> getConsents() throws XWikiException { return this.consentHolder.getListValue(GRANTED); }