first very incomplete deployment doc

This commit is contained in:
Douglas Gillespie 2023-03-13 20:45:51 +00:00
parent 456f9102db
commit 98cf904830
4 changed files with 99 additions and 6 deletions

View File

@ -476,7 +476,6 @@ final public class PamModel implements PamModelInterface, PamSettings {
}
/*
* ************* End Utilities Group *******************
*/

View File

@ -0,0 +1,26 @@
package tethys;
import GPS.GpsData;
import nilus.Deployment;
/**
* Function(s) to get location information for Tethys in the required format.
* @author dg50
*
*/
public class TethysLocationFuncs {
/**
* Get everything we need for a deployment document including the track #
* and the deployment / recovery information. Basically this means we
* have to load the GPS data, then potentially filter it. Slight risk this
* may all be too much for memory, but give it a go by loading GPS data for
* the deployment times.
* @param deployment
*/
public static void getTrackAndPositionData(Deployment deployment) {
long start = TethysTimeFuncs.millisFromGregorianXML(deployment.getDeploymentDetails().getAudioTimeStamp());
}
}

View File

@ -0,0 +1,39 @@
package tethys;
import java.util.GregorianCalendar;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
public class TethysTimeFuncs {
/*
* Copied from http://www.java2s.com/Code/Java/Development-Class/ConvertsagiventimeinmillisecondsintoaXMLGregorianCalendarobject.htm
*/
public static XMLGregorianCalendar xmlGregCalFromMillis(long millis) {
try {
final GregorianCalendar calendar = new GregorianCalendar();
calendar.setTimeInMillis(millis);
return DatatypeFactory.newInstance().newXMLGregorianCalendar(
calendar);
}
catch (final DatatypeConfigurationException ex) {
System.out.println("Unable to convert date '%s' to an XMLGregorianCalendar object");
return null;
}
}
/**
* Convert a Gregorian calendar value back to milliseconds.
* @param xmlGregorian
* @return
*/
public static Long millisFromGregorianXML(XMLGregorianCalendar xmlGregorian) {
if (xmlGregorian == null) {
return null;
}
GregorianCalendar gc2 = xmlGregorian.toGregorianCalendar();
return gc2.getTimeInMillis();
}
}

View File

@ -28,8 +28,11 @@ import generalDatabase.DBSchemaWriter;
import generalDatabase.SQLLogging;
import metadata.MetaDataContol;
import metadata.deployment.DeploymentData;
import nilus.Deployment;
import nilus.DeploymentRecoveryDetails;
import tethys.TethysControl;
import tethys.TethysLocationFuncs;
import tethys.TethysTimeFuncs;
import tethys.dbxml.DBXMLConnect;
import tethys.pamdata.TethysDataProvider;
import tethys.pamdata.TethysSchema;
@ -168,9 +171,10 @@ public class TethysExporter {
/*
* This will become the main loop over deployment documents
*/
int i = 0;
for (DeploymentRecoveryPair drd : deployRecover) {
Deployment deployment = createDeploymentDocument(i++, drd);
}
@ -200,6 +204,19 @@ public class TethysExporter {
return true;
}
private Deployment createDeploymentDocument(int i, DeploymentRecoveryPair drd) {
Deployment deployment = new Deployment();
deployment.setDeploymentDetails(drd.deploymentDetails);
deployment.setRecoveryDetails(drd.recoveryDetails);
TethysLocationFuncs.getTrackAndPositionData(deployment);
return deployment;
}
/**
* find Deployment data. This is stored in a separate PAMGuard module, which may not
* be present.
@ -295,9 +312,9 @@ public class TethysExporter {
// just load everything. Probably OK for the acqusition, but will bring down
daqInfoDataBlock.loadViewerData(0, Long.MAX_VALUE, null);
ArrayList<DaqStatusDataUnit> allStatusData = daqInfoDataBlock.getDataCopy();
if (allStatusData != null && allStatusData.size() > 0) {
long dataStart = Long.MAX_VALUE;
long dataEnd = Long.MIN_VALUE;
if (allStatusData != null && allStatusData.size() > 0) {
// find the number of times it started and stopped ....
int nStart = 0, nStop = 0, nFile=0;
for (DaqStatusDataUnit daqStatus : allStatusData) {
@ -336,8 +353,20 @@ public class TethysExporter {
// */
//// for ()
// }
DeploymentRecoveryPair pair = new DeploymentRecoveryPair();
DeploymentRecoveryDetails deployment = new DeploymentRecoveryDetails();
DeploymentRecoveryDetails recovery = new DeploymentRecoveryDetails();
pair.deploymentDetails = deployment;
pair.recoveryDetails = recovery;
return null;
deployment.setTimeStamp(TethysTimeFuncs.xmlGregCalFromMillis(dataStart));
deployment.setAudioTimeStamp(TethysTimeFuncs.xmlGregCalFromMillis(dataStart));
recovery.setTimeStamp(TethysTimeFuncs.xmlGregCalFromMillis(dataEnd));
recovery.setAudioTimeStamp(TethysTimeFuncs.xmlGregCalFromMillis(dataEnd));
ArrayList<DeploymentRecoveryPair> drPairs = new ArrayList<>();
drPairs.add(pair);
return drPairs;
}