Commit df247a29 authored by Olivier Langella's avatar Olivier Langella
Browse files

git-svn-id: https://subversion.renater.fr/masschroq/trunk@2074 e4b6dbb4-9209-464b-83f7-6257456c460c
parent 362a2d3b
package fr.inra.pappso.masschroq.convert.ods;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.apache.log4j.Logger;
import org.odftoolkit.odfdom.doc.OdfDocument;
import org.odftoolkit.odfdom.doc.OdfSpreadsheetDocument;
import org.odftoolkit.odfdom.doc.table.OdfTable;
import org.odftoolkit.odfdom.dom.element.table.TableTableCellElement;
import org.odftoolkit.odfdom.dom.element.table.TableTableElement;
import org.odftoolkit.odfdom.dom.element.table.TableTableRowElement;
import fr.inra.pappso.masschroq.entities.MsRun.MsRun;
import fr.inra.pappso.masschroq.entities.MsRun.MsRunSet;
import fr.inra.pappso.masschroq.entities.Quantify.Quantify;
import fr.inra.pappso.masschroq.entities.Quantify.QuantifySet;
import fr.inra.pappso.masschroq.entities.SearchItemQuantification.SearchItemQuantification;
import fr.inra.pappso.masschroq.entities.SearchItemQuantification.SearchItemQuantificationValueBase;
import fr.inra.pappso.masschroq.entities.searchItems.SearchItemBase;
import fr.inra.pappso.masschroq.entities.searchItems.SearchItemMz;
import fr.inra.pappso.masschroq.entities.searchItems.SearchItemMzRt;
import fr.inra.pappso.masschroq.entities.searchItems.SearchItemPeptide;
import fr.inra.pappso.masschroq.utils.data.ShortFormMassChroQmlReader;
public class OdsDoc {
......@@ -30,22 +13,30 @@ public class OdsDoc {
OdfSpreadsheetDocument odfdoc;
public OdsDoc(ShortFormMassChroQmlReader reader) throws Exception {
this.odfdoc = OdfSpreadsheetDocument.newSpreadsheetDocument();
//List<OdfTable> tr = odfdoc.getTableList();
// List<OdfTable> tr = odfdoc.getTableList();
QuantifySet quantifySet = reader.getQuantifySet();
for (Quantify quantify:quantifySet) {
for (Quantify quantify : quantifySet) {
writeQuantify(quantify);
}
}
private void writeQuantify(Quantify quantify) throws Exception {
logger.debug("writeQuantify");
new SearchItemPeptideTable(this, quantify);
if (quantify.hasSearchItemPeptide()) {
new SearchItemPeptideTable(this, quantify);
}
if (quantify.hasSearchItemMz()) {
//new SearchItemMzTable(this, quantify);
}
if (quantify.hasSearchItemMzRt()) {
//new SearchItemMzRtTable(this, quantify);
}
}
public OdfSpreadsheetDocument getOdfSpreadsheetDocument() {
......
......@@ -6,6 +6,10 @@ import fr.inra.pappso.masschroq.entities.Group.Group;
import fr.inra.pappso.masschroq.entities.MsRun.MsRunSet;
import fr.inra.pappso.masschroq.entities.QuantificationMethod.QuantificationMethod;
import fr.inra.pappso.masschroq.entities.SearchItemQuantification.SearchItemQuantificationSet;
import fr.inra.pappso.masschroq.entities.searchItems.SearchItemBase;
import fr.inra.pappso.masschroq.entities.searchItems.SearchItemMz;
import fr.inra.pappso.masschroq.entities.searchItems.SearchItemMzRt;
import fr.inra.pappso.masschroq.entities.searchItems.SearchItemPeptide;
import fr.inra.pappso.masschroq.entities.searchItems.SearchItemSet;
public class Quantify {
......@@ -13,11 +17,11 @@ public class Quantify {
private String xmlId;
Group group;
QuantificationMethod method;
SearchItemSet searchItemSet= new SearchItemSet();
SearchItemQuantificationSet searchItemQuantificationSet= new SearchItemQuantificationSet();
SearchItemSet searchItemSet = new SearchItemSet();
SearchItemQuantificationSet searchItemQuantificationSet = new SearchItemQuantificationSet();
public Quantify(String xmlId, Group group, QuantificationMethod method) throws Exception {
public Quantify(String xmlId, Group group, QuantificationMethod method)
throws Exception {
if (xmlId == null) {
throw new Exception("xmlId is null");
}
......@@ -32,10 +36,12 @@ public class Quantify {
this.group = group;
this.method = method;
}
@Override
public int hashCode() {
return xmlId.hashCode();
}
@Override
public boolean equals(Object aThat) {
if (this.hashCode() == aThat.hashCode()) {
......@@ -47,6 +53,7 @@ public class Quantify {
public SearchItemSet getSearchItemSet() {
return searchItemSet;
}
public SearchItemQuantificationSet getSearchItemQuantificationSet() {
return searchItemQuantificationSet;
}
......@@ -61,4 +68,29 @@ public class Quantify {
public String getXmlId() {
return this.xmlId;
}
public boolean hasSearchItemPeptide() {
for (SearchItemBase search : searchItemSet) {
if (search.getClass().equals(SearchItemPeptide.class)) {
return true;
}
}
return false;
}
public boolean hasSearchItemMz() {
for (SearchItemBase search : searchItemSet) {
if (search.getClass().equals(SearchItemMz.class)) {
return true;
}
}
return false;
}
public boolean hasSearchItemMzRt() {
for (SearchItemBase search : searchItemSet) {
if (search.getClass().equals(SearchItemMzRt.class)) {
return true;
}
}
return false;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment