/it-ru/trunk/src/ak/itru/util/UserException.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/util/StringConverter.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/util/HibernateUtil.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/util/ModelException.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/util/FormException.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/util/Validator.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/util/ModelSecurityException.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/servlet/HibernateFilter.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/servlet/ProfilerFilter.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/servlet/EncodingFilter.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/servlet/LocaleServlet.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/action/AdminActAction.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/action/AdminApartmentAction.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/action/ObjectList.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/action/AdminParticipantAction.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/action/AdminEventAction.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/action/UserExceptionHandler.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/CoreResources.properties |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/model/Event.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/model/ActManager.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/model/GeneralModelObject.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/model/ApartmentManager.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/model/Act.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/model/ParticipantManager.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/model/EventAct.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/model/Apartment.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/model/EventManager.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/model/EventApartment.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/model/Participant.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/taglib/ExtendedLinkTag.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/form/EventActBean.java |
---|
File deleted |
/it-ru/trunk/src/ak/itru/core/form/EventApartmentBean.java |
---|
File deleted |
/it-ru/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()); |
} |
} |
/it-ru/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); |
} |
} |
} |
/it-ru/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; |
} |
} |
/it-ru/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); |
} |
} |
} |
/it-ru/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())); |
} |
} |
/it-ru/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; |
} |
} |
/it-ru/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); |
} |
} |
} |
/it-ru/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())); |
} |
} |
/it-ru/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); |
} |
} |
} |
/it-ru/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; |
} |
} |
/it-ru/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())); |
} |
} |
/it-ru/trunk/src/ak/kickup/core/taglib/ExtendedLinkTag.java |
---|
0,0 → 1,230 |
// based on Jakarta Struts |
package ak.kickup.core.taglib; |
import java.net.MalformedURLException; |
import java.util.Map; |
import java.util.HashMap; |
import javax.servlet.jsp.JspException; |
import org.apache.struts.util.RequestUtils; |
import org.apache.struts.taglib.logic.IterateTag; |
import ak.backpath.taglib.ForwardLinkTag; |
public class ExtendedLinkTag |
extends ForwardLinkTag |
{ |
protected String paramId2 = null; |
public String getParamId2() |
{ |
return this.paramId2; |
} |
public void setParamId2(String paramId2) |
{ |
this.paramId2 = paramId2; |
} |
protected String paramName2 = null; |
public String getParamName2() |
{ |
return this.paramName2; |
} |
public void setParamName2(String paramName2) |
{ |
this.paramName2 = paramName2; |
} |
protected String paramProperty2 = null; |
public String getParamProperty2() |
{ |
return this.paramProperty2; |
} |
public void setParamProperty2(String paramProperty2) |
{ |
this.paramProperty2 = paramProperty2; |
} |
protected String paramScope2 = null; |
public String getParamScope2() |
{ |
return this.paramScope2; |
} |
public void setParamScope2(String paramScope2) |
{ |
this.paramScope2 = paramScope2; |
} |
protected String paramId3 = null; |
public String getParamId3() |
{ |
return this.paramId3; |
} |
public void setParamId3(String paramId3) |
{ |
this.paramId3 = paramId3; |
} |
protected String paramName3 = null; |
public String getParamName3() |
{ |
return this.paramName3; |
} |
public void setParamName3(String paramName3) |
{ |
this.paramName3 = paramName3; |
} |
protected String paramProperty3 = null; |
public String getParamProperty3() |
{ |
return this.paramProperty3; |
} |
public void setParamProperty3(String paramProperty3) |
{ |
this.paramProperty3 = paramProperty3; |
} |
protected String paramScope3 = null; |
public String getParamScope3() |
{ |
return this.paramScope3; |
} |
public void setParamScope3(String paramScope3) |
{ |
this.paramScope3 = paramScope3; |
} |
protected String paramId4 = null; |
public String getParamId4() |
{ |
return this.paramId4; |
} |
public void setParamId4(String paramId4) |
{ |
this.paramId4 = paramId4; |
} |
protected String paramName4 = null; |
public String getParamName4() |
{ |
return this.paramName4; |
} |
public void setParamName4(String paramName4) |
{ |
this.paramName4 = paramName4; |
} |
protected String paramProperty4 = null; |
public String getParamProperty4() |
{ |
return this.paramProperty4; |
} |
public void setParamProperty4(String paramProperty4) |
{ |
this.paramProperty4 = paramProperty4; |
} |
protected String paramScope4 = null; |
public String getParamScope4() |
{ |
return this.paramScope4; |
} |
public void setParamScope4(String paramScope4) |
{ |
this.paramScope4 = paramScope4; |
} |
public void release() |
{ |
super.release(); |
paramId2 = null; |
paramName2 = null; |
paramProperty2 = null; |
paramScope2 = null; |
paramId3 = null; |
paramName3 = null; |
paramProperty3 = null; |
paramScope3 = null; |
paramId4 = null; |
paramName4 = null; |
paramProperty4 = null; |
paramScope4 = null; |
} |
protected String calculateURL() |
throws JspException |
{ |
Map params = RequestUtils.computeParameters(pageContext, paramId, paramName, paramProperty, paramScope, |
name, property, scope, transaction); |
Map params2 = RequestUtils.computeParameters(pageContext, paramId2, paramName2, paramProperty2, paramScope2, |
null, null, null, false); |
if(params2 != null) params.putAll(params2); |
Map params3 = RequestUtils.computeParameters(pageContext, paramId3, paramName3, paramProperty3, paramScope3, |
null, null, null, false); |
if(params3 != null) params.putAll(params3); |
Map params4 = RequestUtils.computeParameters(pageContext, paramId4, paramName4, paramProperty4, paramScope4, |
null, null, null, false); |
if(params4 != null) params.putAll(params4); |
if(indexed) { |
IterateTag iterateTag = (IterateTag) findAncestorWithClass(this, IterateTag.class); |
if(iterateTag == null) { |
JspException e = new JspException(messages.getMessage("indexed.noEnclosingIterate")); |
RequestUtils.saveException(pageContext, e); |
throw e; |
} |
if(params == null) params = new HashMap(); |
if(indexId != null) |
params.put(indexId, Integer.toString(iterateTag.getIndex())); |
else |
params.put("index", Integer.toString(iterateTag.getIndex())); |
} |
String url = null; |
try { |
url = RequestUtils.computeURL(pageContext, forward, href, page, action, params, anchor, false); |
} |
catch(MalformedURLException ex) { |
RequestUtils.saveException(pageContext, ex); |
throw new JspException(messages.getMessage("rewrite.url", ex.toString())); |
} |
if(url == null) return null; |
// add backpath |
String forwardParams = findBackPath().getForwardParams(); |
if(forwardParams == null) return url; |
if(url.indexOf("?") > 0) |
return url + "&" + backPathParam + "=" + forwardParams; |
else |
return url + "?" + backPathParam + "=" + forwardParams; |
} |
} |
/it-ru/trunk/src/ak/kickup/core/form/EventActBean.java |
---|
0,0 → 1,53 |
package ak.kickup.core.form; |
import ak.kickup.util.StringConverter; |
import ak.kickup.core.model.EventAct; |
import ak.kickup.core.model.Act; |
public final class EventActBean |
{ |
private String actId; |
private String comment; |
private Boolean selected; |
public EventActBean() |
{ |
} |
public EventActBean(Act act, EventAct info) |
{ |
this.actId = StringConverter.toString(act.getId()); |
this.comment = (info == null) ? null : info.getComment(); |
this.selected = Boolean.valueOf(info != null); |
} |
public String getActId() |
{ |
return actId; |
} |
public void setActId(String actId) |
{ |
this.actId = actId; |
} |
public String getComment() |
{ |
return comment; |
} |
public void setComment(String comment) |
{ |
this.comment = comment; |
} |
public Boolean getSelected() |
{ |
return selected; |
} |
public void setSelected(Boolean selected) |
{ |
this.selected = selected; |
} |
} |
/it-ru/trunk/src/ak/kickup/core/form/EventApartmentBean.java |
---|
0,0 → 1,65 |
package ak.kickup.core.form; |
import ak.kickup.util.StringConverter; |
import ak.kickup.core.model.EventApartment; |
import ak.kickup.core.model.Apartment; |
public final class EventApartmentBean |
{ |
private String apartmentId; |
private String distance; |
private String comment; |
private Boolean selected; |
public EventApartmentBean() |
{ |
} |
public EventApartmentBean(Apartment apartment, EventApartment info) |
{ |
this.apartmentId = StringConverter.toString(apartment.getId()); |
this.distance = (info == null) ? null : StringConverter.toNumber(info.getDistance()); |
this.comment = (info == null) ? null : info.getComment(); |
this.selected = Boolean.valueOf(info != null); |
} |
public String getApartmentId() |
{ |
return apartmentId; |
} |
public void setApartmentId(String apartmentId) |
{ |
this.apartmentId = apartmentId; |
} |
public String getDistance() |
{ |
return distance; |
} |
public void setDistance(String distance) |
{ |
this.distance = distance; |
} |
public String getComment() |
{ |
return comment; |
} |
public void setComment(String comment) |
{ |
this.comment = comment; |
} |
public Boolean getSelected() |
{ |
return selected; |
} |
public void setSelected(Boolean selected) |
{ |
this.selected = selected; |
} |
} |
/it-ru/trunk/src/ak/kickup/core/servlet/LocaleServlet.java |
---|
0,0 → 1,29 |
package ak.kickup.core.servlet; |
import java.util.Locale; |
import javax.servlet.ServletException; |
import javax.servlet.http.HttpServlet; |
import javax.servlet.http.HttpSessionListener; |
import javax.servlet.http.HttpSessionEvent; |
import org.apache.struts.Globals; |
public class LocaleServlet |
extends HttpServlet |
implements HttpSessionListener |
{ |
public void init() |
throws ServletException |
{ |
super.init(); |
Locale.setDefault(new Locale("ru", "DE")); |
} |
public void sessionCreated(HttpSessionEvent se) |
{ |
se.getSession().setAttribute(Globals.LOCALE_KEY, Locale.getDefault()); |
} |
public void sessionDestroyed(HttpSessionEvent se) |
{ |
} |
} |
/it-ru/trunk/src/ak/kickup/core/servlet/HibernateFilter.java |
---|
0,0 → 1,106 |
package ak.kickup.core.servlet; |
import java.util.List; |
import java.util.ArrayList; |
import java.util.StringTokenizer; |
import java.io.IOException; |
import java.net.URLEncoder; |
import java.security.Principal; |
import java.security.AccessControlException; |
import javax.servlet.Filter; |
import javax.servlet.FilterChain; |
import javax.servlet.FilterConfig; |
import javax.servlet.ServletException; |
import javax.servlet.ServletRequest; |
import javax.servlet.ServletResponse; |
import javax.servlet.http.HttpSession; |
import javax.servlet.http.HttpServletRequest; |
import javax.servlet.http.HttpServletResponse; |
import org.apache.log4j.Logger; |
import net.sf.hibernate.HibernateException; |
import ak.kickup.util.HibernateUtil; |
import ak.kickup.util.ModelException; |
public class HibernateFilter |
implements Filter |
{ |
private static final Logger logger = Logger.getLogger(HibernateFilter.class); |
private FilterConfig filterConfig; |
public void init(FilterConfig filterConfig) |
throws ServletException |
{ |
// get config |
this.filterConfig = filterConfig; |
if(filterConfig != null) { |
// register hibernate classes |
String toRegister = filterConfig.getInitParameter("register"); |
if(toRegister != null) { |
String[] registers = toRegister.split("\\s*;\\s*"); |
for(int i = 0; i < registers.length; i++) { |
try { |
String name = registers[i].trim(); |
if(name.equals("")) continue; |
Class cl = Class.forName(name); |
} |
catch(Exception ex) { |
logger.error("cannot register class", ex); |
} |
} |
} |
} |
} |
public void doFilter(ServletRequest request, ServletResponse response, |
FilterChain chain) |
throws IOException, ServletException |
{ |
try { |
logger.info("begin transaction"); |
HibernateUtil.beginTransaction(); |
chain.doFilter(request, response); |
if(HibernateUtil.isTransactionOpen()) { |
logger.info("commit transaction"); |
HibernateUtil.commitTransaction(); |
} |
} |
catch(Exception ex) { |
logger.error("exception by program execution", ex); |
try { |
if(HibernateUtil.isTransactionOpen()) { |
logger.info("rollback transaction"); |
HibernateUtil.rollbackTransaction(); |
} |
} |
catch(Exception ex2) { |
logger.error("cannot rollback transaction", ex2); |
} |
if(ex instanceof ServletException) |
throw (ServletException)ex; |
else |
throw new ServletException("Internal server error"); |
} |
try { |
HibernateUtil.closeSession(); |
} |
catch(Exception ex) { |
logger.error("cannot close session", ex); |
} |
} |
public void destroy() |
{ |
} |
} |
/it-ru/trunk/src/ak/kickup/core/servlet/ProfilerFilter.java |
---|
0,0 → 1,47 |
package ak.kickup.core.servlet; |
import java.io.IOException; |
import java.net.URLEncoder; |
import javax.servlet.Filter; |
import javax.servlet.FilterChain; |
import javax.servlet.FilterConfig; |
import javax.servlet.ServletException; |
import javax.servlet.ServletRequest; |
import javax.servlet.ServletResponse; |
import javax.servlet.http.HttpSession; |
import javax.servlet.http.HttpServletRequest; |
import javax.servlet.http.HttpServletResponse; |
import org.apache.log4j.Logger; |
/** |
* Prints out time of request execution. |
*/ |
public class ProfilerFilter |
implements Filter |
{ |
private static final Logger logger = Logger.getLogger(ProfilerFilter.class); |
public void init(FilterConfig filterConfig) |
throws ServletException |
{ |
} |
public void doFilter(ServletRequest request, ServletResponse response, |
FilterChain chain) |
throws IOException, ServletException |
{ |
logger.debug("begin"); |
long t1 = System.currentTimeMillis(); |
chain.doFilter(request, response); |
long t2 = System.currentTimeMillis(); |
logger.info((t2 - t1) + " ms"); |
} |
public void destroy() |
{ |
} |
} |
/it-ru/trunk/src/ak/kickup/core/servlet/EncodingFilter.java |
---|
0,0 → 1,37 |
package ak.kickup.core.servlet; |
import java.io.IOException; |
import javax.servlet.Filter; |
import javax.servlet.FilterChain; |
import javax.servlet.FilterConfig; |
import javax.servlet.ServletException; |
import javax.servlet.ServletRequest; |
import javax.servlet.ServletResponse; |
public class EncodingFilter |
implements Filter |
{ |
public static final String ENCODING = "UTF-8"; |
private FilterConfig filterConfig; |
public void init(FilterConfig filterConfig) |
throws ServletException |
{ |
this.filterConfig = filterConfig; |
} |
public void doFilter(ServletRequest request, ServletResponse response, |
FilterChain chain) |
throws IOException, ServletException |
{ |
if(request.getCharacterEncoding() == null) |
request.setCharacterEncoding(ENCODING); |
chain.doFilter(request, response); |
} |
public void destroy() |
{ |
} |
} |
/it-ru/trunk/src/ak/kickup/core/action/AdminApartmentAction.java |
---|
0,0 → 1,102 |
package ak.kickup.core.action; |
import java.util.List; |
import java.util.Collections; |
import java.util.ArrayList; |
import javax.servlet.http.HttpServletRequest; |
import javax.servlet.http.HttpServletResponse; |
import org.apache.struts.action.Action; |
import org.apache.struts.action.ActionMapping; |
import org.apache.struts.action.ActionForm; |
import org.apache.struts.action.DynaActionForm; |
import org.apache.struts.action.ActionForward; |
import org.apache.struts.action.ActionMessages; |
import org.apache.struts.action.ActionErrors; |
import org.apache.struts.action.ActionError; |
import ak.strutsx.RequestUtilsX; |
import ak.strutsx.ErrorHandlerX; |
import ak.backpath.BackPath; |
import ak.kickup.util.StringConverter; |
import ak.kickup.util.UserException; |
import ak.kickup.core.model.Apartment; |
import ak.kickup.core.model.ApartmentManager; |
public final class AdminApartmentAction |
extends Action |
{ |
public ActionForward execute(ActionMapping mapping, ActionForm form, |
HttpServletRequest request, HttpServletResponse response) |
throws Exception |
{ |
if("list".equals(mapping.getParameter())) { |
List list = new ArrayList(ApartmentManager.getInstance().listApartments()); |
Collections.sort(list, ApartmentManager.NAME_COMPARATOR); |
request.setAttribute("apartments", list); |
return mapping.findForward("default"); |
} |
else if("edit".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
Long apartmentId = StringConverter.parseLong(theForm.get("id")); |
Apartment apartment; |
DynaActionForm showForm = (DynaActionForm)RequestUtilsX.populateActionForm( |
this, request, "ApartmentEditForm"); |
if(apartmentId == null) { |
apartment = ApartmentManager.getInstance().create(); |
} |
else { |
apartment = ApartmentManager.getInstance().get(apartmentId); |
showForm.set("name", apartment.getName()); |
showForm.set("address", apartment.getAddress()); |
showForm.set("price", StringConverter.toCurrency(apartment.getPrice())); |
showForm.set("url", apartment.getUrl()); |
showForm.set("comment", apartment.getComment()); |
} |
return mapping.findForward("default"); |
} |
else if("delete".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
Long apartmentId = StringConverter.parseLong(theForm.get("id")); |
Apartment apartment = ApartmentManager.getInstance().get(apartmentId); |
ApartmentManager.getInstance().delete(apartment); |
response.sendRedirect(BackPath.findBackPath(request).getBackwardUrl()); |
return null; |
} |
else if("submit".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
Long apartmentId = StringConverter.parseLong(theForm.get("id")); |
Apartment apartment; |
if(apartmentId == null) { |
apartment = ApartmentManager.getInstance().create(); |
} |
else { |
apartment = ApartmentManager.getInstance().get(apartmentId); |
} |
String name = (String)theForm.get("name"); |
if(ApartmentManager.getInstance().nameExists(apartment, name)) { |
throw new UserException("ak.kickup.core.apartment.name.nonunique"); |
} |
apartment.setName(name); |
apartment.setAddress((String)theForm.get("address")); |
apartment.setPrice(StringConverter.parseCurrency(theForm.get("price"))); |
apartment.setUrl((String)theForm.get("url")); |
apartment.setComment((String)theForm.get("comment")); |
ApartmentManager.getInstance().save(apartment); |
response.sendRedirect(BackPath.findBackPath(request).getBackwardUrl()); |
return null; |
} |
else { |
throw new Exception("unknown mapping parameter"); |
} |
} |
} |
/it-ru/trunk/src/ak/kickup/core/action/ObjectList.java |
---|
0,0 → 1,23 |
package ak.kickup.core.action; |
import java.util.List; |
public class ObjectList |
{ |
private List objects; |
public ObjectList(List objects) |
{ |
this.objects = objects; |
} |
public List getObjects() |
{ |
return objects; |
} |
public void setObjects(List objects) |
{ |
this.objects = objects; |
} |
} |
/it-ru/trunk/src/ak/kickup/core/action/AdminParticipantAction.java |
---|
0,0 → 1,156 |
package ak.kickup.core.action; |
import java.util.List; |
import java.util.Collections; |
import java.util.ArrayList; |
import javax.servlet.http.HttpServletRequest; |
import javax.servlet.http.HttpServletResponse; |
import org.apache.struts.action.Action; |
import org.apache.struts.action.ActionMapping; |
import org.apache.struts.action.ActionForm; |
import org.apache.struts.action.DynaActionForm; |
import org.apache.struts.action.ActionForward; |
import org.apache.struts.action.ActionMessages; |
import org.apache.struts.action.ActionErrors; |
import org.apache.struts.action.ActionError; |
import ak.strutsx.RequestUtilsX; |
import ak.strutsx.ErrorHandlerX; |
import ak.backpath.BackPath; |
import ak.kickup.util.StringConverter; |
import ak.kickup.util.UserException; |
import ak.kickup.core.model.Participant; |
import ak.kickup.core.model.ParticipantManager; |
import ak.kickup.core.model.Event; |
import ak.kickup.core.model.EventManager; |
public final class AdminParticipantAction |
extends Action |
implements ErrorHandlerX |
{ |
public void handleErrors(ActionMapping mapping, ActionForm form, |
HttpServletRequest request, HttpServletResponse response) |
throws Exception |
{ |
if("submit".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
Long eventId = StringConverter.parseLong(theForm.get("event")); |
Event event = EventManager.getInstance().get(eventId); |
Long participantId = StringConverter.parseLong(theForm.get("id")); |
Participant participant; |
if(participantId == null) { |
participant = ParticipantManager.getInstance().create(); |
} |
else { |
participant = ParticipantManager.getInstance().get(participantId); |
} |
request.setAttribute("event", event); |
request.setAttribute("participant", participant); |
} |
} |
public ActionForward execute(ActionMapping mapping, ActionForm form, |
HttpServletRequest request, HttpServletResponse response) |
throws Exception |
{ |
if("list".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
Long eventId = StringConverter.parseLong(theForm.get("event")); |
Event event = EventManager.getInstance().get(eventId); |
List list = new ArrayList(ParticipantManager.getInstance().listParticipants(event)); |
Collections.sort(list, ParticipantManager.NICK_COMPARATOR); |
request.setAttribute("participants", list); |
request.setAttribute("event", event); |
return mapping.findForward("default"); |
} |
else if("edit".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
Long eventId = StringConverter.parseLong(theForm.get("event")); |
Event event = EventManager.getInstance().get(eventId); |
Long participantId = StringConverter.parseLong(theForm.get("id")); |
Participant participant; |
DynaActionForm showForm = (DynaActionForm)RequestUtilsX.populateActionForm( |
this, request, "ParticipantEditForm"); |
if(participantId == null) { |
participant = ParticipantManager.getInstance().create(); |
} |
else { |
participant = ParticipantManager.getInstance().get(participantId); |
showForm.set("nick", participant.getNick()); |
showForm.set("email", participant.getEmail()); |
showForm.set("emailPublic", participant.getEmailPublic()); |
showForm.set("name", participant.getName()); |
showForm.set("phone", participant.getPhone()); |
showForm.set("persons", StringConverter.toString(participant.getPersons())); |
showForm.set("fromZip", participant.getFromZip()); |
showForm.set("fromCity", participant.getFromCity()); |
showForm.set("departure", StringConverter.toDateTime(participant.getDeparture())); |
showForm.set("freeTransport", StringConverter.toString(participant.getFreeTransport())); |
showForm.set("transportComment", participant.getTransportComment()); |
showForm.set("freeSleep", StringConverter.toString(participant.getFreeSleep())); |
showForm.set("sleepComment", participant.getSleepComment()); |
showForm.set("payed", participant.getPayed()); |
showForm.set("comment", participant.getComment()); |
showForm.set("privateComment", participant.getPrivateComment()); |
} |
request.setAttribute("event", event); |
request.setAttribute("participant", participant); |
return mapping.findForward("default"); |
} |
else if("delete".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
Long participantId = StringConverter.parseLong(theForm.get("id")); |
Participant participant = ParticipantManager.getInstance().get(participantId); |
ParticipantManager.getInstance().delete(participant); |
response.sendRedirect(BackPath.findBackPath(request).getBackwardUrl()); |
return null; |
} |
else if("submit".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
Long participantId = StringConverter.parseLong(theForm.get("id")); |
Participant participant; |
if(participantId == null) { |
Long eventId = StringConverter.parseLong(theForm.get("event")); |
Event event = EventManager.getInstance().get(eventId); |
participant = ParticipantManager.getInstance().create(); |
participant.setIdent(ParticipantManager.getInstance().generateIdent()); |
participant.setEvent(event); |
} |
else { |
participant = ParticipantManager.getInstance().get(participantId); |
} |
participant.setNick((String)theForm.get("nick")); |
participant.setEmail((String)theForm.get("email")); |
participant.setEmailPublic((Boolean)theForm.get("emailPublic")); |
participant.setName((String)theForm.get("name")); |
participant.setPhone((String)theForm.get("phone")); |
participant.setPersons(StringConverter.parseInteger(theForm.get("persons"))); |
participant.setFromZip((String)theForm.get("fromZip")); |
participant.setFromCity((String)theForm.get("fromCity")); |
participant.setDeparture(StringConverter.parseDateTime(theForm.get("departure"))); |
participant.setFreeTransport(StringConverter.parseInteger(theForm.get("freeTransport"))); |
participant.setTransportComment((String)theForm.get("transportComment")); |
participant.setFreeSleep(StringConverter.parseInteger(theForm.get("freeSleep"))); |
participant.setSleepComment((String)theForm.get("sleepComment")); |
participant.setPayed((Boolean)theForm.get("payed")); |
participant.setComment((String)theForm.get("comment")); |
participant.setPrivateComment((String)theForm.get("privateComment")); |
ParticipantManager.getInstance().save(participant); |
response.sendRedirect(BackPath.findBackPath(request).getBackwardUrl()); |
return null; |
} |
else { |
throw new Exception("unknown mapping parameter"); |
} |
} |
} |
/it-ru/trunk/src/ak/kickup/core/action/AdminEventAction.java |
---|
0,0 → 1,221 |
package ak.kickup.core.action; |
import java.util.List; |
import java.util.Collections; |
import java.util.ArrayList; |
import javax.servlet.http.HttpServletRequest; |
import javax.servlet.http.HttpServletResponse; |
import org.apache.struts.action.Action; |
import org.apache.struts.action.ActionMapping; |
import org.apache.struts.action.ActionForm; |
import org.apache.struts.action.DynaActionForm; |
import org.apache.struts.action.ActionForward; |
import org.apache.struts.action.ActionMessages; |
import org.apache.struts.action.ActionErrors; |
import org.apache.struts.action.ActionError; |
import ak.strutsx.RequestUtilsX; |
import ak.strutsx.ErrorHandlerX; |
import ak.backpath.BackPath; |
import ak.kickup.util.StringConverter; |
import ak.kickup.util.UserException; |
import ak.kickup.core.model.Event; |
import ak.kickup.core.model.EventManager; |
import ak.kickup.core.model.EventAct; |
import ak.kickup.core.model.EventApartment; |
import ak.kickup.core.model.Act; |
import ak.kickup.core.model.ActManager; |
import ak.kickup.core.model.Apartment; |
import ak.kickup.core.model.ApartmentManager; |
import ak.kickup.core.form.EventActBean; |
import ak.kickup.core.form.EventApartmentBean; |
public final class AdminEventAction |
extends Action |
implements ErrorHandlerX |
{ |
public void handleErrors(ActionMapping mapping, ActionForm form, |
HttpServletRequest request, HttpServletResponse response) |
throws Exception |
{ |
if("submit".equals(mapping.getParameter())) { |
initLists(request); // FIXME: if a list is changed between "edit" and "submit" then indicies are wrong |
} |
} |
public ActionForward execute(ActionMapping mapping, ActionForm form, |
HttpServletRequest request, HttpServletResponse response) |
throws Exception |
{ |
if("list".equals(mapping.getParameter())) { |
List list = new ArrayList(EventManager.getInstance().listEvents(false)); |
Collections.sort(list, EventManager.START_COMPARATOR); |
request.setAttribute("events", list); |
return mapping.findForward("default"); |
} |
else if("edit".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
Long eventId = StringConverter.parseLong(theForm.get("id")); |
Event event; |
List acts = new ArrayList(ActManager.getInstance().listActs()); |
List apartments = new ArrayList(ApartmentManager.getInstance().listApartments()); |
DynaActionForm showForm = (DynaActionForm)RequestUtilsX.populateActionForm( |
this, request, "EventEditForm"); |
if(eventId == null) { |
event = EventManager.getInstance().create(); |
showForm.set("enabled", Boolean.TRUE); |
} |
else { |
event = EventManager.getInstance().get(eventId); |
showForm.set("name", event.getName()); |
showForm.set("place", event.getPlace()); |
showForm.set("address", event.getAddress()); |
showForm.set("transport", event.getTransportDesc()); |
showForm.set("start", StringConverter.toDate(event.getStart())); |
showForm.set("stop", StringConverter.toDate(event.getStop())); |
showForm.set("lastreg", StringConverter.toDate(event.getLastRegister())); |
showForm.set("lastunreg", StringConverter.toDate(event.getLastUnregister())); |
showForm.set("price", StringConverter.toCurrency(event.getPrice())); |
showForm.set("account", event.getMoneyAccount()); |
showForm.set("enabled", event.getEnabled()); |
showForm.set("comment", event.getComment()); |
} |
// acts |
EventActBean[] a = new EventActBean[acts.size()]; |
Collections.sort(acts, ActManager.NAME_COMPARATOR); |
for(int i = 0; i < acts.size(); i++) { |
Act act = (Act)acts.get(i); |
a[i] = new EventActBean(act, (event == null) ? null : event.getAct(act.getId())); |
} |
showForm.set("acts", a); |
// apartments |
EventApartmentBean[] ap = new EventApartmentBean[apartments.size()]; |
Collections.sort(apartments, ApartmentManager.NAME_COMPARATOR); |
for(int i = 0; i < apartments.size(); i++) { |
Apartment apartment = (Apartment)apartments.get(i); |
ap[i] = new EventApartmentBean(apartment, (event == null) |
? null : event.getApartment(apartment.getId())); |
} |
showForm.set("apartments", ap); |
initLists(request); |
return mapping.findForward("default"); |
} |
else if("delete".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
Long eventId = StringConverter.parseLong(theForm.get("id")); |
Event event = EventManager.getInstance().get(eventId); |
EventManager.getInstance().delete(event); |
response.sendRedirect(BackPath.findBackPath(request).getBackwardUrl()); |
return null; |
} |
else if("submit".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
Long eventId = StringConverter.parseLong(theForm.get("id")); |
Event event; |
if(eventId == null) { |
event = EventManager.getInstance().create(); |
} |
else { |
event = EventManager.getInstance().get(eventId); |
} |
// acts |
EventActBean[] acts = (EventActBean[])theForm.get("acts"); |
for(int i = 0; i < acts.length; i++) { |
// FIXME: validate act id |
// get bean |
Long actId = StringConverter.parseLong(acts[i].getActId()); |
Act act = ActManager.getInstance().get(actId); |
EventAct eventAct = event.getAct(actId); |
if(acts[i].getSelected() == null || !acts[i].getSelected().booleanValue()) { |
if(eventAct != null) event.removeAct(eventAct); |
} |
else { |
if(eventAct == null) { |
eventAct = EventManager.getInstance().createAct(); |
eventAct.setEvent(event); |
eventAct.setAct(act); |
event.addAct(eventAct); |
} |
eventAct.setComment(acts[i].getComment()); |
} |
} |
// apartments |
EventApartmentBean[] apartments = (EventApartmentBean[])theForm.get("apartments"); |
for(int i = 0; i < apartments.length; i++) { |
// FIXME: validate apartment id, distance |
// get bean |
Long apartmentId = StringConverter.parseLong(apartments[i].getApartmentId()); |
Apartment apartment = ApartmentManager.getInstance().get(apartmentId); |
EventApartment eventApartment = event.getApartment(apartmentId); |
if(apartments[i].getSelected() == null || !apartments[i].getSelected().booleanValue()) { |
if(eventApartment != null) event.removeApartment(eventApartment); |
} |
else { |
if(eventApartment == null) { |
eventApartment = EventManager.getInstance().createApartment(); |
eventApartment.setEvent(event); |
eventApartment.setApartment(apartment); |
event.addApartment(eventApartment); |
} |
eventApartment.setDistance(StringConverter.parseNumber(apartments[i].getDistance())); |
eventApartment.setComment(apartments[i].getComment()); |
} |
} |
// name |
String name = (String)theForm.get("name"); |
if(EventManager.getInstance().nameExists(event, name)) { |
throw new UserException("ak.kickup.core.event.name.nonunique"); |
} |
event.setName(name); |
// others |
event.setPlace((String)theForm.get("place")); |
event.setAddress((String)theForm.get("address")); |
event.setTransportDesc((String)theForm.get("transport")); |
event.setStart(StringConverter.parseDate(theForm.get("start"))); |
event.setStop(StringConverter.parseDate(theForm.get("stop"))); |
event.setLastRegister(StringConverter.parseDate(theForm.get("lastreg"))); |
event.setLastUnregister(StringConverter.parseDate(theForm.get("lastunreg"))); |
event.setPrice(StringConverter.parseCurrency(theForm.get("price"))); |
event.setMoneyAccount((String)theForm.get("account")); |
event.setEnabled((Boolean)theForm.get("enabled")); |
event.setComment((String)theForm.get("comment")); |
// save |
EventManager.getInstance().save(event); |
response.sendRedirect(BackPath.findBackPath(request).getBackwardUrl()); |
return null; |
} |
else { |
throw new Exception("unknown mapping parameter"); |
} |
} |
private void initLists(HttpServletRequest request) |
throws Exception |
{ |
List acts = new ArrayList(ActManager.getInstance().listActs()); |
List apartments = new ArrayList(ApartmentManager.getInstance().listApartments()); |
Collections.sort(acts, ActManager.NAME_COMPARATOR); |
request.setAttribute("actList", new ObjectList(acts)); |
Collections.sort(apartments, ApartmentManager.NAME_COMPARATOR); |
request.setAttribute("apartmentList", new ObjectList(apartments)); |
} |
} |
/it-ru/trunk/src/ak/kickup/core/action/UserExceptionHandler.java |
---|
0,0 → 1,62 |
package ak.kickup.core.action; |
import javax.servlet.ServletException; |
import javax.servlet.http.HttpServletRequest; |
import javax.servlet.http.HttpServletResponse; |
import org.apache.struts.Globals; |
import org.apache.struts.action.ActionError; |
import org.apache.struts.action.ActionErrors; |
import org.apache.struts.action.ActionMessages; |
import org.apache.struts.action.ExceptionHandler; |
import org.apache.struts.action.ActionMapping; |
import org.apache.struts.action.ActionForm; |
import org.apache.struts.action.ActionForward; |
import org.apache.struts.config.ExceptionConfig; |
import org.apache.log4j.Logger; |
import ak.strutsx.ErrorHandlerX; |
import ak.kickup.util.UserException; |
import ak.kickup.util.FormException; |
public final class UserExceptionHandler |
extends ExceptionHandler |
{ |
private static final Logger logger = Logger.getLogger(UserExceptionHandler.class); |
public ActionForward execute(Exception ex, ExceptionConfig config, |
ActionMapping mapping, ActionForm formInstance, |
HttpServletRequest request, HttpServletResponse response) |
throws ServletException |
{ |
if(!(ex instanceof UserException)) |
throw new ServletException("Unknown type of exception: " + ex.getClass()); |
UserException userEx = (UserException)ex; |
logger.info("begin exception handle:" + userEx.getMessage()); |
// try to get property for this exception if any |
String property = ActionMessages.GLOBAL_MESSAGE; |
if(userEx instanceof FormException) { |
FormException formEx = (FormException)userEx; |
if(formEx.getProperty() != null) |
property = formEx.getProperty(); |
} |
// create new error message |
ActionErrors errors = (ActionErrors)request.getAttribute(Globals.ERROR_KEY); |
if(errors == null) { |
errors = new ActionErrors(); |
request.setAttribute(Globals.ERROR_KEY, errors); |
} |
errors.add(property, new ActionError(userEx.getMessage(), userEx.getValues())); |
// find forward |
if(mapping.getInput() == null) |
return mapping.findForward("error"); |
else |
return mapping.getInputForward(); |
} |
} |
/it-ru/trunk/src/ak/kickup/core/action/AdminActAction.java |
---|
0,0 → 1,96 |
package ak.kickup.core.action; |
import java.util.List; |
import java.util.Collections; |
import java.util.ArrayList; |
import javax.servlet.http.HttpServletRequest; |
import javax.servlet.http.HttpServletResponse; |
import org.apache.struts.action.Action; |
import org.apache.struts.action.ActionMapping; |
import org.apache.struts.action.ActionForm; |
import org.apache.struts.action.DynaActionForm; |
import org.apache.struts.action.ActionForward; |
import org.apache.struts.action.ActionMessages; |
import org.apache.struts.action.ActionErrors; |
import org.apache.struts.action.ActionError; |
import ak.strutsx.RequestUtilsX; |
import ak.strutsx.ErrorHandlerX; |
import ak.backpath.BackPath; |
import ak.kickup.util.StringConverter; |
import ak.kickup.util.UserException; |
import ak.kickup.core.model.Act; |
import ak.kickup.core.model.ActManager; |
public final class AdminActAction |
extends Action |
{ |
public ActionForward execute(ActionMapping mapping, ActionForm form, |
HttpServletRequest request, HttpServletResponse response) |
throws Exception |
{ |
if("list".equals(mapping.getParameter())) { |
List list = new ArrayList(ActManager.getInstance().listActs()); |
Collections.sort(list, ActManager.NAME_COMPARATOR); |
request.setAttribute("acts", list); |
return mapping.findForward("default"); |
} |
else if("edit".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
Long actId = StringConverter.parseLong(theForm.get("id")); |
Act act; |
DynaActionForm showForm = (DynaActionForm)RequestUtilsX.populateActionForm( |
this, request, "ActEditForm"); |
if(actId == null) { |
act = ActManager.getInstance().create(); |
} |
else { |
act = ActManager.getInstance().get(actId); |
showForm.set("name", act.getName()); |
showForm.set("comment", act.getComment()); |
} |
return mapping.findForward("default"); |
} |
else if("delete".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
Long actId = StringConverter.parseLong(theForm.get("id")); |
Act act = ActManager.getInstance().get(actId); |
ActManager.getInstance().delete(act); |
response.sendRedirect(BackPath.findBackPath(request).getBackwardUrl()); |
return null; |
} |
else if("submit".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
Long actId = StringConverter.parseLong(theForm.get("id")); |
Act act; |
if(actId == null) { |
act = ActManager.getInstance().create(); |
} |
else { |
act = ActManager.getInstance().get(actId); |
} |
String name = (String)theForm.get("name"); |
if(ActManager.getInstance().nameExists(act, name)) { |
throw new UserException("ak.kickup.core.act.name.nonunique"); |
} |
act.setName(name); |
act.setComment((String)theForm.get("comment")); |
ActManager.getInstance().save(act); |
response.sendRedirect(BackPath.findBackPath(request).getBackwardUrl()); |
return null; |
} |
else { |
throw new Exception("unknown mapping parameter"); |
} |
} |
} |
/it-ru/trunk/src/ak/kickup/core/CoreResources.properties |
---|
0,0 → 1,345 |
ak.kickup.core.type.user=user |
ak.kickup.core.type.systemUser=system user |
ak.kickup.core.type.domain=domain |
ak.kickup.core.type.mailbox=mailbox |
ak.kickup.core.type.mailAlias=mail alias |
ak.kickup.core.type.mailAliasDestination=mail alias destination |
ak.kickup.core.ident.user={0} |
ak.kickup.core.ident.systemUser={0} ({1}) |
ak.kickup.core.ident.domain={0} |
ak.kickup.core.ident.mailbox={0}@{1} |
ak.kickup.core.ident.mailAlias={0}@{1} |
ak.kickup.core.ident.mailAliasDestination.external={0} |
ak.kickup.core.ident.mailAliasDestination.internal={0}@{1} |
ak.kickup.core.access.denied=Access to the object denied |
ak.kickup.core.login.failed=Wrong login or password or the user is disabled |
ak.kickup.core.login.required=You have to enter the login |
ak.kickup.core.password.required=You have to enter the password |
ak.kickup.core.oldpassword.required=You have to enter the old password |
ak.kickup.core.oldpassword.wrong=Wrong old password |
ak.kickup.core.password.dontMatch=The passwords you entered doesn't match |
ak.kickup.core.user.login.nonunique=The user login already exists |
ak.kickup.core.user.id.wrong=Please select an user from the list |
ak.kickup.core.user.deletemeself=Can not delete the user you are logged in |
ak.kickup.core.user.boss.id.wrong=Please select a boss from the list |
ak.kickup.core.user.locale.wrong=Please select a locale from the list |
ak.kickup.core.user.system.uid.nonunique=The UID already exists |
ak.kickup.core.user.system.name.nonunique=The user name already exists |
ak.kickup.core.domain.name.nonunique=The domain name already exists |
ak.kickup.core.mailbox.login.nonunique=The mailbox login already exists in the domain |
ak.kickup.core.mail.alias.address.nonunique=The address already exists in the domain |
ak.kickup.core.mailbox.edit.id.wrong=Please select a mailbox from the list |
ak.kickup.core.mailbox.edit.login.empty=You have to enter the login |
ak.kickup.core.mailbox.edit.domain.wrong=Please select a domain from the list |
ak.kickup.core.mailbox.edit.owner.wrong=Please select an owner from the list |
ak.kickup.core.mailbox.edit.systemuser.wrong=Please select a system user from the list |
ak.kickup.core.mail.alias.edit.id.wrong=Please select a mail alias from the list |
ak.kickup.core.mail.alias.edit.dest.id.wrong=Wrong ID |
ak.kickup.core.mail.alias.edit.mailbox.id.wrong=Please select a mailbox from the list |
ak.kickup.core.mail.alias.edit.email.wrong=Please enter an email |
ak.kickup.core.mail.alias.edit.address.empty=Please enter an address |
ak.kickup.core.mail.alias.edit.domain.wrong=Please select a domain from the list |
ak.kickup.core.mail.alias.edit.owner.wrong=Please select an owner from the list |
ak.kickup.core.user.system.edit.id.wrong=Please select an user from the list |
ak.kickup.core.user.system.edit.uid.wrong=Please enter the UID |
ak.kickup.core.user.system.edit.name.required=Please enter name of the user |
ak.kickup.core.user.system.edit.owner.wrong=Please select an owner from the list |
ak.kickup.core.domain.edit.id.wrong=Please select a domain from the list |
ak.kickup.core.domain.edit.owner.wrong=Please select an owner from the list |
ak.kickup.core.domain.edit.name.empty=Please enter domain name |
ak.kickup.core.mail.alias.edit.id.wrong=Please select an alias from the list |
ak.kickup.page.general.errors=There are errors in you input |
ak.kickup.page.error.title=Host Admiral - error |
ak.kickup.page.error.back=back |
ak.kickup.page.generalError.title=Host Admiral - error |
ak.kickup.page.generalError.message=There is internal server error occured. Please go back and try again. If the error occurs again continue with the start page. |
ak.kickup.page.generalError.index=start page |
ak.kickup.page.generalError.back=back |
ak.kickup.page.index.title=Host Admiral |
ak.kickup.page.index.password_change=change password |
ak.kickup.page.index.user_list=users |
ak.kickup.page.index.system_user_list=system users |
ak.kickup.page.index.domain_list=domains |
ak.kickup.page.index.mail_alias_list=mail aliases |
ak.kickup.page.index.mail_box_list=mail boxes |
ak.kickup.page.index.logout=logout |
ak.kickup.page.index.login=Logged in as |
ak.kickup.page.index.locale=Locale |
ak.kickup.page.system.login.title=Host Admiral - login |
ak.kickup.page.system.login.login=Login |
ak.kickup.page.system.login.password=Password |
ak.kickup.page.system.login.submit=Login |
ak.kickup.page.system.login.reset=Reset |
ak.kickup.page.system.logout.title=Host Admiral - logout |
ak.kickup.page.system.logout.message=You are logged out sucessfully. See you later! |
ak.kickup.page.system.logout.login=start new session |
ak.kickup.page.system.logout.back=return to system |
ak.kickup.page.user.password.change.title=Host Admiral - change password |
ak.kickup.page.user.password.change.old_password=Old password |
ak.kickup.page.user.password.change.new_password=New password |
ak.kickup.page.user.password.change.new_password_again=New password again |
ak.kickup.page.user.password.change.submit=submit |
ak.kickup.page.user.password.change.back=back |
ak.kickup.page.user.list.title=Host Admiral - users - list |
ak.kickup.page.user.list.login=Login |
ak.kickup.page.user.list.boss=Boss |
ak.kickup.page.user.list.superuser=Superuser |
ak.kickup.page.user.list.enabled=Enabled |
ak.kickup.page.user.list.delete=delete |
ak.kickup.page.user.list.edit=edit |
ak.kickup.page.user.list.partedit=edit |
ak.kickup.page.user.list.view=view |
ak.kickup.page.user.list.add=add new user |
ak.kickup.page.user.list.back=back |
ak.kickup.page.user.list.logins.failed=failed logins |
ak.kickup.page.user.failedLogins.title=Host Admiral - users - failed logins |
ak.kickup.page.user.failedLogins.login=Login |
ak.kickup.page.user.failedLogins.user.exists=User Exists |
ak.kickup.page.user.failedLogins.time=Login Time |
ak.kickup.page.user.failedLogins.success=Success |
ak.kickup.page.user.failedLogins.ip=IP |
ak.kickup.page.user.failedLogins.back=back |
ak.kickup.page.user.logins.title=Host Admiral - user - logins |
ak.kickup.page.user.logins.login=Logins of user |
ak.kickup.page.user.logins.time=Login Time |
ak.kickup.page.user.logins.success=Success |
ak.kickup.page.user.logins.ip=IP |
ak.kickup.page.user.logins.back=back |
ak.kickup.page.user.edit.title=Host Admiral - user - edit |
ak.kickup.page.user.edit.login=Login |
ak.kickup.page.user.edit.password=Password |
ak.kickup.page.user.edit.password_again=Password again |
ak.kickup.page.user.edit.boss=Boss |
ak.kickup.page.user.edit.boss.empty=-- no boss -- |
ak.kickup.page.user.edit.superuser=Superuser |
ak.kickup.page.user.edit.superuser.true=yes |
ak.kickup.page.user.edit.superuser.false=no |
ak.kickup.page.user.edit.locale=Locale |
ak.kickup.page.user.edit.enabled=Enabled |
ak.kickup.page.user.edit.comment=Comment |
ak.kickup.page.user.edit.submit=submit |
ak.kickup.page.user.edit.back=back |
ak.kickup.page.user.edit.logins=login history |
ak.kickup.page.user.view.title=Host Admiral - user - view |
ak.kickup.page.user.view.login=Login |
ak.kickup.page.user.view.boss=Boss |
ak.kickup.page.user.view.boss.empty=[no boss] |
ak.kickup.page.user.view.superuser=Superuser |
ak.kickup.page.user.view.superuser.true=yes |
ak.kickup.page.user.view.superuser.false=no |
ak.kickup.page.user.view.locale=Locale |
ak.kickup.page.user.view.enabled=Enabled |
ak.kickup.page.user.view.enabled.true=yes |
ak.kickup.page.user.view.enabled.false=no |
ak.kickup.page.user.view.comment=Comment |
ak.kickup.page.user.view.back=back |
ak.kickup.page.user.view.logins=login history |
ak.kickup.page.user.partedit.title=Host Admiral - user - edit |
ak.kickup.page.user.partedit.login=Login |
ak.kickup.page.user.partedit.boss=Boss |
ak.kickup.page.user.partedit.boss.empty=[no boss] |
ak.kickup.page.user.partedit.superuser=Superuser |
ak.kickup.page.user.partedit.superuser.true=yes |
ak.kickup.page.user.partedit.superuser.false=no |
ak.kickup.page.user.partedit.locale=Locale |
ak.kickup.page.user.partedit.enabled=Enabled |
ak.kickup.page.user.partedit.enabled.true=yes |
ak.kickup.page.user.partedit.enabled.false=no |
ak.kickup.page.user.partedit.comment=Comment |
ak.kickup.page.user.partedit.submit=submit |
ak.kickup.page.user.partedit.back=back |
ak.kickup.page.user.partedit.logins=login history |
ak.kickup.page.user.system.list.title=Host Admiral - system users - list |
ak.kickup.page.user.system.list.uid=System ID |
ak.kickup.page.user.system.list.name=User name |
ak.kickup.page.user.system.list.owner=Owner |
ak.kickup.page.user.system.list.enabled=Enabled |
ak.kickup.page.user.system.list.delete=delete |
ak.kickup.page.user.system.list.edit=edit |
ak.kickup.page.user.system.list.view=view |
ak.kickup.page.user.system.list.add=add new user |
ak.kickup.page.user.system.list.back=back |
ak.kickup.page.user.system.edit.title=Host Admiral - system user - edit |
ak.kickup.page.user.system.edit.uid=System ID |
ak.kickup.page.user.system.edit.name=User name |
ak.kickup.page.user.system.edit.owner=Owner |
ak.kickup.page.user.system.edit.owner.empty=-- common user -- |
ak.kickup.page.user.system.edit.enabled=Enabled |
ak.kickup.page.user.system.edit.comment=Comment |
ak.kickup.page.user.system.edit.submit=submit |
ak.kickup.page.user.system.edit.back=back |
ak.kickup.page.user.system.view.title=Host Admiral - system user - view |
ak.kickup.page.user.system.view.uid=System ID |
ak.kickup.page.user.system.view.name=User name |
ak.kickup.page.user.system.view.owner=Owner |
ak.kickup.page.user.system.view.owner.empty=[common user] |
ak.kickup.page.user.system.view.enabled=Enabled |
ak.kickup.page.user.system.view.enabled.true=yes |
ak.kickup.page.user.system.view.enabled.false=no |
ak.kickup.page.user.system.view.comment=Comment |
ak.kickup.page.user.system.view.back=back |
ak.kickup.page.domain.list.title=Host Admiral - domains - list |
ak.kickup.page.domain.list.name=Name |
ak.kickup.page.domain.list.owner=Owner |
ak.kickup.page.domain.list.enabled=Enabled |
ak.kickup.page.domain.list.delete=delete |
ak.kickup.page.domain.list.view=view |
ak.kickup.page.domain.list.edit=edit |
ak.kickup.page.domain.list.add=add new domain |
ak.kickup.page.domain.list.back=back |
ak.kickup.page.domain.edit.title=Host Admiral - domain - edit |
ak.kickup.page.domain.edit.name=Name |
ak.kickup.page.domain.edit.owner=Owner |
ak.kickup.page.domain.edit.owner.empty=-- please select -- |
ak.kickup.page.domain.edit.enabled=Enabled |
ak.kickup.page.domain.edit.comment=Comment |
ak.kickup.page.domain.edit.submit=submit |
ak.kickup.page.domain.edit.back=back |
ak.kickup.page.domain.view.title=Host Admiral - domain - view |
ak.kickup.page.domain.view.name=Name |
ak.kickup.page.domain.view.owner=Owner |
ak.kickup.page.domain.view.enabled=Enabled |
ak.kickup.page.domain.view.enabled.true=yes |
ak.kickup.page.domain.view.enabled.false=no |
ak.kickup.page.domain.view.comment=Comment |
ak.kickup.page.domain.view.back=back |
ak.kickup.page.mail.box.list.title=Host Admiral - mail boxes - list |
ak.kickup.page.mail.box.list.login=Box |
ak.kickup.page.mail.box.list.domain=Domain |
ak.kickup.page.mail.box.list.owner=Owner |
ak.kickup.page.mail.box.list.enabled=Enabled |
ak.kickup.page.mail.box.list.edit=edit |
ak.kickup.page.mail.box.list.view=view |
ak.kickup.page.mail.box.list.delete=delete |
ak.kickup.page.mail.box.list.add=add new mail box |
ak.kickup.page.mail.box.list.back=back |
ak.kickup.page.mail.box.edit.title=Host Admiral - mail box - edit |
ak.kickup.page.mail.box.edit.login=Box |
ak.kickup.page.mail.box.edit.password=Password |
ak.kickup.page.mail.box.edit.password_again=Password again |
ak.kickup.page.mail.box.edit.domain=Domain |
ak.kickup.page.mail.box.edit.domain.empty=-- please select -- |
ak.kickup.page.mail.box.edit.owner=Owner |
ak.kickup.page.mail.box.edit.owner.empty=-- create an user -- |
ak.kickup.page.mail.box.edit.systemuser=System user |
ak.kickup.page.mail.box.edit.systemuser.empty=-- please select -- |
ak.kickup.page.mail.box.edit.viruscheck=check mails for viruses |
ak.kickup.page.mail.box.edit.spamcheck=check mails for spam |
ak.kickup.page.mail.box.edit.enabled=Enabled |
ak.kickup.page.mail.box.edit.comment=Comment |
ak.kickup.page.mail.box.edit.submit=submit |
ak.kickup.page.mail.box.edit.back=back |
ak.kickup.page.mail.box.view.title=Host Admiral - mail box - view |
ak.kickup.page.mail.box.view.login=Box |
ak.kickup.page.mail.box.view.domain=Domain |
ak.kickup.page.mail.box.view.owner=Owner |
ak.kickup.page.mail.box.view.systemuser=System user |
ak.kickup.page.mail.box.view.systemuser.empty=[default user] |
ak.kickup.page.mail.box.view.viruscheck=check mails for viruses |
ak.kickup.page.mail.box.view.viruscheck.true=yes |
ak.kickup.page.mail.box.view.viruscheck.false=no |
ak.kickup.page.mail.box.view.spamcheck=check mails for spam |
ak.kickup.page.mail.box.view.spamcheck.true=yes |
ak.kickup.page.mail.box.view.spamcheck.false=no |
ak.kickup.page.mail.box.view.enabled=Enabled |
ak.kickup.page.mail.box.view.enabled.true=yes |
ak.kickup.page.mail.box.view.enabled.false=no |
ak.kickup.page.mail.box.view.comment=Comment |
ak.kickup.page.mail.box.view.back=back |
ak.kickup.page.mail.alias.list.title=Host Admiral - mail aliases - list |
ak.kickup.page.mail.alias.list.alias=Alias |
ak.kickup.page.mail.alias.list.domain=Domain |
ak.kickup.page.mail.alias.list.owner=Owner |
ak.kickup.page.mail.alias.list.enabled=Enabled |
ak.kickup.page.mail.alias.list.edit=edit |
ak.kickup.page.mail.alias.list.editdests=edit |
ak.kickup.page.mail.alias.list.view=view |
ak.kickup.page.mail.alias.list.delete=delete |
ak.kickup.page.mail.alias.list.back=back |
ak.kickup.page.mail.alias.list.add=add new mail alias |
ak.kickup.page.mail.alias.edit.title=Host Admiral - mail alias - edit |
ak.kickup.page.mail.alias.edit.address=Address |
ak.kickup.page.mail.alias.edit.domain=Domain |
ak.kickup.page.mail.alias.edit.domain.empty=-- please select -- |
ak.kickup.page.mail.alias.edit.owner=Owner |
ak.kickup.page.mail.alias.edit.owner.empty=-- please select -- |
ak.kickup.page.mail.alias.edit.enabled=Enabled |
ak.kickup.page.mail.alias.edit.comment=Comment |
ak.kickup.page.mail.alias.edit.header.tomailbox=To mailbox |
ak.kickup.page.mail.alias.edit.header.toexternal=or to external email |
ak.kickup.page.mail.alias.edit.header.enabled=Enabled |
ak.kickup.page.mail.alias.edit.header.comment=Comment |
ak.kickup.page.mail.alias.edit.external=external redirect |
ak.kickup.page.mail.alias.edit.add=add new destination |
ak.kickup.page.mail.alias.edit.delete=delete |
ak.kickup.page.mail.alias.edit.submit=submit |
ak.kickup.page.mail.alias.edit.back=back |
ak.kickup.page.mail.alias.editdest.title=Host Admiral - mail alias - edit |
ak.kickup.page.mail.alias.editdest.address=Address |
ak.kickup.page.mail.alias.editdest.domain=Domain |
ak.kickup.page.mail.alias.editdest.owner=Owner |
ak.kickup.page.mail.alias.editdest.enabled=Enabled |
ak.kickup.page.mail.alias.editdest.enabled.true=yes |
ak.kickup.page.mail.alias.editdest.enabled.false=no |
ak.kickup.page.mail.alias.editdest.comment=Comment |
ak.kickup.page.mail.alias.editdest.header.tomailbox=To mailbox |
ak.kickup.page.mail.alias.editdest.header.toexternal=or to external email |
ak.kickup.page.mail.alias.editdest.header.enabled=Enabled |
ak.kickup.page.mail.alias.editdest.header.comment=Comment |
ak.kickup.page.mail.alias.editdest.external=external redirect |
ak.kickup.page.mail.alias.editdest.add=add new destination |
ak.kickup.page.mail.alias.editdest.delete=delete |
ak.kickup.page.mail.alias.editdest.submit=submit |
ak.kickup.page.mail.alias.editdest.back=back |
ak.kickup.page.mail.alias.view.title=Host Admiral - mail alias - view |
ak.kickup.page.mail.alias.view.address=Address |
ak.kickup.page.mail.alias.view.domain=Domain |
ak.kickup.page.mail.alias.view.owner=Owner |
ak.kickup.page.mail.alias.view.enabled=Enabled |
ak.kickup.page.mail.alias.view.enabled.true=yes |
ak.kickup.page.mail.alias.view.enabled.false=no |
ak.kickup.page.mail.alias.view.comment=Comment |
ak.kickup.page.mail.alias.view.header.tomailbox=To mailbox |
ak.kickup.page.mail.alias.view.header.toexternal=or to external email |
ak.kickup.page.mail.alias.view.header.enabled=Enabled |
ak.kickup.page.mail.alias.view.dest.enabled.true=yes |
ak.kickup.page.mail.alias.view.dest.enabled.false=no |
ak.kickup.page.mail.alias.view.header.comment=Comment |
ak.kickup.page.mail.alias.view.external=external redirect |
ak.kickup.page.mail.alias.view.back=back |
org.apache.struts.taglib.bean.format.sql.timestamp=dd-MM-yyyy HH:mm:ss.SSS |
/it-ru/trunk/src/ak/kickup/util/ModelSecurityException.java |
---|
0,0 → 1,10 |
package ak.kickup.util; |
public class ModelSecurityException |
extends ModelException |
{ |
public ModelSecurityException() |
{ |
super("ak.kickup.core.access.denied"); |
} |
} |
/it-ru/trunk/src/ak/kickup/util/UserException.java |
---|
0,0 → 1,28 |
package ak.kickup.util; |
public class UserException |
extends Exception |
{ |
private Object[] values; |
public UserException() |
{ |
this(null, null); |
} |
public UserException(String message) |
{ |
this(message, null); |
} |
public UserException(String message, Object[] values) |
{ |
super(message); |
this.values = values; |
} |
public Object[] getValues() |
{ |
return values; |
} |
} |
/it-ru/trunk/src/ak/kickup/util/StringConverter.java |
---|
0,0 → 1,119 |
package ak.kickup.util; |
import java.math.BigDecimal; |
import java.util.Date; |
import java.text.DateFormat; |
import java.text.NumberFormat; |
import java.text.DecimalFormat; |
import java.text.ParseException; |
public abstract class StringConverter |
{ |
public static boolean isEmpty(Object o) |
{ |
if(o == null) |
return true; |
else if((o instanceof String) && ((String)o).equals("")) |
return true; |
else |
return false; |
} |
public static String preparse(Object o) |
{ |
if(o instanceof String) { |
String s = (String)o; |
if(s == null || s.equals("")) |
return null; |
else |
return s; |
} |
else { |
throw new ClassCastException("String is expected, but it is " + o.getClass()); |
} |
} |
public static Long parseLong(Object o) |
throws NumberFormatException |
{ |
String s = preparse(o); |
return (s == null) ? null : new Long(s); |
} |
public static Integer parseInteger(Object o) |
throws NumberFormatException |
{ |
String s = preparse(o); |
return (s == null) ? null : new Integer(s); |
} |
public static BigDecimal parseNumber(Object o) |
throws NumberFormatException, ParseException |
{ |
String s = preparse(o); |
return (s == null) |
? null : new BigDecimal(NumberFormat.getInstance().parse(s).doubleValue()); |
} |
public static String toNumber(Number n) |
{ |
if(n == null) |
return null; |
else |
return (new DecimalFormat("0")).format(n); |
} |
public static BigDecimal parseCurrency(Object o) |
throws NumberFormatException, ParseException |
{ |
String s = preparse(o); |
return (s == null) |
? null : new BigDecimal(NumberFormat.getInstance().parse(s).doubleValue()); |
} |
public static String toCurrency(Number n) |
{ |
if(n == null) |
return null; |
else |
return (new DecimalFormat("0.00")).format(n); |
} |
public static Date parseDate(Object o) |
throws NumberFormatException, ParseException |
{ |
String s = preparse(o); |
return (s == null) ? null : DateFormat.getDateInstance().parse(s); |
} |
public static String toDate(Date d) |
{ |
if(d == null) |
return null; |
else |
return DateFormat.getDateInstance().format(d); |
} |
public static Date parseDateTime(Object o) |
throws NumberFormatException, ParseException |
{ |
String s = preparse(o); |
return (s == null) ? null : DateFormat.getDateTimeInstance().parse(s); |
} |
public static String toDateTime(Date d) |
{ |
if(d == null) |
return null; |
else |
return DateFormat.getDateTimeInstance().format(d); |
} |
public static String toString(Object o) |
{ |
if(o == null) |
return null; |
else |
return o.toString(); |
} |
} |
/it-ru/trunk/src/ak/kickup/util/HibernateUtil.java |
---|
0,0 → 1,109 |
package ak.kickup.util; |
import net.sf.hibernate.*; |
import net.sf.hibernate.cfg.*; |
public class HibernateUtil |
{ |
private static Configuration configuration; |
private static SessionFactory sessionFactory; |
private static final ThreadLocal hibernateBean = new ThreadLocal(); |
public static Configuration getConfiguration() |
throws HibernateException |
{ |
if(configuration == null) |
configuration = new Configuration(); |
return configuration; |
} |
public static SessionFactory getSessionFactory() |
throws HibernateException |
{ |
if(sessionFactory == null) |
sessionFactory = getConfiguration().configure().buildSessionFactory(); |
return sessionFactory; |
} |
private static HibernateBean currentBean() |
throws HibernateException |
{ |
HibernateBean hb = (HibernateBean)hibernateBean.get(); |
if(hb == null) { |
hb = new HibernateBean(); |
hb.session = getSessionFactory().openSession(); |
hibernateBean.set(hb); |
} |
return hb; |
} |
public static Session currentSession() |
throws HibernateException |
{ |
return currentBean().session; |
} |
public static void closeSession() |
throws HibernateException, ModelException |
{ |
HibernateBean hb = (HibernateBean)hibernateBean.get(); |
if(hb == null) |
throw new ModelException("No session found for this thread"); |
hibernateBean.set(null); |
hb.session.close(); |
} |
public static void beginTransaction() |
throws HibernateException, ModelException |
{ |
HibernateBean hb = (HibernateBean)hibernateBean.get(); |
if(hb != null && hb.transaction != null) |
throw new ModelException("Transaction is already open"); |
currentBean().transaction = currentSession().beginTransaction(); |
} |
public static boolean isTransactionOpen() |
throws HibernateException, ModelException |
{ |
HibernateBean hb = (HibernateBean)hibernateBean.get(); |
return (hb != null) && (hb.transaction != null); |
} |
public static void commitTransaction() |
throws HibernateException, ModelException |
{ |
HibernateBean hb = (HibernateBean)hibernateBean.get(); |
if(hb == null || hb.transaction == null) |
throw new ModelException("No open transaction"); |
hb.transaction.commit(); |
hb.transaction = null; |
} |
public static void rollbackTransaction() |
throws HibernateException, ModelException |
{ |
HibernateBean hb = (HibernateBean)hibernateBean.get(); |
if(hb == null || hb.transaction == null) |
throw new ModelException("No open transaction"); |
hb.transaction.rollback(); |
hb.transaction = null; |
} |
static class HibernateBean |
{ |
public Session session; |
public Transaction transaction; |
} |
} |
/it-ru/trunk/src/ak/kickup/util/ModelException.java |
---|
0,0 → 1,44 |
package ak.kickup.util; |
public class ModelException |
extends Exception |
{ |
private Exception chainedException; |
public ModelException() |
{ |
this(null, null); |
} |
public ModelException(String message) |
{ |
this(message, null); |
} |
public ModelException(Exception chainedException) |
{ |
this(null, chainedException); |
} |
public ModelException(String message, Exception chainedException) |
{ |
super(message); |
this.chainedException = chainedException; |
} |
public Exception getChainedException() |
{ |
return chainedException; |
} |
public void setChainedException(Exception chainedException) |
{ |
this.chainedException = chainedException; |
} |
public String toString() |
{ |
return super.toString() |
+ (chainedException == null ? "" : "\n" + chainedException.toString()); |
} |
} |
/it-ru/trunk/src/ak/kickup/util/FormException.java |
---|
0,0 → 1,39 |
package ak.kickup.util; |
public class FormException |
extends UserException |
{ |
private String property; |
public FormException() |
{ |
this(null, null, null); |
} |
public FormException(String message) |
{ |
this(message, null, null); |
} |
public FormException(String message, String property) |
{ |
this(message, property, null); |
} |
public FormException(String message, String property, Object[] values) |
{ |
super(message, values); |
this.property = property; |
} |
public String getProperty() |
{ |
return property; |
} |
public String toString() |
{ |
return super.toString() |
+ (property == null ? "" : " for " + property); |
} |
} |
/it-ru/trunk/src/ak/kickup/util/Validator.java |
---|
0,0 → 1,58 |
package ak.kickup.util; |
import java.math.BigDecimal; |
import java.text.NumberFormat; |
import java.text.ParseException; |
import javax.servlet.http.HttpServletRequest; |
import org.apache.commons.validator.Field; |
import org.apache.commons.validator.ValidatorAction; |
import org.apache.commons.validator.ValidatorUtil; |
import org.apache.struts.action.ActionError; |
import org.apache.struts.action.ActionErrors; |
import org.apache.struts.validator.Resources; |
public class Validator |
{ |
public static BigDecimal validateNumber(Object bean, ValidatorAction va, Field field, |
ActionErrors errors, HttpServletRequest request) |
{ |
String value = null; |
if((bean == null) || (bean instanceof String)) |
value = (String)bean; |
else |
value = ValidatorUtil.getValueAsString(bean, field.getProperty()); |
if(value == null || "".equals(value)) return null; |
try { |
return new BigDecimal(NumberFormat.getInstance().parse(value).doubleValue()); |
} |
catch(ParseException ex) { |
errors.add(field.getKey(), Resources.getActionError(request, va, field)); |
return null; |
} |
} |
public static BigDecimal validateCurrency(Object bean, ValidatorAction va, Field field, |
ActionErrors errors, HttpServletRequest request) |
{ |
String value = null; |
if((bean == null) || (bean instanceof String)) |
value = (String)bean; |
else |
value = ValidatorUtil.getValueAsString(bean, field.getProperty()); |
if(value == null || "".equals(value)) return null; |
try { |
return new BigDecimal(NumberFormat.getInstance().parse(value).doubleValue()); |
} |
catch(ParseException ex) { |
errors.add(field.getKey(), Resources.getActionError(request, va, field)); |
return null; |
} |
} |
} |