private String getXMLFragmentFrom(YAttribute attribute){ if(attribute == null){ return null; } YRichText yrichText = attribute.getRichValue(); final String result = YRTHelper.toXmlFragment(yrichText, ""); return result; }
private String getXMLFragmentFrom(YAttribute referanceText) { if(referanceText == null){ return ""; } else { YRichText yrichText = referanceText.getRichValue(); final String result = YRTHelper.toXmlFragment(yrichText, ""); return result; } }
private Object getAttributeValue(YAttribute attribute){ if(attribute.getAttributes() == null || attribute.getAttributes().isEmpty()){ YRichText richText = attribute.getRichValue(); Object richTextObject = converter.convertToMongoType(richText); return richTextObject; } else { DBObject attributeValue = (DBObject) converter.convertToMongoType(attribute, ClassTypeInformation.from(attribute.getClass())); attributeValue.removeField("key"); return attributeValue; } }
private static YElement putRelationReferenceToLeafsIntoNodes(YElement yelement) { for(YRelation yr : yelement.getRelations()){ for(YAttribute ya : yr.getAttributes()){ if(! ll.contains(ya.getKey()))continue; removeGivenTag("sc", ya.getRichValue().toParts()); ya.setValue(new YRichText(extractLeafs(removeNodeWithGivenTag("ext-link", ya.getRichValue().toParts())))); } } return yelement; }
private static YElement putRelationReferenceToLeafsIntoNodes(YElement yelement) { for(YRelation yr : yelement.getRelations()){ // LinkedList<YAttribute> lya = new LinkedList<YAttribute>(); for(YAttribute ya : yr.getAttributes()){ if(! ll.contains(ya.getKey()))continue; removeGivenTag("sc", ya.getRichValue().toParts()); ya.setValue(new YRichText(extractLeafs(removeNodeWithGivenTag("ext-link", ya.getRichValue().toParts())))); // lya.add(ya); } // if(lya.size()>0)yr.setAttributes(lya); } return yelement; }
private static YAttribute extractOneReferenceTextAttributeScNode(YAttribute ya) { if(! ll.contains(ya.getKey())) return ya; for(Part p:ya.getRichValue().toParts()){ if(p instanceof Node){ if("sc".equals(((Node)p).getTag())) return new YAttribute(ya.getKey(),new YRichText(((Node)p).getParts().get(0).toString())); }else if(p instanceof Leaf) return new YAttribute(ya.getKey(),new YRichText(((Leaf)p).toPlainText())); } return ya; }
private static YAttribute extractOneReferenceTextAttributeScNode(YAttribute ya) { if(! ll.contains(ya.getKey())) return ya; for(Part p:ya.getRichValue().toParts()){ if(p instanceof Node){ if("sc".equals(((Node)p).getTag())) return new YAttribute(ya.getKey(),new YRichText(((Node)p).getParts().get(0).toString())); }else if(p instanceof Leaf) // if(p.toPlainText()!=null && !p.toPlainText().matches("[\\s]+")) return new YAttribute(ya.getKey(),new YRichText(((Leaf)p).toPlainText())); } return ya; } }
YAttribute title = relation.getOneAttribute(ReferenceAttributeTypes.AT_REFERENCE_PARSED_TITLE); if (title != null) { parts.addAll(title.getRichValue().toParts()); parts.add(new YRichText.Leaf(", "));