mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-21 22:52:22 +00:00
fixed some deploymentData defaulting
fixed some deploymentData defaulting
This commit is contained in:
parent
140af14cba
commit
7f680f3e20
@ -11,6 +11,9 @@ import javax.swing.JMenuItem;
|
||||
import PamController.PamControlledUnit;
|
||||
import PamController.PamController;
|
||||
import PamguardMVC.PamDataBlock;
|
||||
import metadata.MetaDataContol;
|
||||
import metadata.deployment.DeploymentData;
|
||||
import nilus.Deployment.Instrument;
|
||||
import tethys.dbxml.DBXMLConnect;
|
||||
//import nilus.Deployment;
|
||||
//import nilus.Deployment.Instrument;
|
||||
@ -94,6 +97,33 @@ public class TethysControl extends PamControlledUnit {
|
||||
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.
|
||||
* @return
|
||||
|
@ -37,6 +37,7 @@ import nilus.DeploymentRecoveryDetails;
|
||||
import nilus.GeometryTypeM;
|
||||
import nilus.Helper;
|
||||
import pamMaths.PamVector;
|
||||
import tethys.TethysControl;
|
||||
import tethys.TethysLocationFuncs;
|
||||
import tethys.TethysTimeFuncs;
|
||||
|
||||
@ -46,8 +47,15 @@ import tethys.TethysTimeFuncs;
|
||||
*
|
||||
*/
|
||||
public class DeploymentHandler {
|
||||
|
||||
private TethysControl tethysControl;
|
||||
|
||||
|
||||
public DeploymentHandler(TethysControl tethysControl) {
|
||||
super();
|
||||
this.tethysControl = tethysControl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an overview of all the deployments.
|
||||
* @return
|
||||
@ -329,19 +337,19 @@ public class DeploymentHandler {
|
||||
* @param deployment
|
||||
*/
|
||||
private boolean getProjectData(Deployment deployment) {
|
||||
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.getDeploymentData();
|
||||
// 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 = tethysControl.getGlobalDeplopymentData();
|
||||
deployment.setProject(deploymentData.getProject());
|
||||
deployment.setDeploymentAlias(deploymentData.getDeploymentAlias());
|
||||
deployment.setSite(deploymentData.getSite());
|
||||
|
@ -29,6 +29,9 @@ public class DetectionsHandler {
|
||||
|
||||
private TethysControl tethysControl;
|
||||
|
||||
public int uniqueDetectionsId;
|
||||
public int uniqueDetectionId;
|
||||
|
||||
public DetectionsHandler(TethysControl tethysControl) {
|
||||
super();
|
||||
this.tethysControl = tethysControl;
|
||||
@ -142,7 +145,7 @@ public class DetectionsHandler {
|
||||
*/
|
||||
TethysDataProvider dataProvider = dataBlock.getTethysDataProvider();
|
||||
Detections detections = new Detections();
|
||||
detections.setId(deployment.getId());
|
||||
detections.setId(String.format("%d", uniqueDetectionsId++));
|
||||
detections.setDescription(dataProvider.getDescription(deployment, tethysExportParams));
|
||||
DataSourceType dataSource = new DataSourceType();
|
||||
dataSource.setDeploymentId(deployment.getId());
|
||||
@ -156,7 +159,7 @@ public class DetectionsHandler {
|
||||
List<Detection> detectionList = detectionGroup.getDetection();
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
PamDataUnit dataUnit = data.get(i);
|
||||
Detection detection = dataProvider.createDetection(dataUnit, tethysExportParams, streamExportParams);
|
||||
Detection detection = dataProvider.createDetection(dataUnit, tethysExportParams, streamExportParams);
|
||||
if (detection != null) {
|
||||
detectionList.add(detection);
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ public class TethysExporter {
|
||||
//get list of deployment recovery details (start, stop times and lat/long)
|
||||
//deployment details and recovery details are same structure
|
||||
//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();
|
||||
if (deployRecover == null) {
|
||||
|
@ -82,10 +82,22 @@ public class AutoTethysProvider implements TethysDataProvider {
|
||||
@Override
|
||||
public AlgorithmType getAlgorithm() {
|
||||
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.setSoftware("PAMGuard");
|
||||
algorithm.setVersion(PamguardVersionInfo.version);
|
||||
algorithm.setParameters(this.getAlgorithmParameters());
|
||||
//algorithm.setParameters(this.getAlgorithmParameters());
|
||||
|
||||
return algorithm;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user