/** * <p>toXMLNode.</p> * * @return a {@link net.anotheria.util.xml.XMLNode} object. */ public XMLNode toXMLNode(){ return new XMLNode("NotImplemented "+getId()); }
private XMLNode getChildNode(String name, String text){ XMLNode ret = new XMLNode(name); ret.setContent(text); return ret; }
/** {@inheritDoc} */ @Override public XMLNode toXMLNode(){ return new XMLNode("NotImplemented "+getId()); }
/** {@inheritDoc} */ @Override public XMLNode toXMLNode(){ XMLNode root = new XMLNode("document"); root.addAttribute(new XMLAttribute("documentId", getId())); for (Iterator<DataHolder> it = dataStorage.values().iterator(); it.hasNext();) root.addChildNode(it.next().toXMLNode()); return root; }
/** * <p>toXMLNode.</p> * * @return a {@link net.anotheria.util.xml.XMLNode} object. */ public XMLNode toXMLNode(){ XMLNode e = new XMLNode("dataholder"); e.addAttribute( new XMLAttribute("id", getId())); return e; }
/** * <p>createXMLNodeForListValue.</p> * * @param name a {@link java.lang.String} object. * @param contentType a {@link java.lang.String} object. * @param content a {@link java.util.List} object. * @param <T> a T object. * @return a {@link net.anotheria.util.xml.XMLNode} object. */ public static <T> XMLNode createXMLNodeForListValue(String name, String contentType, List<T> content){ XMLNode ret = new XMLNode(name); XMLNode val = new XMLNode("value"); ret.addChildNode(val); val.addAttribute(new XMLAttribute("type", "list")); val.addAttribute(new XMLAttribute("contentType", contentType)); for(Object c:content){ XMLNode el = new XMLNode("element"); val.addChildNode(el); el.setContent(""+c); } return ret; }
XMLNode root = new XMLNode("mappings"); XMLNode aliases = new XMLNode("aliases"); ActionMappings actionMappings = MAFExecutionContext.currentExecutionContext().getMappings(); Map<String,String> aliasesMap = actionMappings.getAliases(); for (Map.Entry<String, String> e : aliasesMap.entrySet()){ XMLNode a = new XMLNode("alias"); a.addAttribute(new XMLAttribute("source", e.getKey())); a.addAttribute(new XMLAttribute("target", e.getValue())); XMLNode mappings = new XMLNode("actions"); Map<String,ActionMapping> mappingsMap = actionMappings.getMappings(); for (Map.Entry<String, ActionMapping> e : mappingsMap.entrySet()){ XMLNode m = new XMLNode("action"); m.addAttribute(new XMLAttribute("path", e.getValue().getPath())); m.addAttribute(new XMLAttribute("type", e.getValue().getType())); Map<String, ActionCommand> commands = e.getValue().getCommands(); for (Map.Entry<String,ActionCommand> c : commands.entrySet()){ XMLNode command = new XMLNode("command"); command.addAttribute(new XMLAttribute("type", c.getValue().getClass().getSimpleName())); command.setContent(c.getValue().toString());
private static XMLNode createXMLNodeWithContent(String name, String[] languages, String type, Object... value){ XMLNode ret = new XMLNode(name); if (languages==null){ XMLNode val = new XMLNode("value"); if (type!=null) val.addAttribute(new XMLAttribute("type", type)); ret.addChildNode(val); if (value!=null) val.setContent(""+value[0]); }else{ for (int i=0; i<languages.length; i++){ String l = languages[i]; XMLNode val = new XMLNode("value"); if (type!=null) val.addAttribute(new XMLAttribute("type", type)); val.addAttribute(new XMLAttribute("language", l)); if (value!=null){ Object valueToSet = value[i]!=null?value[i]:""; val.setContent("" + valueToSet); } ret.addChildNode(val); } } return ret; }
private static XMLNode createXMLNodeWithAttribute(String name, String[] languages, String type, Object... value){ XMLNode ret = new XMLNode(name); if (languages==null){ XMLNode val = new XMLNode("value"); if (type!=null) val.addAttribute(new XMLAttribute("type", type)); ret.addChildNode(val); if (value!=null) val.addAttribute(new XMLAttribute("value", ""+value[0])); }else{ for (int i=0; i<languages.length; i++){ String l = languages[i]; System.out.println(l+" -> "+value[i]); XMLNode val = new XMLNode("value"); if (type!=null) val.addAttribute(new XMLAttribute("type", type)); val.addAttribute(new XMLAttribute("language", l)); if (value!=null) val.addAttribute(new XMLAttribute("value", ""+value[i])); ret.addChildNode(val); } } return ret; }
/** {@inheritDoc} */ @Override public XMLNode toXMLNode(){ XMLNode root = new XMLNode("documentlist"); root.addAttribute(new XMLAttribute("listId", getId())); for (D d : list){ root.addChildNode(d.toXMLNode()); } return root; }
/** * Creates an xml node for export. * * @return new XMLNode object */ public XMLNode toXMLNode(){ XMLNode ret = new XMLNode("property"); ret.addAttribute(new XMLAttribute("name", getName())); ret.addAttribute(new XMLAttribute("type", getPropertyType().toString())); ret.setContent(""+getValue()); return ret; }
/** * Creates an XMLNode for XML export. * * @return a {@link net.anotheria.util.xml.XMLNode} object. */ public XMLNode toXMLNode(){ XMLNode root = new XMLNode("module"); root.addAttribute(new XMLAttribute("moduleId", getId())); root.addAttribute(new XMLAttribute("copyId", getCopyId())); root.addAttribute(new XMLAttribute("ownerId", getOwnerId())); root.addAttribute(new XMLAttribute("size", ""+getSizeInBytes())); Collection<DataHolder> myDataHolders = holders.values(); for (DataHolder dh : myDataHolders){ root.addChildNode(dh.toXMLNode()); } return root; }
/** * Creates the XMLNode for xml representation of this object info. * * @return created XMLNode */ public XMLNode toXML(){ XMLNode ret = new XMLNode("objectinfo"); ret.addAttribute(new XMLAttribute("id",getId())); ret.addChildNode(getChildNode("id", getId())); ret.addChildNode(getChildNode("type", getType())); ret.addChildNode(getChildNode("timestamp", ""+getLastChangeTimestamp())); ret.addChildNode(getChildNode("iso8601timestamp", NumberUtils.makeISO8601TimestampString(getLastChangeTimestamp()))); ret.addChildNode(getChildNode("footprint", getFootprint())); return ret; }