List of usage examples for org.jdom2 Element getValue
@Override
public String getValue()
From source file:model.data.user.Conversations.java
License:Open Source License
@Override protected boolean handleElement(Element e) { if (e.getName().equals("cypher")) { cypher = e.getValue(); return true; }//from ww w .j a va2 s . c o m if (e.getName().equals("owner")) { owner = e.getValue(); return true; } return false; }
From source file:model.data.user.UserMessage.java
License:Open Source License
@Override protected boolean handleElement(Element e) { switch (e.getName()) { case "content": message = e.getValue(); return true; case "receiverKey": receiver = new AsymKeysImpl(e.getValue()); return true; case "date": date = new Long(e.getValue()); return true; case "subject": subject = e.getValue();//from ww w . jav a 2s.c o m return true; case "senderName": senderName = e.getValue(); return true; case "encrypted": encrypted = (e.getValue().equals("true")) ? true : false; return true; case "read": read = Boolean.parseBoolean(e.getValue()); return true; } return false; }
From source file:model.network.communication.service.sigma.sigmaProtocol.Masks.java
License:Open Source License
public Masks(Element root) { for (Element e : root.getChildren()) { if (e.getName().equals("a")) { this.a = new BigInteger(e.getValue(), 16); } else if (e.getName().equals("aBis")) { this.aBis = new BigInteger(e.getValue(), 16); }/* w w w . j a va 2 s .c om*/ } }
From source file:model.network.communication.service.sigma.sigmaProtocol.ResEncrypt.java
License:Open Source License
@Override protected boolean handleElement(Element e) { switch (e.getName()) { case "u": setU(new BigInteger(e.getValue(), 16)); return true; case "v": setV(new BigInteger(e.getValue(), 16)); return true; case "M": setM(e.getValue().getBytes());/*from www .j a v a 2s . c o m*/ return true; default: return false; } }
From source file:model.network.communication.service.sigma.sigmaProtocol.Responses.java
License:Open Source License
@Override protected boolean handleElement(Element e) { switch (e.getName()) { case "masks": masks = new Masks(e.getValue()); return true; case "challenge": challenge = new BigInteger(e.getValue(), 16); return true; case "response": response = new BigInteger(e.getValue(), 16); return true; default://w ww .j a v a2 s. c om return false; } }
From source file:model.network.communication.service.update.UpdateMessage.java
License:Open Source License
private String getKeysToUpdateXML() { StringBuffer s = new StringBuffer(); for (Element e : keysToUpdate.getChildren()) { s.append("<" + e.getName() + ">" + e.getValue() + "</" + e.getName() + ">"); }// w w w . java 2 s . c o m return s.toString(); }
From source file:model.network.communication.service.update.UpdateMessage.java
License:Open Source License
@Override protected boolean handleElement(Element e) { switch (e.getName()) { case "newSignature": newSignature = new ElGamalSign(e.getValue()); return true; case "id": id = e.getValue();/*from ww w. ja va 2 s . c om*/ return true; case "type": type = e.getValue(); return true; case "keysToUpdate": setKeysToUpdate(e.getValue()); case "keys": keys = new AsymKeysImpl(e.getValue()); return true; default: return false; } }
From source file:msk.drugbank4.DrugBankParser.java
License:Apache License
/** * return a set of drugs//from ww w.ja v a 2s . c om * DrugModel contains also the list of targets */ public Set<DrugModel> parse(File drugBankXml) throws JDOMException, IOException { SAXBuilder builder = new SAXBuilder(); Document document = (Document) builder.build(drugBankXml); Element rootNode = document.getRootElement(); Set<DrugModel> drugs = new HashSet<DrugModel>(); List<Element> list = rootNode.getChildren("drug", nsDrugBank); for (Element drug : list) { DrugModel model = new DrugModel(); Element id = drug.getChild("drugbank-id", nsDrugBank); model.setDrugbankID(id.getValue()); Element name = drug.getChild("name", nsDrugBank); model.setName(name.getValue()); Element cas = drug.getChild("cas-number", nsDrugBank); model.setCasNumber(cas.getValue()); model.setInChiKey(getInchiKey(drug)); model.getGroups().addAll(getGroups(drug)); model.getCategories().addAll(getCategories(drug)); model.getTargets().addAll(getTargets(drug)); drugs.add(model); } return drugs; }
From source file:msk.drugbank4.DrugBankParser.java
License:Apache License
/** * reads targets for current drug/*w w w . j ava 2 s. c o m*/ */ private Set<TargetModel> getTargets(Element drug) { Set<TargetModel> set = new HashSet<TargetModel>(); Element targets = drug.getChild("targets", nsDrugBank); if (targets != null) { List<Element> targetList = targets.getChildren("target", nsDrugBank); for (Element target : targetList) { TargetModel targetModel = new TargetModel(); Element targetId = target.getChild("id", nsDrugBank); targetModel.setDrugbankId(targetId.getValue()); Element targetName = target.getChild("name", nsDrugBank); targetModel.setName(targetName.getValue()); Element targetOrganism = target.getChild("organism", nsDrugBank); targetModel.setOrganism(targetOrganism.getValue()); Element polypeptide = target.getChild("polypeptide", nsDrugBank); if (polypeptide != null) { Element polypeptideGeneName = polypeptide.getChild("gene-name", nsDrugBank); targetModel.setGeneName(polypeptideGeneName.getValue()); Element xrefs = polypeptide.getChild("external-identifiers", nsDrugBank); List<Element> xrefList = xrefs.getChildren("external-identifier", nsDrugBank); for (Element xref : xrefList) { Element res = xref.getChild("resource", nsDrugBank); if (res.getValue().equals("UniProtKB")) { Element uniprot = xref.getChild("identifier", nsDrugBank); targetModel.setUniprotId(uniprot.getValue()); } } } set.add(targetModel); } } return set; }
From source file:msk.drugbank4.DrugBankParser.java
License:Apache License
/** * reads categories for current drug/*from w ww.j a v a2s . c om*/ */ private Set<String> getCategories(Element drug) { Set<String> set = new HashSet<String>(); Element categories = drug.getChild("categories", nsDrugBank); if (categories != null) { List<Element> categoryList = categories.getChildren("category", nsDrugBank); for (Element category : categoryList) { Element cat = category.getChild("category", nsDrugBank); set.add(cat.getValue()); } } return set; }