=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSetting.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSetting.java 2012-02-02 20:01:36 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSetting.java 2013-05-14 14:29:45 +0000 @@ -31,9 +31,9 @@ /** * @author Stian Strandli - * @version $Id: SystemSetting.java 3340 2007-06-03 04:01:04Z hanssto $ */ public class SystemSetting + implements Serializable { private int id; @@ -41,16 +41,28 @@ private Serializable value; + // ------------------------------------------------------------------------- + // Constructor + // ------------------------------------------------------------------------- + public SystemSetting() { } - + + // ------------------------------------------------------------------------- + // Logic + // ------------------------------------------------------------------------- + public boolean hasValue() { return value != null; } + // ------------------------------------------------------------------------- + // Getters and setters + // ------------------------------------------------------------------------- + public int getId() { return id; @@ -81,4 +93,41 @@ this.value = value; } + // ------------------------------------------------------------------------- + // hashCode and equals + // ------------------------------------------------------------------------- + + @Override + public boolean equals( Object o ) + { + if ( this == o ) + { + return true; + } + + if ( o == null ) + { + return false; + } + + if ( !(o instanceof SystemSetting) ) + { + return false; + } + + final SystemSetting other = (SystemSetting) o; + + return name.equals( other.getName() ); + } + + @Override + public int hashCode() + { + int prime = 31; + int result = 1; + + result = result * prime + name.hashCode(); + + return result; + } }