Improved document handling

Abstracted wrapper around nilus documents which allows easyish calling of internal functions in Localize and Detections document without a common base class.
This commit is contained in:
Douglas Gillespie 2024-07-26 16:12:54 +01:00
parent 4f87b7b661
commit bc686c0fe6
10 changed files with 377 additions and 79 deletions

View File

@ -598,6 +598,13 @@ public class TethysControl extends PamControlledUnit implements PamSettings, Tet
return detectionsHandler;
}
/**
* @return the localizationHandler
*/
public LocalizationHandler getLocalizationHandler() {
return localizationHandler;
}
public void showException(TethysException tethysException) {
String title = tethysException.getMessage();
StackTraceElement[] stack = tethysException.getStackTrace();

View File

@ -32,6 +32,7 @@ import nilus.Detections;
import nilus.GranularityEnumType;
import nilus.GranularityType;
import nilus.Helper;
import nilus.Localize;
import tethys.Collection;
import tethys.DocumentInfo;
import tethys.TethysControl;
@ -784,6 +785,38 @@ public class DBXMLQueries {
}
return count;
}
/**
* Count on effort detections in a Detections document
* @param docName
* @return
*/
public int countLocalizations2(String docName) {
TethysExportParams params = tethysControl.getTethysExportParams();
String queryBase = "count(collection(\"Localizations\")/Localize[Id=\"ReplaceDocumentId\"]/Localizations/Localization)";
String query = queryBase.replace("ReplaceDocumentId", docName);
String result = null;
try {
Queries queries = dbXMLConnect.getTethysQueries();
result = queries.QueryTethys(query);
// System.out.println(result);
}
catch (Exception e) {
System.out.println("Error executing " + query);
// e.printStackTrace();
return -1;
}
int count = 0;
try {
count = Integer.valueOf(result);
}
catch (NumberFormatException e) {
System.out.println("Unable to interpret count data " + result);
return 0;
}
return count;
}
// /**
// * Get a count of the detections in a detections document.
@ -1081,5 +1114,108 @@ public class DBXMLQueries {
// TODO Auto-generated method stub
return detections;
}
/**
* Get the basic information about a Detections document. This is basically everything apart from
* the actual detections themselves.
* @param aDoc
* @return
*/
public Localize getLocalizationDocInfo(String locDocName) {
// String oldqueryBase = "{\"species\":{\"query\":{\"op\":\"lib:abbrev2tsn\",\"optype\":\"function\",\"operands\":[\"%s\",\"SIO.SWAL.v1\"]},\"return\":{\"op\":\"lib:tsn2abbrev\",\"optype\":\"function\",\"operands\":[\"%s\",\"SIO.SWAL.v1\"]}},\"return\":[\"Detections/Id\",\"Detections/Description\",\"Detections/DataSource\",\"Detections/Algorithm\"],\"select\":[{\"op\":\"=\",\"operands\":[\"Detections/Id\",\"DetectionsDocName\"],\"optype\":\"binary\"}],\"enclose\":1}";
// updated May 23
// String queryBase = "{\"species\":{\"query\":{\"op\":\"lib:completename2tsn\",\"optype\":\"function\",\"operands\":[\"%s\"]},\"return\":{\"op\":\"lib:tsn2completename\",\"optype\":\"function\",\"operands\":[\"%s\"]}},\"return\":[\"Localize/Id\",\"Localize/Description\",\"Localize/DataSource\",\"Localize/Algorithm\",\"Localize/QualityAssurance\",\"Localize/UserId\",\"Localize/MetadataInfo\",\"Localize/Effort\"],\"select\":[{\"op\":\"=\",\"operands\":[\"Localize/Id\",\"LocalizationsDocName\"],\"optype\":\"binary\"}],\"enclose\":1}";
String queryBase = "{\"species\":{\"query\":{\"op\":\"lib:completename2tsn\",\"optype\":\"function\",\"operands\":[\"%s\"]},\"return\":{\"op\":\"lib:tsn2completename\",\"optype\":\"function\",\"operands\":[\"%s\"]}},\"return\":[\"Localize/Id\",\"Localize/Description\",\"Localize/DataSource\",\"Localize/Algorithm\",\"Localize/QualityAssurance\",\"Localize/UserId\",\"Localize/Effort\"],\"select\":[{\"op\":\"=\",\"operands\":[\"Localize/Id\",\"LocalizationsDocName\"],\"optype\":\"binary\"}],\"enclose\":1}";
String query = queryBase.replace("LocalizationsDocName", locDocName);
DBQueryResult queryResult;
try {
queryResult = executeQuery(query);
} catch (TethysQueryException e) {
tethysControl.showException(e);
return null;
}
Document doc;
try {
doc = queryResult.getDocument();
} catch (ParserConfigurationException | SAXException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
// System.out.println(queryResult.queryResult);
Localize localize = new Localize();
try {
Helper.createRequiredElements(localize);
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException e) {
e.printStackTrace();
}
NodeList returns = doc.getElementsByTagName("Result");
// System.out.println("N projects = " + returns.getLength());
int n = returns.getLength();
if (n == 0) {
return null;
}
Element result = (Element) returns.item(0);
DescriptionType description = localize.getDescription();
if (description == null) {
description = new DescriptionType();
localize.setDescription(description);
}
localize.setId(getElementData(result, "Id"));
description.setAbstract(getElementData(result, "Description.Abstract"));
description.setMethod(getElementData(result, "Description.Method"));
description.setObjectives(getElementData(result, "Description.Objectives"));
String deployment = getElementData(result, "DataSource.DeploymentId");
if (deployment != null) {
DataSourceType dataSource = localize.getDataSource();
if (dataSource == null) {
dataSource = new DataSourceType();
localize.setDataSource(dataSource);
}
dataSource.setDeploymentId(deployment);
}
// get the effort start an end
String effStart = getElementData(result, "Effort.Start");
String effEnd = getElementData(result, "Effort.End");
localize.getEffort().setStart(TethysTimeFuncs.fromGregorianXML(effStart));
localize.getEffort().setEnd(TethysTimeFuncs.fromGregorianXML(effEnd));
// try to find the granularity.
// String granularityString = getElementData(result, "Effort.Kind.Granularity");
// GranularityEnumType granularity = null;
// if (granularityString != null) {
// granularity = GranularityEnumType.fromValue(granularityString);
// List<DetectionEffortKind> kinds = detections.getEffort().getKind();
// DetectionEffortKind kind = new DetectionEffortKind();
// GranularityType granularityType = new GranularityType();
// granularityType.setValue(granularity);
// kind.setGranularity(granularityType);
// // try to find the rest of the granularity information.
// String binSize_m = getElementAttribute(result, "Effort.Kind.Granularity", "BinSize_m");
// String encounterGap_m = getElementAttribute(result, "Effort.Kind.Granularity", "EncounterGap_m");
// String firstBinStart = getElementAttribute(result, "Effort.Kind.Granularity", "FirstBinStart");
// try {
// granularityType.setBinSizeMin(Double.valueOf(binSize_m));
// }
// catch (NumberFormatException e) {
// }
// try {
// granularityType.setEncounterGapMin(Double.valueOf(encounterGap_m));
// }
// catch (NumberFormatException e) {
// }
//
// kinds.add(kind);
// }
// String
// TODO Auto-generated method stub
return localize;
}
}

View File

@ -51,6 +51,8 @@ import tethys.deployment.DeploymentHandler;
import tethys.localization.CoordinateName;
import tethys.localization.LocalizationSubType;
import tethys.localization.LocalizationType;
import tethys.localization.PLocalization;
import tethys.niluswraps.NilusDataWrapper;
import tethys.niluswraps.PDeployment;
import tethys.niluswraps.PDetections;
import tethys.output.StreamExportParams;
@ -93,9 +95,8 @@ public class DetectionsHandler extends CollectionHandler {
* this data set (not the entire project).
* @param dataBlock
*/
public StreamDetectionsSummary getStreamDetections(PamDataBlock dataBlock) {
public StreamDetectionsSummary<NilusDataWrapper<PDetections>> getStreamDetections(PamDataBlock dataBlock) {
ArrayList<PDeployment> deployments = tethysControl.getDeploymentHandler().getMatchedDeployments();
// getStreamLocalizations(dataBlock, deployments);
return getStreamDetections(dataBlock, deployments);
}
@ -106,7 +107,7 @@ public class DetectionsHandler extends CollectionHandler {
* @param deployments
* @return
*/
public StreamDetectionsSummary getStreamDetections(PamDataBlock dataBlock, ArrayList<PDeployment> deployments) {
public StreamDetectionsSummary<NilusDataWrapper<PDetections>> getStreamDetections(PamDataBlock dataBlock, ArrayList<PDeployment> deployments) {
// get the basic data for each document including it's Description.
ArrayList<PDetections> detectionsDocs = new ArrayList<>();

View File

@ -2,6 +2,7 @@ package tethys.detection;
import java.util.ArrayList;
import tethys.niluswraps.NilusDataWrapper;
import tethys.niluswraps.PDetections;
/**
@ -10,11 +11,11 @@ import tethys.niluswraps.PDetections;
* @author dg50
*
*/
public class StreamDetectionsSummary {
public class StreamDetectionsSummary<T extends NilusDataWrapper> {
public ArrayList<PDetections> detectionsDocs;
public ArrayList<T> detectionsDocs;
public StreamDetectionsSummary(ArrayList<PDetections> detectionsDocs) {
public StreamDetectionsSummary(ArrayList<T> detectionsDocs) {
this.detectionsDocs = detectionsDocs;
}

View File

@ -5,11 +5,13 @@ import java.util.ArrayList;
import PamguardMVC.PamDataBlock;
import nilus.CylindricalCoordinateType;
import nilus.LocalizationType;
import nilus.Localize;
import nilus.Localize.Effort.CoordinateReferenceSystem;
import tethys.Collection;
import tethys.CollectionHandler;
import tethys.TethysControl;
import tethys.detection.StreamDetectionsSummary;
import tethys.niluswraps.NilusDataWrapper;
import tethys.niluswraps.PDeployment;
public class LocalizationHandler extends CollectionHandler {
@ -26,33 +28,45 @@ public class LocalizationHandler extends CollectionHandler {
// CoordinateReferenceSystem cr;
// return null;
// }
/**
* Get a list of Localization documents associated with a particular data block for all deployments
* documents. Group them by abstract or something
* @param dataBlock
* @return
*/
public StreamDetectionsSummary<NilusDataWrapper<PLocalization>> getStreamLocalizations(PamDataBlock dataBlock) {
ArrayList<PDeployment> deployments = tethysControl.getDeploymentHandler().getMatchedDeployments();
return getStreamLocalizations(dataBlock, deployments);
}
/**
* Get a list of Localization documents associated with a particular data block for the list of deployments
* documents. Group them by abstract or something
* @param dataBlock
* @param deployments
* @param deployments can be null for all deployments.
* @return
*/
public StreamDetectionsSummary getStreamLocalizations(PamDataBlock dataBlock, ArrayList<PDeployment> deployments) {
public StreamDetectionsSummary<NilusDataWrapper<PLocalization>> getStreamLocalizations(PamDataBlock dataBlock, ArrayList<PDeployment> deployments) {
// get the basic data for each document including it's Description.
// ArrayList<PDetections> detectionsDocs = new ArrayList<>();
ArrayList<PLocalization> localizeDocs = new ArrayList<>();
for (PDeployment aDep : deployments) {
ArrayList<String> someNames = tethysControl.getDbxmlQueries().getLocalizationDocuments(dataBlock, aDep.getDocumentId());
if (someNames == null) {
continue;
}
// // no have a list of all the Detections documents of interest for this datablock.
// for (String aDoc : someNames) {
// Detections detections = tethysControl.getDbxmlQueries().getDetectionsDocInfo(aDoc);
// int count = tethysControl.getDbxmlQueries().countDetections2(aDoc);
for (String aDoc : someNames) {
Localize localize = tethysControl.getDbxmlQueries().getLocalizationDocInfo(aDoc);
int count = tethysControl.getDbxmlQueries().countLocalizations2(aDoc);
PLocalization pLocalize = new PLocalization(localize, dataBlock, aDep, count);
localizeDocs.add(pLocalize);
// PDetections pDetections = new PDetections(detections, dataBlock, aDep, count);
// detectionsDocs.add(pDetections);
// }
}
}
// return new StreamDetectionsSummary(detectionsDocs);
return null;
return new StreamDetectionsSummary(localizeDocs);
}
@Override
@ -60,4 +74,5 @@ public class LocalizationHandler extends CollectionHandler {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -0,0 +1,14 @@
package tethys.localization;
import PamguardMVC.PamDataBlock;
import nilus.Localize;
import tethys.niluswraps.NilusDataWrapper;
import tethys.niluswraps.PDeployment;
public class PLocalization extends NilusDataWrapper<Localize> {
public PLocalization(Localize nilusObject, PamDataBlock dataBlock, PDeployment deployment, Integer count) {
super(nilusObject, dataBlock, deployment, count);
}
}

View File

@ -1,6 +1,14 @@
package tethys.niluswraps;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import javax.xml.datatype.XMLGregorianCalendar;
import PamguardMVC.PamDataBlock;
import nilus.DataSourceType;
import nilus.DescriptionType;
import nilus.QualityAssuranceProcessType;
/**
* Wrapper for Nilus data objects. This means Detections and Localization documents which
@ -23,5 +31,26 @@ public class NilusDataWrapper<T> extends NilusDocumentWrapper<T> {
this.deployment = deployment;
this.count = count;
}
public DescriptionType getDescription() {
return (DescriptionType) getGotObject("getDescription");
}
public DataSourceType getDataSource() {
return (DataSourceType) getGotObject("getDataSource");
}
public QualityAssuranceProcessType getQualityAssurance() {
return (QualityAssuranceProcessType) getGotObject("getQualityAssurance");
}
public XMLGregorianCalendar getEffortStart() {
return (XMLGregorianCalendar) getGotObjects("getEffort", "getStart");
}
public XMLGregorianCalendar getEffortEnd() {
return (XMLGregorianCalendar) getGotObjects("getEffort", "getEnd");
}
}

View File

@ -1,6 +1,9 @@
package tethys.niluswraps;
import PamguardMVC.PamDataBlock;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import tethys.Collection;
import tethys.dbxml.DBXMLConnect;
public class NilusDocumentWrapper<T> {
@ -21,4 +24,85 @@ public class NilusDocumentWrapper<T> {
return DBXMLConnect.getDocumentId(nilusObject);
}
/**
* Get an object out of the nilus object using a series of sequential getter functions
* @param getterName function names (any number to work through class list) .
* @return
*/
public Object getGotObjects(String... getterNames) {
/**
* Be aware that this will probably get called in preference to
* the function below, so need to check to see if the
*/
return getGotObjects(nilusObject, getterNames);
}
/**
* Get an object out of the given object using a series of sequential getter functions
* @param source source object
* @param getterName function names (any number to work through class list) .
* @return
*/
public Object getGotObjects(Object source, String... getterNames) {
Object obj = source;
for (int i = 0; i < getterNames.length; i++) {
obj = getGotObject(obj, getterNames[i]);
if (obj == null) {
break;
}
}
return obj;
}
/**
* Get an object out of the main nilus object using a getter function (no function parameters).
* @param source source object
* @param getterName function name.
* @return
*/
public Object getGotObject(String getterName) {
return getGotObject(nilusObject, getterName);
}
/**
* Get an object out of the given object using a getter function (no function parameters).
* @param source source object
* @param getterName function name.
* @return
*/
public Object getGotObject(Object source, String getterName) {
if (source == null) {
return null;
}
Class sourceClass = source.getClass();
Method getId;
try {
getId = sourceClass.getDeclaredMethod(getterName, null);
Object[] inputs = new Object[0];
Object res = getId.invoke(source, inputs);
return res;
}
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
System.err.printf("Unable to find method %s in object %s\n", getterName, source.toString());
e.printStackTrace();
}
return null;
}
/**
* Get the class of the nilus object.
* @return Java class of nilus object.
*/
public Class getNilusClass() {
return nilusObject.getClass();
}
/**
* Collection for the nilus object.
* @return
*/
public Collection getCollection() {
return Collection.fromClass(getNilusClass());
}
}

View File

@ -3,30 +3,12 @@ package tethys.niluswraps;
import PamguardMVC.PamDataBlock;
import nilus.Detections;
public class PDetections extends NilusDataWrapper<Detections>{
public class PDetections extends NilusDataWrapper<Detections> {
public PDetections(Detections detections, PamDataBlock dataBlock, PDeployment deployment, Integer count) {
super(detections, dataBlock, deployment, count);
// TODO Auto-generated constructor stub
}
// public Detections nilusObject;
//
// public Integer count;
//
// public PDeployment deployment;
//
// public PamDataBlock dataBlock;
//
// public PDetections(Detections detections, PamDataBlock dataBlock, PDeployment deployment, Integer count) {
// super();
// this.dataBlock = dataBlock;
// this.nilusObject = detections;
// this.deployment = deployment;
// this.count = count;
// }
}

View File

@ -27,14 +27,20 @@ import PamView.dialog.warn.WarnOnce;
import PamView.tables.SwingTableColumnWidths;
import PamguardMVC.PamDataBlock;
import nilus.DataSourceType;
import nilus.DescriptionType;
import nilus.DetectionEffort;
import nilus.DetectionEffortKind;
import nilus.Detections;
import nilus.GranularityType;
import nilus.Localize.Effort;
import tethys.Collection;
import tethys.TethysControl;
import tethys.TethysState;
import tethys.dbxml.TethysException;
import tethys.detection.StreamDetectionsSummary;
import tethys.localization.PLocalization;
import tethys.niluswraps.NilusDataWrapper;
import tethys.niluswraps.NilusDocumentWrapper;
import tethys.niluswraps.PDeployment;
import tethys.niluswraps.PDetections;
@ -57,7 +63,11 @@ public class DatablockDetectionsPanel extends TethysGUIPanel implements StreamTa
private PamDataBlock dataBlock;
private StreamDetectionsSummary streamDetectionsSummary;
// private StreamDetectionsSummary<NilusDataWrapper<PDetections>> streamDetectionsSummary;
//
// private StreamDetectionsSummary<NilusDataWrapper<PLocalization>> streamLocalisationsSummary;
private StreamDetectionsSummary<NilusDataWrapper> combinedSummary;
public DatablockDetectionsPanel(TethysControl tethysControl) {
super(tethysControl);
@ -144,7 +154,16 @@ public class DatablockDetectionsPanel extends TethysGUIPanel implements StreamTa
@Override
public String runBackgroundTask(PamWorker<String> pamWorker) {
streamDetectionsSummary = getTethysControl().getDetectionsHandler().getStreamDetections(dataBlock);
StreamDetectionsSummary<NilusDataWrapper<PDetections>> streamDetectionsSummary = getTethysControl().getDetectionsHandler().getStreamDetections(dataBlock);
StreamDetectionsSummary<NilusDataWrapper<PLocalization>> streamLocalisationsSummary = getTethysControl().getLocalizationHandler().getStreamLocalizations(dataBlock);
ArrayList<NilusDataWrapper> allDocs = new ArrayList();
if (streamDetectionsSummary != null) {
allDocs.addAll(streamDetectionsSummary.detectionsDocs);
}
if (streamLocalisationsSummary != null) {
allDocs.addAll(streamLocalisationsSummary.detectionsDocs);
}
combinedSummary = new StreamDetectionsSummary<>(allDocs);
return null;
}
@ -183,7 +202,7 @@ public class DatablockDetectionsPanel extends TethysGUIPanel implements StreamTa
}
int[] rows = table.getSelectedRows();
PDetections pDets = detectionsForRow(row);
NilusDataWrapper pDets = detectionsForRow(row);
if (pDets == null) {
return;
}
@ -216,7 +235,7 @@ public class DatablockDetectionsPanel extends TethysGUIPanel implements StreamTa
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
deleteDocument(pDets);
// deleteDocument(pDets);
}
});
popMenu.add(menuItem);
@ -247,11 +266,11 @@ public class DatablockDetectionsPanel extends TethysGUIPanel implements StreamTa
return;
}
ArrayList<Detections> toDelete = new ArrayList();
ArrayList<NilusDataWrapper> toDelete = new ArrayList();
for (int i = 0; i < rows.length; i++) {
int row = rows[i];
PDetections pDets = detectionsForRow(row);
NilusDataWrapper<PDetections> pDets = detectionsForRow(row);
if (pDets == null) {
continue;
}
@ -265,15 +284,15 @@ public class DatablockDetectionsPanel extends TethysGUIPanel implements StreamTa
private class DeleteDocs implements PamWorkWrapper<Integer> {
private ArrayList<Detections> toDelete;
private ArrayList<NilusDataWrapper> toDelete;
public DeleteDocs(ArrayList<Detections> toDelete) {
public DeleteDocs(ArrayList<NilusDataWrapper> toDelete) {
this.toDelete = toDelete;
}
@Override
public Integer runBackgroundTask(PamWorker<Integer> pamWorker) {
for (Detections dets : toDelete) {
for (NilusDocumentWrapper dets : toDelete) {
try {
getTethysControl().getDbxmlConnect().deleteDocument(dets);
@ -307,36 +326,35 @@ public class DatablockDetectionsPanel extends TethysGUIPanel implements StreamTa
selectDataBlock(dataBlock); // force table update.
}
private void displayDocument(PDetections pDets) {
getTethysControl().displayDocument(Collection.Detections.collectionName(), pDets.getDocumentId());
private void displayDocument(NilusDataWrapper pDets) {
getTethysControl().displayDocument(pDets.getCollection().collectionName(), pDets.getDocumentId());
}
private void exportDocument(PDetections pDets) {
getTethysControl().exportDocument(Collection.Detections.toString(), pDets.getDocumentId());
private void exportDocument(NilusDataWrapper pDets) {
getTethysControl().exportDocument(pDets.getCollection().collectionName(), pDets.getDocumentId());
}
private PDetections detectionsForRow(int iRow) {
if (streamDetectionsSummary == null || streamDetectionsSummary.detectionsDocs == null) {
private NilusDataWrapper detectionsForRow(int iRow) {
if (combinedSummary == null || combinedSummary.detectionsDocs == null) {
return null;
}
if (iRow < 0 || iRow >= streamDetectionsSummary.detectionsDocs.size()) {
if (iRow < 0 || iRow >= combinedSummary.detectionsDocs.size()) {
return null;
}
return streamDetectionsSummary.detectionsDocs.get(iRow);
return combinedSummary.detectionsDocs.get(iRow);
}
private class TableModel extends AbstractTableModel {
private String[] colNames = {"Document", "Detector", "Deployment", "Effort", "Granularity", "Count", "Abstract"};
private String[] colNames = {"Document", "Detector", "Deployment", "Type", "Effort", "Granularity", "Count", "Abstract"};
@Override
public int getRowCount() {
if (streamDetectionsSummary == null || streamDetectionsSummary.detectionsDocs == null) {
if (combinedSummary == null || combinedSummary.detectionsDocs == null) {
return 0;
}
return streamDetectionsSummary.detectionsDocs.size();
return combinedSummary.detectionsDocs.size();
}
@Override
@ -351,28 +369,28 @@ public class DatablockDetectionsPanel extends TethysGUIPanel implements StreamTa
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
PDetections pDets = detectionsForRow(rowIndex);
NilusDataWrapper<PDetections> pDets = detectionsForRow(rowIndex);
return getValueAt(pDets, columnIndex);
}
private Object getValueAt(PDetections pDets, int columnIndex) {
private Object getValueAt(NilusDataWrapper<PDetections> pDets, int columnIndex) {
if (pDets == null) {
return null;
}
Detections dets = pDets.nilusObject;
if (dets == null) {
// PDetections dets = pDets.nilusObject;
if (pDets == null) {
return "Error in doc";
}
switch (columnIndex) {
case 0:
return dets.getId();
return pDets.getDocumentId();
case 1:
if (pDets.dataBlock == null) {
return null;
}
return pDets.dataBlock.getDataName();
case 2:
DataSourceType dataSource = dets.getDataSource();
DataSourceType dataSource = pDets.getDataSource();
if (dataSource == null) {
return null;
}
@ -380,28 +398,39 @@ public class DatablockDetectionsPanel extends TethysGUIPanel implements StreamTa
return dataSource.getDeploymentId();
}
case 3:
XMLGregorianCalendar start = dets.getEffort().getStart();
XMLGregorianCalendar stop = dets.getEffort().getEnd();
return start + " to " + stop;
return pDets.getCollection();
case 4:
List<DetectionEffortKind> kinds = dets.getEffort().getKind();
if (kinds == null) {
return null;
}
for (DetectionEffortKind kind : kinds) {
if (kind.getGranularity() != null) {
GranularityType granularity = kind.getGranularity();
return PDeployment.formatGranularity(granularity);
// if (granularity != null) {
// return granularity.getValue();
// }
// XMLGregorianCalendar start = dets.getEffort().getStart();
// XMLGregorianCalendar stop = dets.getEffort().getEnd();
XMLGregorianCalendar start = pDets.getEffortStart();
XMLGregorianCalendar stop = pDets.getEffortEnd();
return start + " to " + stop;
case 5:
Object effort = pDets.getGotObjects("getEffort");
if (effort instanceof DetectionEffort) {
DetectionEffort detectionEffort = (DetectionEffort) effort;
List<DetectionEffortKind> kinds = detectionEffort.getKind();
if (kinds == null) {
return null;
}
for (DetectionEffortKind kind : kinds) {
if (kind.getGranularity() != null) {
GranularityType granularity = kind.getGranularity();
return PDeployment.formatGranularity(granularity);
// if (granularity != null) {
// return granularity.getValue();
// }
}
}
}
break;
case 5:
return pDets.count;
case 6:
return dets.getDescription().getAbstract();
return pDets.count;
case 7:
DescriptionType desc = pDets.getDescription();
if (desc != null) {
return desc.getAbstract();
}
}
return null;
}