@Override public int compareTo(PerunBean perunBean) { if(perunBean == null) throw new NullPointerException("PerunBean to compare with is null."); if(perunBean instanceof Service) { Service service = (Service) perunBean; if (this.getName() == null && service.getName() != null) return -1; if (service.getName() == null && this.getName() != null) return 1; if (this.getName() == null && service.getName() == null) return 0; return this.getName().compareToIgnoreCase(service.getName()); } else { return (this.getId() - perunBean.getId()); } } }
@Override public String serializeToString() { StringBuilder str = new StringBuilder(); return str.append(this.getClass().getSimpleName()).append(":[").append( "id=<").append(getId()).append(">").append( ", name=<").append(getName() == null ? "\\0" : BeansUtils.createEscaping(getName())).append(">").append( ", description=<").append(getDescription() == null ? "\\0" : BeansUtils.createEscaping(getDescription())).append(">").append( ", delay=<").append(this.getDelay()).append(">").append( ", recurrence=<").append(this.getRecurrence()).append(">").append( ", enabled=<").append(this.isEnabled()).append(">").append( ", script=<").append(getScript() == null ? "\\0" : BeansUtils.createEscaping(getScript())).append(">").append( ']').toString(); }
public ServiceForGUI(Service service){ setId(service.getId()); setName(service.getName()); setDescription(service.getDescription()); setDelay(service.getDelay()); setRecurrence(service.getRecurrence()); setScript(service.getScript()); setEnabled(service.isEnabled()); }