From: <and...@us...> - 2016-12-25 19:28:26
|
Revision: 1443 http://sourceforge.net/p/ggc/code/1443 Author: andyrozman Date: 2016-12-25 19:28:24 +0000 (Sun, 25 Dec 2016) Log Message: ----------- ggc-cgms: 1.5.2 - Db changes - added new Extended Type Modified Paths: -------------- trunk/ggc-cgm/build/build.xml trunk/ggc-cgm/doc/Changelog trunk/ggc-cgm/pom.xml trunk/ggc-cgm/src/ggc/cgms/data/CGMSValuesExtendedEntry.java trunk/ggc-cgm/src/ggc/cgms/data/db/GGC_CGMSDb.java trunk/ggc-cgm/src/ggc/cgms/data/defs/CGMSAlarms.java trunk/ggc-cgm/src/ggc/cgms/manager/CGMSDevicesIds.java trunk/ggc-cgm/src/ggc/cgms/util/DataAccessCGMS.java Added Paths: ----------- trunk/ggc-cgm/src/ggc/cgms/data/ExtendedCGMSValueHandler.java trunk/ggc-cgm/src/ggc/cgms/data/ExtendedCGMSValueType.java Removed Paths: ------------- trunk/ggc-cgm/src/ggc/cgms/data/ExtendedCGMSValuesExtendedEntry.java Modified: trunk/ggc-cgm/build/build.xml =================================================================== --- trunk/ggc-cgm/build/build.xml 2016-12-25 19:22:53 UTC (rev 1442) +++ trunk/ggc-cgm/build/build.xml 2016-12-25 19:28:24 UTC (rev 1443) @@ -6,9 +6,9 @@ <!-- Environment properties read from a file ...--> <property file="../../build/AtechTools.properties"/> - <property file="../../ggc-core/build/GGC_Core_Version.properties"/> - <property file="../../ggc-plugin_base/build/GGCPlugInBaseBuild.properties"/> - <property file="../../ggc-plugin_base/build/GGCPlugInBaseVersion.properties"/> + <property file="../../ggc-core-app/ggc-core/build/GGC_Core_Version.properties"/> + <property file="../../ggc-plugins/ggc-plugins-base/build/GGCPlugInBaseBuild.properties"/> + <property file="../../ggc-plugins/ggc-plugins-base/build/GGCPlugInBaseVersion.properties"/> <property file="./GGCCGMSToolVersion.properties"/> <!-- These should *not* be modified on the command line! --> Modified: trunk/ggc-cgm/doc/Changelog =================================================================== --- trunk/ggc-cgm/doc/Changelog 2016-12-25 19:22:53 UTC (rev 1442) +++ trunk/ggc-cgm/doc/Changelog 2016-12-25 19:28:24 UTC (rev 1443) @@ -2,8 +2,11 @@ Changes file for GGC CGM Tool ============================== --- We will move to version 2.0, when Minimed and at least one of Abbott CGMSes is supported (Navigator 1.x or 2.x) +-- We will move to version 2.0, when Minimed is supported (Navigator 1.x or 2.x) +1.5.2 [25.12.2016] [Andy] +- Db changes +- added new Extended Type 1.5.1 [26.5.2016] [Andy] - refactorings (code, db) Modified: trunk/ggc-cgm/pom.xml =================================================================== --- trunk/ggc-cgm/pom.xml 2016-12-25 19:22:53 UTC (rev 1442) +++ trunk/ggc-cgm/pom.xml 2016-12-25 19:28:24 UTC (rev 1443) @@ -5,7 +5,7 @@ <groupId>net.sf.ggc</groupId> <artifactId>ggc-parent</artifactId> <version>1.0-SNAPSHOT</version> - <relativePath>../ggc-master-pom/pom.xml</relativePath> + <relativePath>../ggc-removed/ggc-master-pom/pom.xml</relativePath> </parent> <name>GGC CGMS Tool Project</name> Modified: trunk/ggc-cgm/src/ggc/cgms/data/CGMSValuesExtendedEntry.java =================================================================== --- trunk/ggc-cgm/src/ggc/cgms/data/CGMSValuesExtendedEntry.java 2016-12-25 19:22:53 UTC (rev 1442) +++ trunk/ggc-cgm/src/ggc/cgms/data/CGMSValuesExtendedEntry.java 2016-12-25 19:28:24 UTC (rev 1443) @@ -1,12 +1,12 @@ package ggc.cgms.data; import java.util.HashMap; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.hibernate.Session; import org.hibernate.Transaction; -import com.atech.db.ext.ExtendedHandler; import com.atech.misc.statistics.StatisticsItem; import com.atech.utils.data.ATechDate; import com.atech.utils.data.ATechDateType; @@ -427,37 +427,42 @@ } + private ExtendedCGMSValueHandler getExtendedHandler() + { + return (ExtendedCGMSValueHandler) CGMSUtil.getExtendedHandler(this.getDVEName()); + } + + private void loadExtended(String extended2) { - ExtendedHandler handler = CGMSUtil.getExtendedHandler(this.getDVEName()); - HashMap<String, String> data = handler.loadExtended(extended2); + ExtendedCGMSValueHandler handler = getExtendedHandler(); + Map<ExtendedCGMSValueType, String> data = handler.loadExtended(extended2); - if (handler.isExtendedValueSet(ExtendedCGMSValuesExtendedEntry.EXTENDED_SUB_TYPE, data)) + if (handler.isExtendedValueSet(ExtendedCGMSValueType.SubType, data)) { - this.subType = Integer - .parseInt(handler.getExtendedValue(ExtendedCGMSValuesExtendedEntry.EXTENDED_SUB_TYPE, data)); + this.subType = Integer.parseInt(handler.getExtendedValue(ExtendedCGMSValueType.SubType, data)); } - if (handler.isExtendedValueSet(ExtendedCGMSValuesExtendedEntry.EXTENDED_SUB_TYPE, data)) + if (handler.isExtendedValueSet(ExtendedCGMSValueType.Source, data)) { - this.source = handler.getExtendedValue(ExtendedCGMSValuesExtendedEntry.EXTENDED_SOURCE, data); + this.source = handler.getExtendedValue(ExtendedCGMSValueType.Source, data); } } private String saveExtended() { - ExtendedHandler handler = CGMSUtil.getExtendedHandler(this.getDVEName()); - HashMap<String, String> data = new HashMap<String, String>(); + ExtendedCGMSValueHandler handler = getExtendedHandler(); + Map<ExtendedCGMSValueType, String> data = new HashMap<ExtendedCGMSValueType, String>(); if (this.subType > 0) { - handler.setExtendedValue(ExtendedCGMSValuesExtendedEntry.EXTENDED_SUB_TYPE, "" + this.subType, data); + handler.setExtendedValue(ExtendedCGMSValueType.SubType, "" + this.subType, data); } if (StringUtils.isNotBlank(this.source)) { - handler.setExtendedValue(ExtendedCGMSValuesExtendedEntry.EXTENDED_SOURCE, this.source, data); + handler.setExtendedValue(ExtendedCGMSValueType.Source, this.source, data); } String ext = handler.saveExtended(data); Added: trunk/ggc-cgm/src/ggc/cgms/data/ExtendedCGMSValueHandler.java =================================================================== --- trunk/ggc-cgm/src/ggc/cgms/data/ExtendedCGMSValueHandler.java (rev 0) +++ trunk/ggc-cgm/src/ggc/cgms/data/ExtendedCGMSValueHandler.java 2016-12-25 19:28:24 UTC (rev 1443) @@ -0,0 +1,51 @@ +package ggc.cgms.data; + +import com.atech.db.ext.ExtendedEnumHandler; + +/** + * Application: GGC - GNU Gluco Control + * + * See AUTHORS for copyright information. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + * + * Filename: ExtendedDailyValueHandler + * Description: Extended DailyValue Handler + * + * @author Andy {an...@at...} + */ + +public class ExtendedCGMSValueHandler extends ExtendedEnumHandler<ExtendedCGMSValueType> +{ + + // private String extended; + + // private String[] extended_arr; + + // private boolean changed = false; + // boolean debug = false; + + public ExtendedCGMSValueHandler() + { + super(ExtendedCGMSValueType.None, "CGMSValuesExtendedEntry"); + } + + // @Override + // public String getExtendedObject() + // { + // return "DailyValuesRow"; + // } + +} Added: trunk/ggc-cgm/src/ggc/cgms/data/ExtendedCGMSValueType.java =================================================================== --- trunk/ggc-cgm/src/ggc/cgms/data/ExtendedCGMSValueType.java (rev 0) +++ trunk/ggc-cgm/src/ggc/cgms/data/ExtendedCGMSValueType.java 2016-12-25 19:28:24 UTC (rev 1443) @@ -0,0 +1,89 @@ +package ggc.cgms.data; + +import java.util.HashMap; +import java.util.Map; + +import com.atech.db.ext.ExtendedEnumType; + +public enum ExtendedCGMSValueType implements ExtendedEnumType<ExtendedCGMSValueType> +{ + + None("NONE"), // + SubType("SUB_TYPE"), // + Source("SOURCE"), // + ; + + int code; + String i18nKey; + String translation; + + static Map<String, ExtendedCGMSValueType> mapByKey; + static Map<String, ExtendedCGMSValueType> mapByName; + + static + { + mapByKey = new HashMap<String, ExtendedCGMSValueType>(); + mapByName = new HashMap<String, ExtendedCGMSValueType>(); + + for (ExtendedCGMSValueType vt : values()) + { + mapByKey.put(vt.getI18nKey(), vt); + mapByName.put(vt.name(), vt); + } + } + + + ExtendedCGMSValueType(String i18nKey) + { + this.i18nKey = i18nKey; + } + + + public ExtendedCGMSValueType getEnumTypeByKey(String key) + { + return mapByKey.get(key); + } + + + public ExtendedCGMSValueType getEnumTypeByName(String key) + { + return mapByName.get(key); + } + + + public String getI18nKey() + { + return this.i18nKey; + } + + + public String getTranslation() + { + return this.translation; + } + + + public void setTranslation(String translation) + { + this.translation = translation; + } + + + public String getName() + { + return name(); + } + + + public boolean useI18nKey() + { + return true; + } + + + public ExtendedCGMSValueType[] getAllValues() + { + return values(); + } + +} Deleted: trunk/ggc-cgm/src/ggc/cgms/data/ExtendedCGMSValuesExtendedEntry.java =================================================================== --- trunk/ggc-cgm/src/ggc/cgms/data/ExtendedCGMSValuesExtendedEntry.java 2016-12-25 19:22:53 UTC (rev 1442) +++ trunk/ggc-cgm/src/ggc/cgms/data/ExtendedCGMSValuesExtendedEntry.java 2016-12-25 19:28:24 UTC (rev 1443) @@ -1,39 +0,0 @@ -package ggc.cgms.data; - -import java.util.Hashtable; - -import com.atech.db.ext.ExtendedHandler; -import com.atech.utils.ATDataAccessAbstract; - -public class ExtendedCGMSValuesExtendedEntry extends ExtendedHandler -{ - - public static final int EXTENDED_SUB_TYPE = 0; - public static final int EXTENDED_SOURCE = 1; - - private static final int EXTENDED_MAX = 1; - - - public ExtendedCGMSValuesExtendedEntry(ATDataAccessAbstract da) - { - super(da); - - } - - - @Override - public void initExtended() - { - ext_mapped_types = new Hashtable<Integer, String>(); - ext_mapped_types.put(ExtendedCGMSValuesExtendedEntry.EXTENDED_SUB_TYPE, "SUB_TYPE"); - ext_mapped_types.put(ExtendedCGMSValuesExtendedEntry.EXTENDED_SOURCE, "SOURCE"); - } - - - @Override - public String getExtendedObject() - { - return "CGMSValuesExtendedEntry"; - } - -} Modified: trunk/ggc-cgm/src/ggc/cgms/data/db/GGC_CGMSDb.java =================================================================== --- trunk/ggc-cgm/src/ggc/cgms/data/db/GGC_CGMSDb.java 2016-12-25 19:22:53 UTC (rev 1442) +++ trunk/ggc-cgm/src/ggc/cgms/data/db/GGC_CGMSDb.java 2016-12-25 19:28:24 UTC (rev 1443) @@ -16,6 +16,7 @@ import com.atech.graphics.graphs.v2.data.GraphDbDataRetriever; import com.atech.graphics.graphs.v2.data.GraphDefinitionDto; import com.atech.graphics.graphs.v2.data.GraphTimeDataCollection; +import com.atech.utils.ATDataAccessAbstract; import com.atech.utils.data.ATechDate; import com.atech.utils.data.ATechDateType; @@ -25,6 +26,7 @@ import ggc.core.db.hibernate.cgms.CGMSDataH; import ggc.plugin.data.DeviceValuesDay; import ggc.plugin.data.DeviceValuesEntryInterface; +import ggc.plugin.data.DeviceValuesRange; import ggc.plugin.db.PluginDb; /** @@ -124,6 +126,59 @@ /** + * Get Pump Values Range + * + * @param from + * @param to + * @return + */ + public DeviceValuesRange getRangePumpValues(GregorianCalendar from, GregorianCalendar to) + { + ATDataAccessAbstract.notImplemented("GGC_CGMSDb::getRangePumpValues()"); + return null; + + /* + * log.info("getPumpDayStats()"); + * long dt_from = ATechDate.getATDateTimeFromGC(from, + * ATechDate.FORMAT_DATE_ONLY); + * long dt_to = ATechDate.getATDateTimeFromGC(to, + * ATechDate.FORMAT_DATE_ONLY); + * String sql = ""; + * DeviceValuesRange dvr = new + * DeviceValuesRange(DataAccessPump.getInstance(), from, to); + * try + * { + * sql = "SELECT dv from " + + * "ggc.core.db.hibernate.pump.PumpDataH as dv " + + * "WHERE dv.dt_info >= " + dt_from + * + "000000 AND dv.dt_info <= " + dt_to + "235959 ORDER BY dv.dt_info"; + * //System.out.println("SQL: " + sql); + * Query q = this.db.getSession().createQuery(sql); + * Iterator<?> it = q.list().iterator(); + * while (it.hasNext()) + * { + * PumpDataH pdh = (PumpDataH)it.next(); + * PumpValuesEntry dv = new PumpValuesEntry(pdh); + * dvr.addEntry(dv); + * } + * ArrayList<PumpValuesEntryExt> lst_ext = + * getRangePumpValuesExtended(from, to); + * mergeRangePumpData(dvr, lst_ext); + * // ArrayList<PumpValuesEntryExt> lst_ext = + * getDailyPumpValuesExtended(gc); + * // mergeDailyPumpData(dV, lst_ext); + * } + * catch (Exception ex) + * { + * log.debug("Sql: " + sql); + * log.error("getDayStats(). Exception: " + ex, ex); + * } + * return dvr; + */ + } + + + /** * Get All Elements Count * * @return Modified: trunk/ggc-cgm/src/ggc/cgms/data/defs/CGMSAlarms.java =================================================================== --- trunk/ggc-cgm/src/ggc/cgms/data/defs/CGMSAlarms.java 2016-12-25 19:22:53 UTC (rev 1442) +++ trunk/ggc-cgm/src/ggc/cgms/data/defs/CGMSAlarms.java 2016-12-25 19:28:24 UTC (rev 1443) @@ -65,6 +65,7 @@ static Hashtable<String, CGMSAlarms> translationMapping = new Hashtable<String, CGMSAlarms>(); static Hashtable<Integer, CGMSAlarms> codeMapping = new Hashtable<Integer, CGMSAlarms>(); + static { I18nControlAbstract ic = DataAccessCGMS.getInstance().getI18nControlInstance(); @@ -137,4 +138,9 @@ return codeMapping.values(); } + // public CodeEnumWithTranslation[] values() + // { + // return values(); + // } + } Modified: trunk/ggc-cgm/src/ggc/cgms/manager/CGMSDevicesIds.java =================================================================== --- trunk/ggc-cgm/src/ggc/cgms/manager/CGMSDevicesIds.java 2016-12-25 19:22:53 UTC (rev 1442) +++ trunk/ggc-cgm/src/ggc/cgms/manager/CGMSDevicesIds.java 2016-12-25 19:28:24 UTC (rev 1443) @@ -104,10 +104,13 @@ public static final int CGMS_MINIMED_640G = 30007; /** - * CGMS (Minimed) - Minimed RealTime + * CGMS (Animas) - Animas Vibe (Dexcom 4 integration) */ public static final int CGMS_ANIMAS_VIBE_DEXCOM_INTEGRATION = 40001; + /** + * CGMS (Tandem) - Tandem G4 (Dexcom 4 integration) + */ public static final int CGMS_TANDEM_TSLIM_G4_DEXCOM_INTEGRATION = 50001; } Modified: trunk/ggc-cgm/src/ggc/cgms/util/DataAccessCGMS.java =================================================================== --- trunk/ggc-cgm/src/ggc/cgms/util/DataAccessCGMS.java 2016-12-25 19:22:53 UTC (rev 1442) +++ trunk/ggc-cgm/src/ggc/cgms/util/DataAccessCGMS.java 2016-12-25 19:28:24 UTC (rev 1443) @@ -7,7 +7,7 @@ import ggc.cgms.data.CGMSDataHandler; import ggc.cgms.data.CGMSDataReader; import ggc.cgms.data.CGMSValuesEntry; -import ggc.cgms.data.ExtendedCGMSValuesExtendedEntry; +import ggc.cgms.data.ExtendedCGMSValueHandler; import ggc.cgms.data.cfg.CGMSConfigurationDefinition; import ggc.cgms.data.db.GGC_CGMSDb; import ggc.cgms.data.graph.v2.CGMSGraphContext; @@ -389,7 +389,7 @@ public void loadExtendedHandlers() { this.addExtendedHandler(DataAccessCGMS.EXTENDED_HANDLER_CGMSValuesExtendedEntry, - new ExtendedCGMSValuesExtendedEntry(this)); + new ExtendedCGMSValueHandler()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |