Skip to content

Commit

Permalink
Read the AnIML audit trail.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mailaender committed Feb 22, 2024
1 parent f45825f commit beba80a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public IChromatogramCSD read(File file, IProgressMonitor monitor) throws IOExcep
AnIMLType animl = XmlReader.getAnIML(file);
chromatogram = new VendorChromatogram();
chromatogram.setFile(file);
chromatogram.getEditHistory().addAll(XmlReader.readAuditTrail(animl));
chromatogram = readSample(animl, chromatogram);
List<Float> retentionTimes = new ArrayList<>();
List<Float> signals = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public IChromatogramMSD read(File file, IProgressMonitor monitor) throws IOExcep
chromatogram = new VendorChromatogram();
chromatogram.setFile(file);
chromatogram = readSample(animl, chromatogram);
chromatogram.getEditHistory().addAll(XmlReader.readAuditTrail(animl));
List<Integer> retentionTimes = new ArrayList<>();
List<Float> signals = new ArrayList<>();
Double[] mzs = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public IChromatogramWSD read(File file, IProgressMonitor monitor) throws IOExcep
chromatogram = new VendorChromatogram();
chromatogram.setFile(file);
AnIMLType animl = XmlReader.getAnIML(file);
chromatogram.getEditHistory().addAll(XmlReader.readAuditTrail(animl));
chromatogram = readSample(animl, chromatogram);
for(ExperimentStepType experimentStep : animl.getExperimentStepSet().getExperimentStep()) {
TechniqueType technique = experimentStep.getTechnique();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,23 @@

import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.Date;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.eclipse.chemclipse.support.history.EditHistory;
import org.eclipse.chemclipse.support.history.EditInformation;
import org.eclipse.chemclipse.support.history.IEditHistory;
import org.eclipse.chemclipse.support.history.IEditInformation;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

import net.openchrom.xxd.converter.supplier.animl.model.astm.core.AnIMLType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.AuditTrailEntryType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.ObjectFactory;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.UnitType;

Expand Down Expand Up @@ -58,4 +65,18 @@ public static int getTimeMultiplicator(UnitType unit) {
}
return multiplicator;
}

public static Collection<IEditInformation> readAuditTrail(AnIMLType animl) {

IEditHistory editHistory = new EditHistory();
for(AuditTrailEntryType entry : animl.getAuditTrailEntrySet().getAuditTrailEntry()) {
Date date = entry.getTimestamp().toGregorianCalendar().getTime();
String description = entry.getAction().value();
if(entry.getReason() != null && !entry.getReason().isEmpty()) {
description += ", " + entry.getReason();
}
editHistory.add(new EditInformation(date, description, entry.getAuthor().getName()));
}
return editHistory;
}
}

0 comments on commit beba80a

Please sign in to comment.