private String getFieldValue(BaseObject variantObject, String property) { if (INTERNAL_EVIDENCE_KEY.equals(property)) { StringListProperty fields = (StringListProperty) variantObject.getField(property); if (fields == null || fields.getList().size() == 0) { return null; } return fields.getTextValue(); } else if (INTERNAL_START_POSITION_KEY.equals(property) || INTERNAL_END_POSITION_KEY.equals(property)) { int value = variantObject.getIntValue(property, -1); return value == -1 ? null : Integer.toString(value); } else { BaseStringProperty field = (BaseStringProperty) variantObject.getField(property); return field == null ? null : field.getValue(); } }
private String getFieldValue(BaseObject geneObject, String property) { if (INTERNAL_STRATEGY_KEY.equals(property)) { StringListProperty fields = (StringListProperty) geneObject.getField(property); if (fields == null || fields.getList().size() == 0) { return null; } return fields.getTextValue(); } else { BaseStringProperty field = (BaseStringProperty) geneObject.getField(property); if (field == null) { return null; } return field.getValue(); } }
private String getFieldValue(BaseObject variantObject, String property) { if (INTERNAL_EVIDENCE_KEY.equals(property)) { StringListProperty fields = (StringListProperty) variantObject.getField(property); if (fields == null || fields.getList().size() == 0) { return null; } return fields.getTextValue(); } else if (INTERNAL_START_POSITION_KEY.equals(property) || INTERNAL_END_POSITION_KEY.equals(property)) { int value = variantObject.getIntValue(property, -1); if (value == -1) { return null; } return Integer.toString(value); } else { BaseStringProperty field = (BaseStringProperty) variantObject.getField(property); if (field == null) { return null; } return field.getValue(); } }
@Override public Object doInHibernate(Session session) throws HibernateException, XWikiException { Query q = session.createQuery("select p from " + StringListProperty.class.getName() + " as p, BaseObject as o" + " where o.className='PhenoTips.StudyClass' and p.id=o.id"); @SuppressWarnings("unchecked") List<StringListProperty> wrongProperties = q.list(); this.logger.debug("Found {} study properties of type StringListProperty", wrongProperties.size()); for (StringListProperty oldValue : wrongProperties) { DBStringListProperty newValue = new DBStringListProperty(); newValue.setId(oldValue.getId()); newValue.setName(oldValue.getName()); newValue.setValue(oldValue.getList()); session.delete(oldValue); session.save(newValue); } return null; } }
@Override public Object doInHibernate(Session session) throws HibernateException, XWikiException { Query q = session.createQuery("select p from " + StringListProperty.class.getName() + " as p, BaseObject as o" + " where o.className='PhenoTips.StudyClass' and p.id=o.id"); @SuppressWarnings("unchecked") List<StringListProperty> wrongProperties = q.list(); this.logger.debug("Found {} study properties of type StringListProperty", wrongProperties.size()); for (StringListProperty oldValue : wrongProperties) { DBStringListProperty newValue = new DBStringListProperty(); newValue.setId(oldValue.getId()); newValue.setName(oldValue.getName()); newValue.setValue(oldValue.getList()); session.delete(oldValue); session.save(newValue); } return null; } }
private String getFieldValue(BaseObject geneObject, String property) { if (INTERNAL_STRATEGY_KEY.equals(property)) { StringListProperty fields = (StringListProperty) geneObject.getField(property); if (fields == null || fields.getList().size() == 0) { return null; } return fields.getTextValue(); } else { BaseStringProperty field = (BaseStringProperty) geneObject.getField(property); if (field == null) { return null; } return field.getValue(); } }
@Override public Object doInHibernate(Session session) throws HibernateException, XWikiException { Query q = session.createQuery("select p from " + StringListProperty.class.getName() + " as p, BaseObject as o" + " where o.className=? and p.id=o.id and p.name=?"); q.setString(0, this.propertyClass.getObject().getName()).setString(1, this.propertyClass.getName()); @SuppressWarnings("unchecked") List<StringListProperty> wrongProperties = q.list(); for (StringListProperty oldValue : wrongProperties) { DBStringListProperty newValue = (DBStringListProperty) this.propertyClass.newProperty(); newValue.setId(oldValue.getId()); newValue.setName(oldValue.getName()); newValue.setValue(oldValue.getList()); session.delete(oldValue); session.save(newValue); } return null; } }
@Override public Object doInHibernate(Session session) throws HibernateException, XWikiException { Query q = session.createQuery("select p from " + StringListProperty.class.getName() + " as p, BaseObject as o" + " where o.className=? and p.id=o.id and p.name=?"); q.setString(0, this.propertyClass.getObject().getName()).setString(1, this.propertyClass.getName()); @SuppressWarnings("unchecked") List<StringListProperty> wrongProperties = q.list(); for (StringListProperty oldValue : wrongProperties) { DBStringListProperty newValue = (DBStringListProperty) this.propertyClass.newProperty(); newValue.setId(oldValue.getId()); newValue.setName(oldValue.getName()); newValue.setValue(oldValue.getList()); session.delete(oldValue); session.save(newValue); } return null; } }
List<String> internalListValue = ((StringListProperty) deletedProperty).getList(); if (internalListValue.size() != 0) { deletedPropertyValue = internalListValue.get(0);