This commit is contained in:
Douglas Gillespie 2023-03-16 16:35:09 +00:00
commit b344b775ec
5 changed files with 71 additions and 18 deletions

View File

@ -11,6 +11,9 @@ import javax.swing.JMenuItem;
import PamController.PamControlledUnit; import PamController.PamControlledUnit;
import PamController.PamController; import PamController.PamController;
import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataBlock;
import metadata.MetaDataContol;
import metadata.deployment.DeploymentData;
import nilus.Deployment.Instrument;
import tethys.dbxml.DBXMLConnect; import tethys.dbxml.DBXMLConnect;
//import nilus.Deployment; //import nilus.Deployment;
//import nilus.Deployment.Instrument; //import nilus.Deployment.Instrument;
@ -95,6 +98,33 @@ public class TethysControl extends PamControlledUnit {
tethysExporter.doExport(); tethysExporter.doExport();
} }
public DeploymentData getGlobalDeplopymentData() {
PamControlledUnit aUnit = PamController.getInstance().findControlledUnit(MetaDataContol.class, null);
// if (aUnit instanceof MetaDataContol == false || true) {
// deployment.setProject("thisIsAProject");
// deployment.setPlatform("Yay a platform");
// Instrument instrument = new Instrument();
// instrument.setType("machiney");
// instrument.setInstrumentId("12345555");
// deployment.setInstrument(instrument);
// return false;
// }
MetaDataContol metaControl = (MetaDataContol) aUnit;
DeploymentData deploymentData = metaControl != null ? metaControl.getDeploymentData() : new DeploymentData();
deploymentData.setProject("thisIsAProject");
deploymentData.setPlatform("Yay a platform");
deploymentData.setCruise("cruisey");
deploymentData.setDeploymentId(142536);
deploymentData.setInstrumentId("super instrument");
deploymentData.setSite("in the ocean somewhere");
deploymentData.setRegion("ocean water");
deploymentData.setInstrumentType("sensor of sorts");
return deploymentData;
}
/** /**
* A name for any deta selectors. * A name for any deta selectors.
* @return * @return

View File

@ -37,6 +37,7 @@ import nilus.DeploymentRecoveryDetails;
import nilus.GeometryTypeM; import nilus.GeometryTypeM;
import nilus.Helper; import nilus.Helper;
import pamMaths.PamVector; import pamMaths.PamVector;
import tethys.TethysControl;
import tethys.TethysLocationFuncs; import tethys.TethysLocationFuncs;
import tethys.TethysTimeFuncs; import tethys.TethysTimeFuncs;
@ -46,8 +47,15 @@ import tethys.TethysTimeFuncs;
* *
*/ */
public class DeploymentHandler { public class DeploymentHandler {
private TethysControl tethysControl;
public DeploymentHandler(TethysControl tethysControl) {
super();
this.tethysControl = tethysControl;
}
/** /**
* Get an overview of all the deployments. * Get an overview of all the deployments.
* @return * @return
@ -329,19 +337,19 @@ public class DeploymentHandler {
* @param deployment * @param deployment
*/ */
private boolean getProjectData(Deployment deployment) { private boolean getProjectData(Deployment deployment) {
PamControlledUnit aUnit = PamController.getInstance().findControlledUnit(MetaDataContol.class, null); // PamControlledUnit aUnit = PamController.getInstance().findControlledUnit(MetaDataContol.class, null);
if (aUnit instanceof MetaDataContol == false || true) { // if (aUnit instanceof MetaDataContol == false || true) {
deployment.setProject("thisIsAProject"); // deployment.setProject("thisIsAProject");
deployment.setPlatform("Yay a platform"); // deployment.setPlatform("Yay a platform");
Instrument instrument = new Instrument(); // Instrument instrument = new Instrument();
instrument.setType("machiney"); // instrument.setType("machiney");
instrument.setInstrumentId("12345555"); // instrument.setInstrumentId("12345555");
deployment.setInstrument(instrument); // deployment.setInstrument(instrument);
return false; // return false;
} // }
//
MetaDataContol metaControl = (MetaDataContol) aUnit; // MetaDataContol metaControl = (MetaDataContol) aUnit;
DeploymentData deploymentData = metaControl.getDeploymentData(); DeploymentData deploymentData = tethysControl.getGlobalDeplopymentData();
deployment.setProject(deploymentData.getProject()); deployment.setProject(deploymentData.getProject());
deployment.setDeploymentAlias(deploymentData.getDeploymentAlias()); deployment.setDeploymentAlias(deploymentData.getDeploymentAlias());
deployment.setSite(deploymentData.getSite()); deployment.setSite(deploymentData.getSite());

View File

@ -29,6 +29,9 @@ public class DetectionsHandler {
private TethysControl tethysControl; private TethysControl tethysControl;
public int uniqueDetectionsId;
public int uniqueDetectionId;
public DetectionsHandler(TethysControl tethysControl) { public DetectionsHandler(TethysControl tethysControl) {
super(); super();
this.tethysControl = tethysControl; this.tethysControl = tethysControl;
@ -142,7 +145,7 @@ public class DetectionsHandler {
*/ */
TethysDataProvider dataProvider = dataBlock.getTethysDataProvider(); TethysDataProvider dataProvider = dataBlock.getTethysDataProvider();
Detections detections = new Detections(); Detections detections = new Detections();
detections.setId(deployment.getId()); detections.setId(String.format("%d", uniqueDetectionsId++));
detections.setDescription(dataProvider.getDescription(deployment, tethysExportParams)); detections.setDescription(dataProvider.getDescription(deployment, tethysExportParams));
DataSourceType dataSource = new DataSourceType(); DataSourceType dataSource = new DataSourceType();
dataSource.setDeploymentId(deployment.getId()); dataSource.setDeploymentId(deployment.getId());
@ -156,7 +159,7 @@ public class DetectionsHandler {
List<Detection> detectionList = detectionGroup.getDetection(); List<Detection> detectionList = detectionGroup.getDetection();
for (int i = 0; i < data.size(); i++) { for (int i = 0; i < data.size(); i++) {
PamDataUnit dataUnit = data.get(i); PamDataUnit dataUnit = data.get(i);
Detection detection = dataProvider.createDetection(dataUnit, tethysExportParams, streamExportParams); Detection detection = dataProvider.createDetection(dataUnit, tethysExportParams, streamExportParams);
if (detection != null) { if (detection != null) {
detectionList.add(detection); detectionList.add(detection);
} }

View File

@ -168,7 +168,7 @@ public class TethysExporter {
//get list of deployment recovery details (start, stop times and lat/long) //get list of deployment recovery details (start, stop times and lat/long)
//deployment details and recovery details are same structure //deployment details and recovery details are same structure
//per pair, go through a loop to fill in each deployment //per pair, go through a loop to fill in each deployment
DeploymentHandler deploymentHandler = new DeploymentHandler(); DeploymentHandler deploymentHandler = new DeploymentHandler(tethysControl);
ArrayList<DeploymentRecoveryPair> deployRecover = deploymentHandler.getDeployments(); ArrayList<DeploymentRecoveryPair> deployRecover = deploymentHandler.getDeployments();
if (deployRecover == null) { if (deployRecover == null) {

View File

@ -92,11 +92,23 @@ public class AutoTethysProvider implements TethysDataProvider {
@Override @Override
public AlgorithmType getAlgorithm() { public AlgorithmType getAlgorithm() {
AlgorithmType algorithm = new AlgorithmType(); AlgorithmType algorithm = new AlgorithmType();
try {
nilus.Helper.createRequiredElements(algorithm);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
algorithm.setMethod(this.getAlgorithmMethod()); algorithm.setMethod(this.getAlgorithmMethod());
algorithm.setSoftware("PAMGuard"); algorithm.setSoftware("PAMGuard");
algorithm.setVersion(PamguardVersionInfo.version); algorithm.setVersion(PamguardVersionInfo.version);
algorithm.setParameters(this.getAlgorithmParameters()); //algorithm.setParameters(this.getAlgorithmParameters());
return algorithm; return algorithm;
} }