Issue #647: Ensure records with the same data URI get archived only
once, implement PerisistableDataObject.getIdentifier and setIdentifier for StdTextProduct. Former-commit-id:34303477ac
[formerly 0692f9923e450c9b7e62b044b122aad7323991ba] Former-commit-id:95e1582a22
This commit is contained in:
parent
513d0e6280
commit
855745db06
2 changed files with 40 additions and 2 deletions
|
@ -57,6 +57,7 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
|||
* Jul 10, 2009 2191 rjpeter Reimplemented.
|
||||
* 04/06/2010 4734 mhuang Moved from edex server
|
||||
* 17May2010 2187 cjeanbap Change class to be Abstract
|
||||
* 27 May 2012 #647 dgilling Implement getIdentifier/setIdentifier.
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
|
@ -164,6 +165,32 @@ public abstract class StdTextProduct extends PersistableDataObject implements
|
|||
aProductToCopy.getRefTime(), aProductToCopy.getProduct());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.common.dataplugin.persist.PersistableDataObject#getIdentifier
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
public StdTextProductId getIdentifier() {
|
||||
return this.prodId;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.common.dataplugin.persist.PersistableDataObject#setIdentifier
|
||||
* (java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void setIdentifier(Object identifier) {
|
||||
if (identifier instanceof StdTextProductId) {
|
||||
setProdId((StdTextProductId) identifier);
|
||||
}
|
||||
}
|
||||
|
||||
public String getBbbid() {
|
||||
return this.bbbid;
|
||||
}
|
||||
|
|
|
@ -26,10 +26,12 @@ import java.io.IOException;
|
|||
import java.io.OutputStream;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -320,8 +322,17 @@ public class DatabaseArchiver implements IPluginArchiver {
|
|||
statusHandler.debug(pluginName + ": Read in " + prev.size()
|
||||
+ " records from disk");
|
||||
|
||||
prev.addAll(pdosToSerialize);
|
||||
pdosToSerialize = prev;
|
||||
// merge records by data URI
|
||||
Map<Object, PersistableDataObject> dataMap = new LinkedHashMap<Object, PersistableDataObject>();
|
||||
for (PersistableDataObject pdo : prev) {
|
||||
dataMap.put(pdo.getIdentifier(), pdo);
|
||||
}
|
||||
for (PersistableDataObject pdo : pdosToSerialize) {
|
||||
dataMap.put(pdo.getIdentifier(), pdo);
|
||||
}
|
||||
|
||||
pdosToSerialize = new ArrayList<PersistableDataObject>(
|
||||
dataMap.values());
|
||||
}
|
||||
|
||||
statusHandler.debug(pluginName + ": Serializing "
|
||||
|
|
Loading…
Add table
Reference in a new issue