mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-22 07:02:29 +00:00
required field update and post to tethys fxn updates
fill in required data for deployments/detections and minor tweaks to post to tethys fxn
This commit is contained in:
parent
d96ace1ca2
commit
140af14cba
@ -84,7 +84,7 @@ public class DBXMLConnect {
|
|||||||
switch(className) {
|
switch(className) {
|
||||||
case "nilus.Deployment":
|
case "nilus.Deployment":
|
||||||
return "Deployments";
|
return "Deployments";
|
||||||
case "nilus.Detection":
|
case "nilus.Detections":
|
||||||
return "Detections";
|
return "Detections";
|
||||||
case "nilus.Calibration":
|
case "nilus.Calibration":
|
||||||
return "Calibrations";
|
return "Calibrations";
|
||||||
|
@ -22,6 +22,7 @@ import Array.ThreadingHydrophoneLocator;
|
|||||||
import PamController.PamControlledUnit;
|
import PamController.PamControlledUnit;
|
||||||
import PamController.PamController;
|
import PamController.PamController;
|
||||||
import PamguardMVC.PamDataBlock;
|
import PamguardMVC.PamDataBlock;
|
||||||
|
import javafx.scene.chart.PieChart.Data;
|
||||||
import metadata.MetaDataContol;
|
import metadata.MetaDataContol;
|
||||||
import metadata.deployment.DeploymentData;
|
import metadata.deployment.DeploymentData;
|
||||||
import nilus.Audio;
|
import nilus.Audio;
|
||||||
@ -283,13 +284,25 @@ public class DeploymentHandler {
|
|||||||
|
|
||||||
public Deployment createDeploymentDocument(int i, DeploymentRecoveryPair drd) {
|
public Deployment createDeploymentDocument(int i, DeploymentRecoveryPair drd) {
|
||||||
Deployment deployment = new Deployment();
|
Deployment deployment = new Deployment();
|
||||||
|
try {
|
||||||
|
nilus.Helper.createRequiredElements(deployment);
|
||||||
|
} 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();
|
||||||
|
}
|
||||||
String id = String.format("%d", i);
|
String id = String.format("%d", i);
|
||||||
deployment.setId(id);
|
deployment.setId(id);
|
||||||
deployment.setDeploymentId(i);
|
deployment.setDeploymentId(i);
|
||||||
deployment.setDeploymentDetails(drd.deploymentDetails);
|
deployment.setDeploymentDetails(drd.deploymentDetails);
|
||||||
deployment.setRecoveryDetails(drd.recoveryDetails);
|
deployment.setRecoveryDetails(drd.recoveryDetails);
|
||||||
|
|
||||||
TethysLocationFuncs.getTrackAndPositionData(deployment);
|
TethysLocationFuncs.getTrackAndPositionData(deployment);
|
||||||
|
|
||||||
getProjectData(deployment);
|
getProjectData(deployment);
|
||||||
|
|
||||||
@ -317,9 +330,16 @@ public class DeploymentHandler {
|
|||||||
*/
|
*/
|
||||||
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) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaDataContol metaControl = (MetaDataContol) aUnit;
|
MetaDataContol metaControl = (MetaDataContol) aUnit;
|
||||||
DeploymentData deploymentData = metaControl.getDeploymentData();
|
DeploymentData deploymentData = metaControl.getDeploymentData();
|
||||||
deployment.setProject(deploymentData.getProject());
|
deployment.setProject(deploymentData.getProject());
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package tethys.detection;
|
package tethys.detection;
|
||||||
|
|
||||||
|
import java.math.BigInteger;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -166,7 +167,10 @@ public class DetectionsHandler {
|
|||||||
* We should now have a fully populated Detections object, so write it to the database
|
* We should now have a fully populated Detections object, so write it to the database
|
||||||
* using functions in DBXMLConnect
|
* using functions in DBXMLConnect
|
||||||
*/
|
*/
|
||||||
//tethysControl.getDbxmlConnect().postToTethys(detectionList); // call whatever you need to call in here to write the Detections.
|
ArrayList<Detections> detectionDocuments = new ArrayList();
|
||||||
|
detectionDocuments.add(detections);
|
||||||
|
|
||||||
|
tethysControl.getDbxmlConnect().postToTethys(detectionDocuments); // call whatever you need to call in here to write the Detections.
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -185,6 +189,25 @@ public class DetectionsHandler {
|
|||||||
effort.setEnd(TethysTimeFuncs.xmlGregCalFromMillis(effortEnd));
|
effort.setEnd(TethysTimeFuncs.xmlGregCalFromMillis(effortEnd));
|
||||||
// effort.set // no setter for DetectionEffortKind
|
// effort.set // no setter for DetectionEffortKind
|
||||||
List<DetectionEffortKind> effortKinds = effort.getKind();
|
List<DetectionEffortKind> effortKinds = effort.getKind();
|
||||||
|
DetectionEffortKind kind = new DetectionEffortKind();
|
||||||
|
try {
|
||||||
|
nilus.Helper.createRequiredElements(kind);
|
||||||
|
} 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
kind.getSpeciesId().setValue(BigInteger.valueOf(180537));
|
||||||
|
kind.getGranularity().setValue(nilus.GranularityEnumType.CALL);
|
||||||
|
|
||||||
|
effortKinds.add(kind);
|
||||||
|
|
||||||
return effort;
|
return effort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ public class AutoTethysProvider implements TethysDataProvider {
|
|||||||
|
|
||||||
private SpeciesIDType getSpeciesIdType() {
|
private SpeciesIDType getSpeciesIdType() {
|
||||||
SpeciesIDType species = new SpeciesIDType();
|
SpeciesIDType species = new SpeciesIDType();
|
||||||
// species.s
|
species.setValue(BigInteger.valueOf(180537));
|
||||||
return species;
|
return species;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user