mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-25 08:32:32 +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) {
|
||||
case "nilus.Deployment":
|
||||
return "Deployments";
|
||||
case "nilus.Detection":
|
||||
case "nilus.Detections":
|
||||
return "Detections";
|
||||
case "nilus.Calibration":
|
||||
return "Calibrations";
|
||||
|
@ -22,6 +22,7 @@ import Array.ThreadingHydrophoneLocator;
|
||||
import PamController.PamControlledUnit;
|
||||
import PamController.PamController;
|
||||
import PamguardMVC.PamDataBlock;
|
||||
import javafx.scene.chart.PieChart.Data;
|
||||
import metadata.MetaDataContol;
|
||||
import metadata.deployment.DeploymentData;
|
||||
import nilus.Audio;
|
||||
@ -283,6 +284,18 @@ public class DeploymentHandler {
|
||||
|
||||
public Deployment createDeploymentDocument(int i, DeploymentRecoveryPair drd) {
|
||||
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);
|
||||
deployment.setId(id);
|
||||
deployment.setDeploymentId(i);
|
||||
@ -317,9 +330,16 @@ public class DeploymentHandler {
|
||||
*/
|
||||
private boolean getProjectData(Deployment deployment) {
|
||||
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;
|
||||
}
|
||||
|
||||
MetaDataContol metaControl = (MetaDataContol) aUnit;
|
||||
DeploymentData deploymentData = metaControl.getDeploymentData();
|
||||
deployment.setProject(deploymentData.getProject());
|
||||
|
@ -1,5 +1,6 @@
|
||||
package tethys.detection;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
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
|
||||
* 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;
|
||||
@ -185,6 +189,25 @@ public class DetectionsHandler {
|
||||
effort.setEnd(TethysTimeFuncs.xmlGregCalFromMillis(effortEnd));
|
||||
// effort.set // no setter for DetectionEffortKind
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ public class AutoTethysProvider implements TethysDataProvider {
|
||||
|
||||
private SpeciesIDType getSpeciesIdType() {
|
||||
SpeciesIDType species = new SpeciesIDType();
|
||||
// species.s
|
||||
species.setValue(BigInteger.valueOf(180537));
|
||||
return species;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user