Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve AnIML HPLC-DAD standard conformity #454

Merged
merged 4 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2014, 2023 Lablicate GmbH.
* Copyright (c) 2014, 2024 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -24,7 +24,7 @@
import org.eclipse.core.runtime.IProgressMonitor;

import net.openchrom.csd.converter.supplier.animl.io.ChromatogramWriter;
import net.openchrom.xxd.converter.supplier.animl.internal.converter.IConstants;
import net.openchrom.xxd.converter.supplier.animl.l10n.Messages;

public class ChromatogramExportConverter extends AbstractChromatogramExportConverter implements IChromatogramExportConverter {

Expand All @@ -39,7 +39,7 @@ public IProcessingInfo<File> convert(File file, IChromatogram<? extends IPeak> c
* Don't process if errors have occurred.
*/
if(!processingInfo.hasErrorMessages() && chromatogram instanceof IChromatogramCSD chromatogramCSD) {
monitor.subTask(IConstants.EXPORT_CHROMATOGRAM);
monitor.subTask(Messages.exportChromatogram);
IChromatogramCSDWriter writer = new ChromatogramWriter();
try {
writer.writeChromatogram(file, chromatogramCSD, monitor);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2021 Lablicate GmbH.
* Copyright (c) 2008, 2024 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -13,6 +13,7 @@
package net.openchrom.csd.converter.supplier.animl.converter;

import java.io.File;
import java.io.IOException;

import org.eclipse.chemclipse.converter.chromatogram.AbstractChromatogramImportConverter;
import org.eclipse.chemclipse.csd.converter.io.IChromatogramCSDReader;
Expand All @@ -23,7 +24,7 @@
import org.eclipse.core.runtime.IProgressMonitor;

import net.openchrom.csd.converter.supplier.animl.io.ChromatogramReader;
import net.openchrom.xxd.converter.supplier.animl.internal.converter.IConstants;
import net.openchrom.xxd.converter.supplier.animl.l10n.Messages;

public class ChromatogramImportConverter extends AbstractChromatogramImportConverter<IChromatogramCSD> {

Expand All @@ -39,13 +40,13 @@ public IProcessingInfo<IChromatogramCSD> convert(File file, IProgressMonitor mon
* Read the chromatogram.
*/
IChromatogramCSDReader reader = new ChromatogramReader();
monitor.subTask(IConstants.IMPORT_CHROMATOGRAM);
monitor.subTask(Messages.importChromatogram);
try {
IChromatogramCSD chromatogram = reader.read(file, monitor);
processingInfo.setProcessingResult(chromatogram);
} catch(Exception e) {
} catch(IOException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, "Something has definitely gone wrong with the file: " + file.getAbsolutePath());
processingInfo.addErrorMessage(DESCRIPTION, "Failed to read file: " + file.getAbsolutePath());
}
}
return processingInfo;
Expand All @@ -60,9 +61,9 @@ public IProcessingInfo<IChromatogramOverview> convertOverview(File file, IProgre
try {
IChromatogramOverview chromatogramOverview = reader.readOverview(file, monitor);
processingInfo.setProcessingResult(chromatogramOverview);
} catch(Exception e) {
} catch(IOException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, "Something has definitely gone wrong with the file: " + file.getAbsolutePath());
processingInfo.addErrorMessage(DESCRIPTION, "Failed to read file: " + file.getAbsolutePath());
}
}
return processingInfo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021, 2023 Lablicate GmbH.
* Copyright (c) 2021, 2024 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand All @@ -22,7 +22,8 @@
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

import net.openchrom.xxd.converter.supplier.animl.internal.converter.IConstants;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.AnIMLType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.TechniqueType;

public class FileContentMatcher extends AbstractFileContentMatcher implements IFileContentMatcher {

Expand All @@ -34,11 +35,11 @@ public boolean checkFileFormat(File file) {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = documentBuilder.parse(file);
NodeList root = document.getElementsByTagName(IConstants.NODE_ANIML);
NodeList root = document.getElementsByTagName(AnIMLType.NODE_NAME);
if(root.getLength() != 1) {
return isValidFormat;
}
NodeList techniquesList = document.getElementsByTagName(IConstants.NODE_TECHNIQUE);
NodeList techniquesList = document.getElementsByTagName(TechniqueType.NODE_NAME);
int techniques = techniquesList.getLength();
for(int t = 0; t < techniques; t++) {
Element element = (Element)techniquesList.item(t);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021, 2023 Lablicate GmbH.
* Copyright (c) 2021, 2024 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -40,19 +40,19 @@
import net.openchrom.csd.converter.supplier.animl.model.IVendorChromatogram;
import net.openchrom.csd.converter.supplier.animl.model.VendorChromatogram;
import net.openchrom.csd.converter.supplier.animl.model.VendorScan;
import net.openchrom.xxd.converter.supplier.animl.internal.converter.BinaryReader;
import net.openchrom.xxd.converter.supplier.animl.internal.converter.XmlReader;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.AnIMLType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.AuthorType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.EncodedValueSetType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.ExperimentStepType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.IndividualValueSetType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.MethodType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.ResultType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.SampleType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.SeriesSetType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.SeriesType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.UnitType;
import net.openchrom.xxd.converter.supplier.animl.converter.BinaryReader;
import net.openchrom.xxd.converter.supplier.animl.converter.XmlReader;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.AnIMLType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.AuthorType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.EncodedValueSetType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.ExperimentStepType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.IndividualValueSetType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.MethodType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.ResultType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.SampleType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.SeriesSetType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.SeriesType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.UnitType;

import jakarta.xml.bind.JAXBException;

Expand Down Expand Up @@ -205,4 +205,4 @@ private IVendorChromatogram readSample(AnIMLType animl, IVendorChromatogram chro
chromatogram.setMiscInfo(sample.getComment());
return chromatogram;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021, 2023 Lablicate GmbH.
* Copyright (c) 2021, 2024 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -27,28 +27,28 @@
import org.eclipse.chemclipse.support.history.IEditInformation;
import org.eclipse.core.runtime.IProgressMonitor;

import net.openchrom.xxd.converter.supplier.animl.internal.converter.BinaryReader;
import net.openchrom.xxd.converter.supplier.animl.internal.converter.Common;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.AnIMLType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.AuditTrailEntrySetType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.AuditTrailEntryType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.AuthorType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.DependencyType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.EncodedValueSetType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.ExperimentStepSetType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.ExperimentStepType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.IndividualValueSetType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.MethodType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.ObjectFactory;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.ParameterTypeType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.PlotScaleType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.ResultType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.SampleSetType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.SampleType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.SeriesSetType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.SeriesType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.TechniqueType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.UnitType;
import net.openchrom.xxd.converter.supplier.animl.converter.BinaryReader;
import net.openchrom.xxd.converter.supplier.animl.converter.Common;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.AnIMLType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.AuditTrailEntrySetType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.AuditTrailEntryType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.AuthorType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.DependencyType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.EncodedValueSetType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.ExperimentStepSetType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.ExperimentStepType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.IndividualValueSetType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.MethodType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.ObjectFactory;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.ParameterTypeType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.PlotScaleType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.ResultType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.SampleSetType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.SampleType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.SeriesSetType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.SeriesType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.TechniqueType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.UnitType;
import net.openchrom.xxd.converter.supplier.animl.preferences.PreferenceSupplier;

import jakarta.xml.bind.JAXBContext;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2014, 2023 Lablicate GmbH.
* Copyright (c) 2014, 2024 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -26,7 +26,7 @@
import org.eclipse.core.runtime.IProgressMonitor;

import net.openchrom.msd.converter.supplier.animl.io.ChromatogramWriter;
import net.openchrom.xxd.converter.supplier.animl.internal.converter.IConstants;
import net.openchrom.xxd.converter.supplier.animl.l10n.Messages;

public class ChromatogramExportConverter extends AbstractChromatogramExportConverter implements IChromatogramExportConverter {

Expand All @@ -41,7 +41,7 @@ public IProcessingInfo<File> convert(File file, IChromatogram<? extends IPeak> c
* Don't process if errors have occurred.
*/
if(!processingInfo.hasErrorMessages() && chromatogram instanceof IChromatogramMSD chromatogramMSD) {
monitor.subTask(IConstants.EXPORT_CHROMATOGRAM);
monitor.subTask(Messages.exportChromatogram);
IChromatogramMSDWriter writer = new ChromatogramWriter();
try {
writer.writeChromatogram(file, chromatogramMSD, monitor);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021, 2023 Lablicate GmbH.
* Copyright (c) 2021, 2024 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand All @@ -22,7 +22,8 @@
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

import net.openchrom.xxd.converter.supplier.animl.internal.converter.IConstants;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.AnIMLType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.TechniqueType;

public class ChromatogramFileContentMatcher extends AbstractFileContentMatcher implements IFileContentMatcher {

Expand All @@ -34,11 +35,11 @@ public boolean checkFileFormat(File file) {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = documentBuilder.parse(file);
NodeList root = document.getElementsByTagName(IConstants.NODE_ANIML);
NodeList root = document.getElementsByTagName(AnIMLType.NODE_NAME);
if(root.getLength() != 1) {
return isValidFormat;
}
NodeList techniquesList = document.getElementsByTagName(IConstants.NODE_TECHNIQUE);
NodeList techniquesList = document.getElementsByTagName(TechniqueType.NODE_NAME);
int techniques = techniquesList.getLength();
for(int t = 0; t < techniques; t++) {
Element element = (Element)techniquesList.item(t);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2023 Lablicate GmbH.
* Copyright (c) 2008, 2024 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -24,7 +24,7 @@
import org.eclipse.core.runtime.IProgressMonitor;

import net.openchrom.msd.converter.supplier.animl.io.ChromatogramReader;
import net.openchrom.xxd.converter.supplier.animl.internal.converter.IConstants;
import net.openchrom.xxd.converter.supplier.animl.l10n.Messages;

public class ChromatogramImportConverter extends AbstractChromatogramImportConverter<IChromatogramMSD> {

Expand All @@ -40,13 +40,13 @@ public IProcessingInfo<IChromatogramMSD> convert(File file, IProgressMonitor mon
* Read the chromatogram.
*/
IChromatogramMSDReader reader = new ChromatogramReader();
monitor.subTask(IConstants.IMPORT_CHROMATOGRAM);
monitor.subTask(Messages.importChromatogram);
try {
IChromatogramMSD chromatogram = reader.read(file, monitor);
processingInfo.setProcessingResult(chromatogram);
} catch(IOException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, "Failed to read file: " + file.getAbsolutePath());
processingInfo.addErrorMessage(DESCRIPTION, "Failed to read file: " + file.getAbsolutePath(), e);
} catch(InterruptedException e) {
logger.warn(e);
Thread.currentThread().interrupt();
Expand All @@ -64,9 +64,9 @@ public IProcessingInfo<IChromatogramOverview> convertOverview(File file, IProgre
try {
IChromatogramOverview chromatogramOverview = reader.readOverview(file, monitor);
processingInfo.setProcessingResult(chromatogramOverview);
} catch(Exception e) {
} catch(IOException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, "Something has definitely gone wrong with the file: " + file.getAbsolutePath());
processingInfo.addErrorMessage(DESCRIPTION, "Failed to read file: " + file.getAbsolutePath());
}
}
return processingInfo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016, 2023 Lablicate GmbH.
* Copyright (c) 2016, 2024 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand All @@ -22,7 +22,8 @@
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

import net.openchrom.xxd.converter.supplier.animl.internal.converter.IConstants;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.AnIMLType;
import net.openchrom.xxd.converter.supplier.animl.model.astm.core.TechniqueType;

public class MassSpectrumFileContentMatcher extends AbstractFileContentMatcher implements IFileContentMatcher {

Expand All @@ -34,11 +35,11 @@ public boolean checkFileFormat(File file) {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = documentBuilder.parse(file);
NodeList root = document.getElementsByTagName(IConstants.NODE_ANIML);
NodeList root = document.getElementsByTagName(AnIMLType.NODE_NAME);
if(root.getLength() != 1) {
return isValidFormat;
}
NodeList techniquesList = document.getElementsByTagName(IConstants.NODE_TECHNIQUE);
NodeList techniquesList = document.getElementsByTagName(TechniqueType.NODE_NAME);
int techniques = techniquesList.getLength();
for(int t = 0; t < techniques; t++) {
Element element = (Element)techniquesList.item(t);
Expand Down
Loading
Loading