public void update(StreetAddress address) { try { HashMap addressHashMap = address.toHashMap(); //Calendar calendar=Calendar.getInstance(); //String time = new String(new Long(calendar.getTimeInMillis()).toString()); HashMap whereKeyValuePairs = new HashMap(); whereKeyValuePairs.put(StreetAddressData.ID,address.getId()); whereKeyValuePairs.put(UserData.USERNAME,this.userName); super.updateWhere(whereKeyValuePairs, addressHashMap); this.setDefault(address.getId()); if(abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(abcs.logic.communication.log.config.type.LogConfigType.SQLLOGGING)) { LogUtil.put(LogFactory.getInstance("Command Success",this,"update")); } } catch(Exception e) { if(abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(abcs.logic.communication.log.config.type.LogConfigType.SQLLOGGING)) { LogUtil.put(LogFactory.getInstance("Command Failed",this,"add",e)); } } }
public void setDefault(String value) { try { HashMap updateKeyAndValue = new HashMap(); HashMap whereKeyAndValue = new HashMap(); whereKeyAndValue.put(UserData.USERNAME,userName); //remove old default value if it exist StreetAddress streetAddress = getDefault(); if(streetAddress!=null) { updateKeyAndValue.put(StreetAddressData.DEFAULT, StringUtil.getInstance().EMPTY_STRING); whereKeyAndValue.put(StreetAddressData.ID,streetAddress.getId()); super.updateWhere(whereKeyAndValue,updateKeyAndValue); } //now update new default whereKeyAndValue.put(StreetAddressData.ID,value); updateKeyAndValue.put(StreetAddressData.DEFAULT,StreetAddressData.DEFAULT); super.updateWhere(whereKeyAndValue,updateKeyAndValue); if(abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(abcs.logic.communication.log.config.type.LogConfigType.SQLLOGGING)) { LogUtil.put(LogFactory.getInstance("Command Success",this,"setDefault")); } } catch(Exception e) { if(abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(abcs.logic.communication.log.config.type.LogConfigType.SQLLOGGING)) { LogUtil.put(LogFactory.getInstance("Command Failed",this,"setShippingAddress",e)); } } }