Embryonic data units

Data units flagged as embryonic don't get saved when first added to a
data block. will get saved when embryonic flag set false and an update
sent to the datablock. Useful when developing tracks which may continue
to grow as more data become available.
This commit is contained in:
Douglas Gillespie 2023-01-06 17:07:34 +00:00
parent b1016c0cc8
commit 8642834c1e
2 changed files with 30 additions and 3 deletions

View File

@ -1237,7 +1237,7 @@ public class PamDataBlock<Tunit extends PamDataUnit> extends PamObservable {
if (offlineDataLoading.isCurrentOfflineLoadKeep()) {
pamDataUnits.add(pamDataUnit);
}
if (shouldBinary && getBinaryDataSource() != null && !isOffline) {
if (shouldBinary && getBinaryDataSource() != null && !isOffline && pamDataUnit.isEmbryonic() == false) {
getBinaryDataSource().saveData(pamDataUnit);
}
}
@ -1311,8 +1311,14 @@ public class PamDataBlock<Tunit extends PamDataUnit> extends PamObservable {
public void updatePamData(Tunit pamDataUnit, long updateTimeMillis) {
pamDataUnit.updateDataUnit(updateTimeMillis);
setChanged();
if (!isOffline) {
if (getBinaryDataSource() != null && getBinaryDataSource().isSaveUpdates()) {
if (!isOffline && pamDataUnit.isEmbryonic() == false) {
/*
* Save it if it't not been saved already or we're saving updates.
* Detectors can keep a dataunit in an embryonic state and add them to the
* datablock so they get displayed, but they will still save when the embryonic
* flag is set false and an update is sent.
*/
if (getBinaryDataSource() != null && (getBinaryDataSource().isSaveUpdates() || pamDataUnit.getDataUnitFileInformation() == null)) {
getBinaryDataSource().saveData(pamDataUnit);
}
}

View File

@ -150,6 +150,13 @@ abstract public class PamDataUnit<T extends PamDataUnit, U extends PamDataUnit>
*/
private boolean forceAmpRecalc = false;
/**
* Flag to say that this is data under development. If this is set true
* then when the data are added to the datablock, they will not get saved
* to the binary store. They will get saved on the first update AFTER the
* embryonic flag is set false.
*/
private boolean embryonic = false;
/**
@ -1691,4 +1698,18 @@ abstract public class PamDataUnit<T extends PamDataUnit, U extends PamDataUnit>
public int getColourIndex() {
return (int) getUID();
}
/**
* @return the embryonic
*/
public boolean isEmbryonic() {
return embryonic;
}
/**
* @param embryonic the embryonic to set
*/
public void setEmbryonic(boolean embryonic) {
this.embryonic = embryonic;
}
}