/*
 * This file is part of DebGen Biobank Software developed by ASTRID Research.
 * All rights reserved. Reproduction, modification, use or disclosure
 * to third parties without express authority is forbidden.
 *
 * Copyright ASTRID Research Inc., Hungary, 2009-2011.
 *
 * ASTRID Research
 * Headquaters: Csapo utca 42. Debrecen H-4029 HUNGARY
 * Phone: +36-52-533-173        Fax: +36-52-533-174
 * Web: http://www.astrid.hu    E-mail: info@astrid.hu
 *
 * Project name: DebGen Biobank Software project.
 * URLS:
 * Developers: Istvan Zoltan Nagy (istvan.nagy@astrid.hu)
 */
package hu.astrid.debgen.patientmanagement.domain.modules;

import java.util.Date;

/**
 * The superclass of moduls and analysys requests
 * @author inagy
 */
public abstract class DebGenModule implements Comparable {

    public abstract String getCreatedOnForWeb();

    public abstract Date getCreatedOn();

    public abstract Long getId();

    public abstract String getLocalizeableName();

    public abstract String getClassType();

    public int compareTo(Object o) {
        if (this.getCreatedOn() == null) {
            return -1;
        }
        DebGenModule other = (DebGenModule) o;
        int res = 0 - this.getCreatedOn().compareTo(other.getCreatedOn());
        if (res == 0) {
            return this.getId().compareTo(other.getId());
        } else {
            return res;
        }
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final DebGenModule other = (DebGenModule) obj;
        if (this.getId() != other.getId() && (this.getId() == null || !this.getId().equals(other.getId()))) {
            return false;
        }
        if (this.getCreatedOn() != other.getCreatedOn() && (this.getCreatedOn() == null || !this.getCreatedOn().equals(other.getCreatedOn()))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 41 * hash + (this.getId() != null ? this.getId().hashCode() : 0);
        hash = 41 * hash + (this.getCreatedOn() != null ? this.getCreatedOn().hashCode() : 0);
        return hash;
    }
}
