/** * For each {@code genesymbol} field, rename it to {@code gene} and swtich the value from HGNC symbol to Ensembl ID, * if provided. * * @param doc XWiki document * @param geneVariantClassReference reference to {@code GeneVariantClass} * @throws XWikiException if property value cannot be set */ private void migrateGeneVariants(final XWikiDocument doc, final DocumentReference geneVariantClassReference) throws XWikiException { final List<BaseObject> variants = doc.getXObjects(geneVariantClassReference); if (variants == null) { return; } for (final BaseObject variant : variants) { final StringProperty oldGeneName = setPropertyValue(variant, OLD_GENE_NAME); // Rename all "genesymbol" properties to "gene". if (oldGeneName != null) { variant.removeField(OLD_GENE_NAME); final StringProperty newGeneName = (StringProperty) oldGeneName.clone(); newGeneName.setName(GENE_NAME); variant.addField(GENE_NAME, newGeneName); } } }
/** * For each {@code genesymbol} field, rename it to {@code gene} and swtich the value from HGNC symbol to Ensembl ID, * if provided. * * @param doc XWiki document * @param geneVariantClassReference reference to {@code GeneVariantClass} * @throws XWikiException if property value cannot be set */ private void migrateGeneVariants(final XWikiDocument doc, final DocumentReference geneVariantClassReference) throws XWikiException { final List<BaseObject> variants = doc.getXObjects(geneVariantClassReference); if (variants == null) { return; } for (final BaseObject variant : variants) { final StringProperty oldGeneName = setPropertyValue(variant, OLD_GENE_NAME); // Rename all "genesymbol" properties to "gene". if (oldGeneName != null) { variant.removeField(OLD_GENE_NAME); final StringProperty newGeneName = (StringProperty) oldGeneName.clone(); newGeneName.setName(GENE_NAME); variant.addField(GENE_NAME, newGeneName); } } }
StringProperty newProperty = (StringProperty) oldProperty.clone(); newProperty.setName(NEW_NAME); object.addField(NEW_NAME, newProperty);
StringProperty newProperty = (StringProperty) oldProperty.clone(); newProperty.setName(NEW_NAME); object.addField(NEW_NAME, newProperty);
StringProperty newProperty = (StringProperty) oldProperty.clone(); newProperty.setName(NEW_NAME); object.addField(NEW_NAME, newProperty);
StringProperty newProperty = (StringProperty) oldProperty.clone(); newProperty.setName(NEW_NAME); object.addField(NEW_NAME, newProperty);
StringProperty newProperty = (StringProperty) oldProperty.clone(); newProperty.setName(NEW_NAME); object.addField(NEW_NAME, newProperty);
StringProperty newProperty = (StringProperty) oldProperty.clone(); newProperty.setName(NEW_NAME); object.addField(NEW_NAME, newProperty);