/kickup/trunk/src/ak/kickup/core/model/Event.java |
---|
0,0 → 1,314 |
package ak.kickup.core.model; |
import java.math.BigDecimal; |
import java.util.Collection; |
import java.util.Collections; |
import java.util.ArrayList; |
import java.util.Iterator; |
import java.util.Date; |
import java.util.Map; |
import java.util.HashMap; |
import ak.kickup.util.ModelException; |
import ak.kickup.util.ModelSecurityException; |
/** |
* |
* @hibernate.class table="events" |
*/ |
public class Event |
extends GeneralModelObject |
{ |
private String name; |
private String place; |
private String address; |
private String transportDesc; |
private Date start; |
private Date stop; |
private Date lastRegister; |
private Date lastUnregister; |
private BigDecimal price; |
private String moneyAccount; |
private Boolean enabled; |
private String comment; |
private Collection acts; // Collection(EventAct) |
private Map actsMap = new HashMap(); // Map(Long id -> EventAct) |
private Collection apartments; // Collection(EventApartment) |
private Map apartmentsMap = new HashMap(); // Map(Long id -> EventApartment) |
protected Event() |
{ |
} |
protected void init() |
{ |
acts = new ArrayList(); |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getName() |
{ |
return name; |
} |
public void setName(String name) |
{ |
this.name = name; |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getPlace() |
{ |
return place; |
} |
public void setPlace(String place) |
{ |
this.place = place; |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getAddress() |
{ |
return address; |
} |
public void setAddress(String address) |
{ |
this.address = address; |
} |
/** |
* |
* @hibernate.property column="transport_desc" |
*/ |
public String getTransportDesc() |
{ |
return transportDesc; |
} |
public void setTransportDesc(String transportDesc) |
{ |
this.transportDesc = transportDesc; |
} |
/** |
* |
* @hibernate.property |
*/ |
public Date getStart() |
{ |
return start; |
} |
public void setStart(Date start) |
{ |
this.start = start; |
} |
/** |
* |
* @hibernate.property |
*/ |
public Date getStop() |
{ |
return stop; |
} |
public void setStop(Date stop) |
{ |
this.stop = stop; |
} |
/** |
* |
* @hibernate.property column="last_register" |
*/ |
public Date getLastRegister() |
{ |
return lastRegister; |
} |
public void setLastRegister(Date lastRegister) |
{ |
this.lastRegister = lastRegister; |
} |
/** |
* |
* @hibernate.property column="last_unregister" |
*/ |
public Date getLastUnregister() |
{ |
return lastUnregister; |
} |
public void setLastUnregister(Date lastUnregister) |
{ |
this.lastUnregister = lastUnregister; |
} |
/** |
* |
* @hibernate.property |
*/ |
public BigDecimal getPrice() |
{ |
return price; |
} |
public void setPrice(BigDecimal price) |
{ |
this.price = price; |
} |
/** |
* |
* @hibernate.property column="money_account" |
*/ |
public String getMoneyAccount() |
{ |
return moneyAccount; |
} |
public void setMoneyAccount(String moneyAccount) |
{ |
this.moneyAccount = moneyAccount; |
} |
/** |
* |
* @hibernate.property |
*/ |
public Boolean getEnabled() |
{ |
return enabled; |
} |
public void setEnabled(Boolean enabled) |
{ |
this.enabled = enabled; |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getComment() |
{ |
return comment; |
} |
public void setComment(String comment) |
{ |
this.comment = comment; |
} |
/** |
* @return Collection(EventAct) |
* |
* @hibernate.bag inverse="true" cascade="all-delete-orphan" lazy="true" |
* @hibernate.collection-key column="event" |
* @hibernate.collection-one-to-many class="ak.kickup.core.model.EventAct" |
*/ |
protected Collection getActs() |
{ |
return acts; |
} |
public Collection getActCollection() |
{ |
return Collections.unmodifiableCollection(acts); |
} |
/** |
* @param destinations Collection(EventAct) |
*/ |
protected void setActs(Collection acts) |
{ |
this.acts = acts; |
actsMap.clear(); |
if(acts != null) { |
for(Iterator i = acts.iterator(); i.hasNext(); ) { |
EventAct a = (EventAct)i.next(); |
actsMap.put(a.getAct().getId(), a); |
} |
} |
} |
public EventAct getAct(Long actId) |
{ |
return (EventAct)actsMap.get(actId); |
} |
public void addAct(EventAct act) |
{ |
acts.add(act); |
actsMap.put(act.getAct().getId(), act); |
} |
public void removeAct(EventAct act) |
{ |
acts.remove(act); |
actsMap.remove(act.getAct().getId()); |
} |
/** |
* @return Collection(EventApartment) |
* |
* @hibernate.bag inverse="true" cascade="all-delete-orphan" lazy="true" |
* @hibernate.collection-key column="event" |
* @hibernate.collection-one-to-many class="ak.kickup.core.model.EventApartment" |
*/ |
protected Collection getApartments() |
{ |
return apartments; |
} |
public Collection getApartmentCollection() |
{ |
return Collections.unmodifiableCollection(apartments); |
} |
/** |
* @param destinations Collection(EventApartment) |
*/ |
protected void setApartments(Collection apartments) |
{ |
this.apartments = apartments; |
apartmentsMap.clear(); |
if(apartments != null) { |
for(Iterator i = apartments.iterator(); i.hasNext(); ) { |
EventApartment a = (EventApartment)i.next(); |
apartmentsMap.put(a.getApartment().getId(), a); |
} |
} |
} |
public EventApartment getApartment(Long apartmentId) |
{ |
return (EventApartment)apartmentsMap.get(apartmentId); |
} |
public void addApartment(EventApartment apartment) |
{ |
apartments.add(apartment); |
apartmentsMap.put(apartment.getApartment().getId(), apartment); |
} |
public void removeApartment(EventApartment apartment) |
{ |
apartments.remove(apartment); |
apartmentsMap.remove(apartment.getApartment().getId()); |
} |
} |
/kickup/trunk/src/ak/kickup/core/model/ActManager.java |
---|
0,0 → 1,151 |
package ak.kickup.core.model; |
import java.util.*; |
import net.sf.hibernate.*; |
import net.sf.hibernate.type.Type; |
import ak.kickup.util.HibernateUtil; |
import ak.kickup.util.ModelException; |
import ak.kickup.util.ModelSecurityException; |
public class ActManager |
{ |
private static ActManager actManager = null; |
private static boolean registered = false; |
public static ActManager getInstance() |
{ |
return actManager; |
} |
protected static void register() |
{ |
synchronized(ActManager.class) { |
if(registered) return; |
registered = true; |
try { |
HibernateUtil.getConfiguration().addResource( |
"ak/kickup/core/model/Act.hbm.xml"); |
actManager = new ActManager(); |
} |
catch(Exception ex) { |
ex.printStackTrace(); |
throw new RuntimeException(ex.getMessage()); |
} |
} |
} |
static { |
register(); |
} |
private ActManager() |
{ |
} |
public Act create() |
throws ModelException |
{ |
return new Act(); |
} |
public Act get(Long id) |
throws ModelException |
{ |
try { |
return (Act)HibernateUtil.currentSession().load(Act.class, id); |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public boolean nameExists(Act act, String name) |
throws ModelException |
{ |
try { |
if(act.getId() == null) |
return ((Integer)HibernateUtil.currentSession().iterate( |
"select count(*) from Act where name = ?", |
name, Hibernate.STRING) |
.next()).intValue() > 0; |
else |
return ((Integer)HibernateUtil.currentSession().iterate( |
"select count(*) from Act a where name = ? and a != ?", |
new Object[] { name, act }, |
new Type[] { Hibernate.STRING, Hibernate.entity(Act.class) } ) |
.next()).intValue() > 0; |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public void save(Act act) |
throws ModelException |
{ |
try { |
HibernateUtil.currentSession().saveOrUpdate(act); |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public void delete(Act act) |
throws ModelException |
{ |
try { |
HibernateUtil.currentSession().delete(act); |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public Collection listActs() |
throws ModelException |
{ |
try { |
return HibernateUtil.currentSession().find("from Act"); |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public static final Comparator NAME_COMPARATOR = new NameComparator(); |
private static class NameComparator |
implements Comparator |
{ |
public int compare(Object o1, Object o2) |
{ |
if(!(o1 instanceof Act) || !(o2 instanceof Act)) |
throw new ClassCastException("not a Act"); |
Act a1 = (Act)o1; |
Act a2 = (Act)o2; |
if(a1 == null && a2 == null) |
return 0; |
else if(a1 == null && a2 != null) |
return -1; |
else if(a1 != null && a2 == null) |
return 1; |
else |
return a1.getName().compareToIgnoreCase(a2.getName()); |
} |
public boolean equals(Object obj) |
{ |
return (obj instanceof NameComparator); |
} |
} |
} |
/kickup/trunk/src/ak/kickup/core/model/GeneralModelObject.java |
---|
0,0 → 1,37 |
package ak.kickup.core.model; |
import java.util.Date; |
public abstract class GeneralModelObject |
{ |
private Long id; |
private Date modStamp; |
/** |
* |
* @hibernate.id generator-class="native" |
*/ |
public Long getId() |
{ |
return id; |
} |
protected void setId(Long id) |
{ |
this.id = id; |
} |
/** |
* |
* @hibernate.timestamp column="mod_stamp" |
*/ |
public Date getModStamp() |
{ |
return modStamp; |
} |
public void setModStamp(Date modStamp) |
{ |
this.modStamp = modStamp; |
} |
} |
/kickup/trunk/src/ak/kickup/core/model/ApartmentManager.java |
---|
0,0 → 1,151 |
package ak.kickup.core.model; |
import java.util.*; |
import net.sf.hibernate.*; |
import net.sf.hibernate.type.Type; |
import ak.kickup.util.HibernateUtil; |
import ak.kickup.util.ModelException; |
import ak.kickup.util.ModelSecurityException; |
public class ApartmentManager |
{ |
private static ApartmentManager apartmentManager = null; |
private static boolean registered = false; |
public static ApartmentManager getInstance() |
{ |
return apartmentManager; |
} |
protected static void register() |
{ |
synchronized(ApartmentManager.class) { |
if(registered) return; |
registered = true; |
try { |
HibernateUtil.getConfiguration().addResource( |
"ak/kickup/core/model/Apartment.hbm.xml"); |
apartmentManager = new ApartmentManager(); |
} |
catch(Exception ex) { |
ex.printStackTrace(); |
throw new RuntimeException(ex.getMessage()); |
} |
} |
} |
static { |
register(); |
} |
private ApartmentManager() |
{ |
} |
public Apartment create() |
throws ModelException |
{ |
return new Apartment(); |
} |
public Apartment get(Long id) |
throws ModelException |
{ |
try { |
return (Apartment)HibernateUtil.currentSession().load(Apartment.class, id); |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public boolean nameExists(Apartment apartment, String name) |
throws ModelException |
{ |
try { |
if(apartment.getId() == null) |
return ((Integer)HibernateUtil.currentSession().iterate( |
"select count(*) from Apartment where name = ?", |
name, Hibernate.STRING) |
.next()).intValue() > 0; |
else |
return ((Integer)HibernateUtil.currentSession().iterate( |
"select count(*) from Apartment a where name = ? and a != ?", |
new Object[] { name, apartment }, |
new Type[] { Hibernate.STRING, Hibernate.entity(Apartment.class) } ) |
.next()).intValue() > 0; |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public void save(Apartment apartment) |
throws ModelException |
{ |
try { |
HibernateUtil.currentSession().saveOrUpdate(apartment); |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public void delete(Apartment apartment) |
throws ModelException |
{ |
try { |
HibernateUtil.currentSession().delete(apartment); |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public Collection listApartments() |
throws ModelException |
{ |
try { |
return HibernateUtil.currentSession().find("from Apartment"); |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public static final Comparator NAME_COMPARATOR = new NameComparator(); |
private static class NameComparator |
implements Comparator |
{ |
public int compare(Object o1, Object o2) |
{ |
if(!(o1 instanceof Apartment) || !(o2 instanceof Apartment)) |
throw new ClassCastException("not a Apartment"); |
Apartment a1 = (Apartment)o1; |
Apartment a2 = (Apartment)o2; |
if(a1 == null && a2 == null) |
return 0; |
else if(a1 == null && a2 != null) |
return -1; |
else if(a1 != null && a2 == null) |
return 1; |
else |
return a1.getName().compareToIgnoreCase(a2.getName()); |
} |
public boolean equals(Object obj) |
{ |
return (obj instanceof NameComparator); |
} |
} |
} |
/kickup/trunk/src/ak/kickup/core/model/Act.java |
---|
0,0 → 1,56 |
package ak.kickup.core.model; |
import java.util.Date; |
import ak.kickup.util.ModelException; |
import ak.kickup.util.ModelSecurityException; |
/** |
* |
* @hibernate.class table="acts" |
*/ |
public class Act |
extends GeneralModelObject |
{ |
private String name; |
private String comment; |
protected Act() |
{ |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getName() |
{ |
return name; |
} |
public void setName(String name) |
{ |
this.name = name; |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getComment() |
{ |
return comment; |
} |
public void setComment(String comment) |
{ |
this.comment = comment; |
} |
public boolean equals(Object o) |
{ |
if(o == null || !(o instanceof Act)) return false; |
Act a = (Act)o; |
return (getId() != null) && (a.getId() != null) && (getId().equals(a.getId())); |
} |
} |
/kickup/trunk/src/ak/kickup/core/model/EventAct.java |
---|
0,0 → 1,64 |
package ak.kickup.core.model; |
import java.util.Date; |
import ak.kickup.util.ModelException; |
import ak.kickup.util.ModelSecurityException; |
/** |
* |
* @hibernate.class table="event_acts" |
*/ |
public class EventAct |
extends GeneralModelObject |
{ |
private Event event; |
private Act act; |
private String comment; |
private Date modStamp; |
protected EventAct() |
{ |
} |
/** |
* |
* @hibernate.many-to-one |
*/ |
public Event getEvent() |
{ |
return event; |
} |
public void setEvent(Event event) |
{ |
this.event = event; |
} |
/** |
* |
* @hibernate.many-to-one |
*/ |
public Act getAct() |
{ |
return act; |
} |
public void setAct(Act act) |
{ |
this.act = act; |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getComment() |
{ |
return comment; |
} |
public void setComment(String comment) |
{ |
this.comment = comment; |
} |
} |
/kickup/trunk/src/ak/kickup/core/model/ParticipantManager.java |
---|
0,0 → 1,170 |
package ak.kickup.core.model; |
import java.util.*; |
import java.io.UnsupportedEncodingException; |
import net.sf.hibernate.*; |
import net.sf.hibernate.type.Type; |
import ak.kickup.util.HibernateUtil; |
import ak.kickup.util.ModelException; |
import ak.kickup.util.ModelSecurityException; |
public class ParticipantManager |
{ |
private static ParticipantManager participantManager = null; |
private static boolean registered = false; |
public static ParticipantManager getInstance() |
{ |
return participantManager; |
} |
protected static void register() |
{ |
synchronized(ParticipantManager.class) { |
if(registered) return; |
registered = true; |
try { |
HibernateUtil.getConfiguration().addResource( |
"ak/kickup/core/model/Participant.hbm.xml"); |
participantManager = new ParticipantManager(); |
} |
catch(Exception ex) { |
ex.printStackTrace(); |
throw new RuntimeException(ex.getMessage()); |
} |
} |
} |
static { |
register(); |
} |
private ParticipantManager() |
{ |
} |
public Participant create() |
throws ModelException |
{ |
return new Participant(); |
} |
public Participant get(Long id) |
throws ModelException |
{ |
try { |
return (Participant)HibernateUtil.currentSession().load(Participant.class, id); |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public String generateIdent() |
throws ModelException |
{ |
String ident; |
do { |
byte[] buf = new byte[6]; |
for(int i = 0; i < buf.length; i++) { |
buf[i] = (byte)(Math.random() * 10 + 48); |
} |
try { |
ident = new String(buf, "ascii"); |
} |
catch(UnsupportedEncodingException ex) { |
throw new ModelException(ex); |
} |
} while(identExists(ident)); |
return ident; |
} |
public boolean identExists(String ident) |
throws ModelException |
{ |
try { |
return ((Integer)HibernateUtil.currentSession().iterate( |
"select count(*) from Participant where ident = ?", |
ident, Hibernate.STRING) |
.next()).intValue() > 0; |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public void save(Participant participant) |
throws ModelException |
{ |
try { |
HibernateUtil.currentSession().saveOrUpdate(participant); |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public void delete(Participant participant) |
throws ModelException |
{ |
try { |
HibernateUtil.currentSession().delete(participant); |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public Collection listParticipants(Event event) |
throws ModelException |
{ |
try { |
return HibernateUtil.currentSession().find( |
"from Participant where event = ?", |
event, Hibernate.entity(Event.class)); |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public static final Comparator NICK_COMPARATOR = new NickComparator(); |
private static class NickComparator |
implements Comparator |
{ |
public int compare(Object o1, Object o2) |
{ |
if(!(o1 instanceof Participant) || !(o2 instanceof Participant)) |
throw new ClassCastException("not a Participant"); |
Participant a1 = (Participant)o1; |
Participant a2 = (Participant)o2; |
if(a1 == null && a2 == null) |
return 0; |
else if(a1 == null && a2 != null) |
return -1; |
else if(a1 != null && a2 == null) |
return 1; |
else |
return a1.getNick().compareToIgnoreCase(a2.getNick()); |
} |
public boolean equals(Object obj) |
{ |
return (obj instanceof NickComparator); |
} |
} |
} |
/kickup/trunk/src/ak/kickup/core/model/Apartment.java |
---|
0,0 → 1,101 |
package ak.kickup.core.model; |
import java.math.BigDecimal; |
import ak.kickup.util.ModelException; |
import ak.kickup.util.ModelSecurityException; |
/** |
* |
* @hibernate.class table="apartments" |
*/ |
public class Apartment |
extends GeneralModelObject |
{ |
private String name; |
private String address; |
private BigDecimal price; |
private String url; |
private String comment; |
protected Apartment() |
{ |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getName() |
{ |
return name; |
} |
public void setName(String name) |
{ |
this.name = name; |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getAddress() |
{ |
return address; |
} |
public void setAddress(String address) |
{ |
this.address = address; |
} |
/** |
* |
* @hibernate.property |
*/ |
public BigDecimal getPrice() |
{ |
return price; |
} |
public void setPrice(BigDecimal price) |
{ |
this.price = price; |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getUrl() |
{ |
return url; |
} |
public void setUrl(String url) |
{ |
this.url = url; |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getComment() |
{ |
return comment; |
} |
public void setComment(String comment) |
{ |
this.comment = comment; |
} |
public boolean equals(Object o) |
{ |
if(o == null || !(o instanceof Apartment)) return false; |
Apartment a = (Apartment)o; |
return (getId() != null) && (a.getId() != null) && (getId().equals(a.getId())); |
} |
} |
/kickup/trunk/src/ak/kickup/core/model/EventManager.java |
---|
0,0 → 1,204 |
package ak.kickup.core.model; |
import java.util.*; |
import net.sf.hibernate.*; |
import net.sf.hibernate.type.Type; |
import ak.kickup.util.HibernateUtil; |
import ak.kickup.util.ModelException; |
import ak.kickup.util.ModelSecurityException; |
public class EventManager |
{ |
private static EventManager eventManager = null; |
private static boolean registered = false; |
public static EventManager getInstance() |
{ |
return eventManager; |
} |
protected static void register() |
{ |
synchronized(EventManager.class) { |
if(registered) return; |
registered = true; |
try { |
HibernateUtil.getConfiguration().addResource( |
"ak/kickup/core/model/Event.hbm.xml"); |
HibernateUtil.getConfiguration().addResource( |
"ak/kickup/core/model/EventAct.hbm.xml"); |
HibernateUtil.getConfiguration().addResource( |
"ak/kickup/core/model/EventApartment.hbm.xml"); |
eventManager = new EventManager(); |
} |
catch(Exception ex) { |
ex.printStackTrace(); |
throw new RuntimeException(ex.getMessage()); |
} |
} |
} |
static { |
register(); |
} |
private EventManager() |
{ |
} |
public Event create() |
throws ModelException |
{ |
Event e = new Event(); |
e.init(); |
return e; |
} |
public Event get(Long id) |
throws ModelException |
{ |
try { |
return (Event)HibernateUtil.currentSession().load(Event.class, id); |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public boolean nameExists(Event event, String name) |
throws ModelException |
{ |
try { |
if(event.getId() == null) |
return ((Integer)HibernateUtil.currentSession().iterate( |
"select count(*) from Event where name = ?", |
name, Hibernate.STRING) |
.next()).intValue() > 0; |
else |
return ((Integer)HibernateUtil.currentSession().iterate( |
"select count(*) from Event e where name = ? and e != ?", |
new Object[] { name, event }, |
new Type[] { Hibernate.STRING, Hibernate.entity(Event.class) } ) |
.next()).intValue() > 0; |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public void save(Event event) |
throws ModelException |
{ |
try { |
HibernateUtil.currentSession().saveOrUpdate(event); |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public void delete(Event event) |
throws ModelException |
{ |
try { |
HibernateUtil.currentSession().delete(event); |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public Collection listEvents(boolean enabledOnly) |
throws ModelException |
{ |
try { |
if(enabledOnly) { |
return HibernateUtil.currentSession().find( |
"from Event where enabled=?", |
Boolean.TRUE, Hibernate.BOOLEAN); |
} |
else { |
return HibernateUtil.currentSession().find("from Event"); |
} |
} |
catch(HibernateException ex) |
{ |
throw new ModelException(ex); |
} |
} |
public EventAct createAct() |
throws ModelException |
{ |
return new EventAct(); |
} |
public EventApartment createApartment() |
throws ModelException |
{ |
return new EventApartment(); |
} |
public static final Comparator NAME_COMPARATOR = new NameComparator(); |
public static final Comparator START_COMPARATOR = new StartComparator(); |
private static class NameComparator |
implements Comparator |
{ |
public int compare(Object o1, Object o2) |
{ |
if(!(o1 instanceof Event) || !(o2 instanceof Event)) |
throw new ClassCastException("not a Event"); |
Event a1 = (Event)o1; |
Event a2 = (Event)o2; |
if(a1 == null && a2 == null) |
return 0; |
else if(a1 == null && a2 != null) |
return -1; |
else if(a1 != null && a2 == null) |
return 1; |
else |
return a1.getName().compareToIgnoreCase(a2.getName()); |
} |
public boolean equals(Object obj) |
{ |
return (obj instanceof NameComparator); |
} |
} |
private static class StartComparator |
implements Comparator |
{ |
public int compare(Object o1, Object o2) |
{ |
if(!(o1 instanceof Event) || !(o2 instanceof Event)) |
throw new ClassCastException("not a Event"); |
Event a1 = (Event)o1; |
Event a2 = (Event)o2; |
if((a1 == null || a1.getStart() == null) && (a2 == null || a2.getStart() == null)) |
return 0; |
else if((a1 == null || a1.getStart() == null) && (a2 != null && a2.getStart() != null)) |
return -1; |
else if((a1 != null && a1.getStart() != null) && (a2 == null || a2.getStart() == null)) |
return 1; |
else |
return a1.getStart().compareTo(a2.getStart()); |
} |
public boolean equals(Object obj) |
{ |
return (obj instanceof StartComparator); |
} |
} |
} |
/kickup/trunk/src/ak/kickup/core/model/EventApartment.java |
---|
0,0 → 1,80 |
package ak.kickup.core.model; |
import java.math.BigDecimal; |
import java.util.Date; |
import ak.kickup.util.ModelException; |
import ak.kickup.util.ModelSecurityException; |
/** |
* |
* @hibernate.class table="event_apartments" |
*/ |
public class EventApartment |
extends GeneralModelObject |
{ |
private Event event; |
private Apartment apartment; |
private BigDecimal distance; |
private String comment; |
private Date modStamp; |
protected EventApartment() |
{ |
} |
/** |
* |
* @hibernate.many-to-one |
*/ |
public Event getEvent() |
{ |
return event; |
} |
public void setEvent(Event event) |
{ |
this.event = event; |
} |
/** |
* |
* @hibernate.many-to-one |
*/ |
public Apartment getApartment() |
{ |
return apartment; |
} |
public void setApartment(Apartment apartment) |
{ |
this.apartment = apartment; |
} |
/** |
* |
* @hibernate.property |
*/ |
public BigDecimal getDistance() |
{ |
return distance; |
} |
public void setDistance(BigDecimal distance) |
{ |
this.distance = distance; |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getComment() |
{ |
return comment; |
} |
public void setComment(String comment) |
{ |
this.comment = comment; |
} |
} |
/kickup/trunk/src/ak/kickup/core/model/Participant.java |
---|
0,0 → 1,296 |
package ak.kickup.core.model; |
import java.util.Date; |
import ak.kickup.util.ModelException; |
import ak.kickup.util.ModelSecurityException; |
/** |
* |
* @hibernate.class table="participants" |
*/ |
public class Participant |
extends GeneralModelObject |
{ |
private String ident; |
private String nick; |
private String email; |
private Boolean emailPublic; |
private String name; |
private String phone; |
private Event event; |
private Integer persons; |
private String fromZip; |
private String fromCity; |
private Date departure; |
private Integer freeTransport; |
private String transportComment; |
private Integer freeSleep; |
private String sleepComment; |
private Boolean payed; |
private String comment; |
private String privateComment; |
protected Participant() |
{ |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getIdent() |
{ |
return ident; |
} |
public void setIdent(String ident) |
{ |
this.ident = ident; |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getNick() |
{ |
return nick; |
} |
public void setNick(String nick) |
{ |
this.nick = nick; |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getEmail() |
{ |
return email; |
} |
public void setEmail(String email) |
{ |
this.email = email; |
} |
/** |
* |
* @hibernate.property column="email_public" |
*/ |
public Boolean getEmailPublic() |
{ |
return emailPublic; |
} |
public void setEmailPublic(Boolean emailPublic) |
{ |
this.emailPublic = emailPublic; |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getName() |
{ |
return name; |
} |
public void setName(String name) |
{ |
this.name = name; |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getPhone() |
{ |
return phone; |
} |
public void setPhone(String phone) |
{ |
this.phone = phone; |
} |
/** |
* |
* @hibernate.many-to-one |
*/ |
public Event getEvent() |
{ |
return event; |
} |
public void setEvent(Event event) |
{ |
this.event = event; |
} |
/** |
* |
* @hibernate.property |
*/ |
public Integer getPersons() |
{ |
return persons; |
} |
public void setPersons(Integer persons) |
{ |
this.persons = persons; |
} |
/** |
* |
* @hibernate.property column="from_zip" |
*/ |
public String getFromZip() |
{ |
return fromZip; |
} |
public void setFromZip(String fromZip) |
{ |
this.fromZip = fromZip; |
} |
/** |
* |
* @hibernate.property column="from_city" |
*/ |
public String getFromCity() |
{ |
return fromCity; |
} |
public void setFromCity(String fromCity) |
{ |
this.fromCity = fromCity; |
} |
/** |
* |
* @hibernate.property |
*/ |
public Date getDeparture() |
{ |
return departure; |
} |
public void setDeparture(Date departure) |
{ |
this.departure = departure; |
} |
/** |
* |
* @hibernate.property column="free_transport" |
*/ |
public Integer getFreeTransport() |
{ |
return freeTransport; |
} |
public void setFreeTransport(Integer freeTransport) |
{ |
this.freeTransport = freeTransport; |
} |
/** |
* |
* @hibernate.property column="transport_comment" |
*/ |
public String getTransportComment() |
{ |
return transportComment; |
} |
public void setTransportComment(String transportComment) |
{ |
this.transportComment = transportComment; |
} |
/** |
* |
* @hibernate.property column="free_sleep" |
*/ |
public Integer getFreeSleep() |
{ |
return freeSleep; |
} |
public void setFreeSleep(Integer freeSleep) |
{ |
this.freeSleep = freeSleep; |
} |
/** |
* |
* @hibernate.property column="sleep_comment" |
*/ |
public String getSleepComment() |
{ |
return sleepComment; |
} |
public void setSleepComment(String sleepComment) |
{ |
this.sleepComment = sleepComment; |
} |
/** |
* |
* @hibernate.property |
*/ |
public Boolean getPayed() |
{ |
return payed; |
} |
public void setPayed(Boolean payed) |
{ |
this.payed = payed; |
} |
/** |
* |
* @hibernate.property |
*/ |
public String getComment() |
{ |
return comment; |
} |
public void setComment(String comment) |
{ |
this.comment = comment; |
} |
/** |
* |
* @hibernate.property column="private_comment" |
*/ |
public String getPrivateComment() |
{ |
return privateComment; |
} |
public void setPrivateComment(String privateComment) |
{ |
this.privateComment = privateComment; |
} |
public boolean equals(Object o) |
{ |
if(o == null || !(o instanceof Participant)) return false; |
Participant p = (Participant)o; |
return (getId() != null) && (p.getId() != null) && (getId().equals(p.getId())); |
} |
} |