@Override protected void setDomainProperty(final DClass domain, final String name, final Object value) { // simple key? if (COLUMN_NAME_ID.equals(name)) { domain.setId((java.lang.Long) value); } // parent key? else if (COLUMN_NAME_RACEKEY.equals(name)) { domain.setRaceKey((java.lang.Object) value); } // fields else if (COLUMN_NAME_ACTUALSTART.equals(name)) { domain.setActualStart((java.util.Date) value); } else if (COLUMN_NAME_CREATEDBY.equals(name)) { domain.setCreatedBy((java.lang.String) value); } else if (COLUMN_NAME_CREATEDDATE.equals(name)) { domain.setCreatedDate((java.util.Date) value); } else if (COLUMN_NAME_NAME.equals(name)) { domain.setName((java.lang.String) value); } else if (COLUMN_NAME_SCHEDULEDSTART.equals(name)) { domain.setScheduledStart((java.util.Date) value); } else if (COLUMN_NAME_UPDATEDBY.equals(name)) { domain.setUpdatedBy((java.lang.String) value); } else if (COLUMN_NAME_UPDATEDDATE.equals(name)) { domain.setUpdatedDate((java.util.Date) value); } // one-to-ones // many-to-ones else if (COLUMN_NAME_TRACK.equals(name)) { DTrack foreign = null; if (null != value) { foreign = trackDao.createDomain(value); } domain.setTrack(foreign); } // many-to-manys else { super.setDomainProperty(domain, name, value); } }
@Override protected Object getDomainProperty(DClass domain, String name) { Object value; // simple key? if (COLUMN_NAME_ID.equals(name)) { value = domain.getId(); } // parent key? else if (COLUMN_NAME_RACEKEY.equals(name)) { value = domain.getRaceKey(); } // fields else if (COLUMN_NAME_ACTUALSTART.equals(name)) { value = domain.getActualStart(); } else if (COLUMN_NAME_CREATEDBY.equals(name)) { value = domain.getCreatedBy(); } else if (COLUMN_NAME_CREATEDDATE.equals(name)) { value = domain.getCreatedDate(); } else if (COLUMN_NAME_NAME.equals(name)) { value = domain.getName(); } else if (COLUMN_NAME_SCHEDULEDSTART.equals(name)) { value = domain.getScheduledStart(); } else if (COLUMN_NAME_UPDATEDBY.equals(name)) { value = domain.getUpdatedBy(); } else if (COLUMN_NAME_UPDATEDDATE.equals(name)) { value = domain.getUpdatedDate(); } // one-to-ones // many-to-ones else if (COLUMN_NAME_TRACK.equals(name)) { value = domain.getTrack(); } // many-to-manys else { value = super.getDomainProperty(domain, name); } return value; }
/** * Returns the class of the domain property for specified column * * @param name * @return the class of the domain property */ public Class getColumnClass(String name) { Class clazz; // simple key? if (COLUMN_NAME_ID.equals(name)) { clazz = java.lang.Long.class; } // parent key? else if (COLUMN_NAME_RACEKEY.equals(name)) { clazz = java.lang.Object.class; } // fields else if (COLUMN_NAME_ACTUALSTART.equals(name)) { clazz = java.util.Date.class; } else if (COLUMN_NAME_CREATEDBY.equals(name)) { clazz = java.lang.String.class; } else if (COLUMN_NAME_CREATEDDATE.equals(name)) { clazz = java.util.Date.class; } else if (COLUMN_NAME_NAME.equals(name)) { clazz = java.lang.String.class; } else if (COLUMN_NAME_SCHEDULEDSTART.equals(name)) { clazz = java.util.Date.class; } else if (COLUMN_NAME_UPDATEDBY.equals(name)) { clazz = java.lang.String.class; } else if (COLUMN_NAME_UPDATEDDATE.equals(name)) { clazz = java.util.Date.class; } // one-to-ones // many-to-ones else if (COLUMN_NAME_TRACK.equals(name)) { clazz = se.bassac.roster.domain.DTrack.class; } // many-to-manys else { throw new IllegalArgumentException("No such column " + name); } return clazz; }