/** * @since 2.2.3 */ public void setStringListValue(EntityReference classReference, String fieldName, List value) { BaseObject bobject = prepareXObject(classReference); bobject.setStringListValue(fieldName, value); }
/** * Modify the value of the field <code>fieldName</code> of the managed object's class. * * @param fieldName the name of the field from the managed object's class where to find the value. * @param value the new value of the field <code>fieldName</code> of the managed object's class. * @see com.xpn.xwiki.doc.XWikiDocument#setStringListValue(java.lang.String,java.lang.String,java.util.List) * @since 1.4 */ public void setStringListValue(String fieldName, List<String> value) { BaseObject obj = getBaseObject(true); if (obj != null) { obj.setStringListValue(fieldName, value); } }
/** * Modify the value of the field <code>fieldName</code> of the managed object's class. * * @param fieldName the name of the field from the managed object's class where to find the value. * @param value the new value of the field <code>fieldName</code> of the managed object's class. * @see com.xpn.xwiki.doc.XWikiDocument#setStringListValue(java.lang.String,java.lang.String,java.util.List) * @deprecated Use {@link #getStringListValue(String)} instead. Since 1.4. */ @Deprecated public void setListValue(String fieldName, List value) { BaseObject obj = getBaseObject(true); if (obj != null) { obj.setStringListValue(fieldName, value); } }
newXObject.setStringValue("filterName", "scopeNotificationFilter"); newXObject.setStringValue("filterType", oldFilterType); newXObject.setStringListValue("filterFormats", Collections.singletonList(oldFilterFormat)); newXObject.setStringListValue("pages", oldXObjectScopeReference); break; case "pageAndChildren": newXObject.setStringListValue("spaces", oldXObjectScopeReference); break; case "wiki": newXObject.setStringListValue("wikis", oldXObjectScopeReference); break; default:
/** * Store the category specified for a free-text phenotype in an object attached to the patient sheet. * * @param phenotype the free-text phenotype value found in the request * @param category the specified category where the phenotype belongs * @param targetPropertyName the name of the phenotype property where the {@code phenotype} was specified * @param doc the patient sheet * @param context the current execution context */ private void storeCategory(String phenotype, List<String> category, String targetPropertyName, XWikiDocument doc, XWikiContext context) { BaseObject targetMappingObject = findCategoryObject(phenotype, targetPropertyName, doc, context); targetMappingObject.setStringValue(NAME_PROPETY_NAME, targetPropertyName); targetMappingObject.setStringValue(VALUE_PROPETY_NAME, phenotype); targetMappingObject.setStringListValue(CATEGORY_PROPETY_NAME, category); }
/** * Set family references for all relatives. */ private void setAllFamilyRefs(Set<String> existingMembers, Set<String> newFamilyMembers, XWikiDocument familyXDocument) { String familyID = familyXDocument.getDocumentReference().getName(); try { String familyDocumentRef = familyXDocument.getDocumentReference().toString(); // has to be a list because of setStringListValue() interface List<String> membersRefsList = existingMembers == null ? new LinkedList<String>() : new LinkedList<String>(existingMembers); for (String memberId : newFamilyMembers) { membersRefsList.add(memberId); // set the family reference to a relative doc XWikiDocument patientDoc = this.getPatientXDocument(memberId); if (!this.familyMigrations.setFamilyReference(patientDoc, familyDocumentRef, this.context) || !this.saveXWikiDocument(patientDoc, this.getDescription())) { this.logger.error("Failed to link patient [{}] to family [{}]", memberId, familyID); } } BaseObject familyObject = familyXDocument.getXObject(Family.CLASS_REFERENCE, true, this.context); familyObject.setStringListValue("members", membersRefsList); } catch (Exception ex) { this.logger.error("Failed to link family [{}] to its new members [{}]", familyID, newFamilyMembers); } }
/** * Set family references for all relatives. */ private void setAllFamilyRefs(Set<String> existingMembers, Set<String> newFamilyMembers, XWikiDocument familyXDocument) { String familyID = familyXDocument.getDocumentReference().getName(); try { String familyDocumentRef = familyXDocument.getDocumentReference().toString(); // has to be a list because of setStringListValue() interface List<String> membersRefsList = existingMembers == null ? new LinkedList<>() : new LinkedList<>(existingMembers); for (String memberId : newFamilyMembers) { membersRefsList.add(memberId); // set the family reference to a relative doc XWikiDocument patientDoc = this.getPatientXDocument(memberId); if (!this.familyMigrations.setFamilyReference(patientDoc, familyDocumentRef, this.context) || !this.saveXWikiDocument(patientDoc, this.getDescription())) { this.logger.error("Failed to link patient [{}] to family [{}]", memberId, familyID); } } BaseObject familyObject = familyXDocument.getXObject(Family.CLASS_REFERENCE, true, this.context); familyObject.setStringListValue("members", membersRefsList); } catch (Exception ex) { this.logger.error("Failed to link family [{}] to its new members [{}]", familyID, newFamilyMembers); } }
/** * 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", ""); }
/** * 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", ""); }