Package uk.org.woodcraft.bookings.persistence

Source Code of uk.org.woodcraft.bookings.persistence.TransactionAction

package uk.org.woodcraft.bookings.persistence;

import java.util.List;

import org.apache.struts2.interceptor.validation.SkipValidation;

import uk.org.woodcraft.bookings.auth.SecurityModel;
import uk.org.woodcraft.bookings.datamodel.Transaction;
import uk.org.woodcraft.bookings.datamodel.TransactionType;

import com.google.appengine.api.datastore.Key;

public class TransactionAction extends BasePersistenceAction<Transaction>{

  private static final long serialVersionUID = 1L;
 
  @Override
  public String save() {
    SecurityModel.checkIsAdminUser();
    return super.save();
  }
 
  @Override
  public String edit() {
    SecurityModel.checkIsAdminUser();
    return super.edit();
  }
 
  @SkipValidation
  public String list() {
   
    SecurityModel.checkIsAdminUser();
    setModelList(CannedQueries.transactionsForEvent(getCurrentEvent()));
    return SUCCESS;
  }
 
  @Override
  public String delete() {
    SecurityModel.checkIsAdminUser();
    return super.delete();
  }

  @Override
  public void prepare() throws Exception {
   
    Key key = getWebKeyAsKey();
    if (key != null)
    {
      setModel(CannedQueries.TransactionByKey(key));
    } else {
      setModel(new Transaction(getCurrentUnit().getKeyCheckNotNull(), getCurrentEvent().getKeyCheckNotNull(), getCurrentTime()));
    }
  }
 
  public List<TransactionType> getTransactionTypes()
  {
    return TransactionType.userUpdatableValues();
  }
}
TOP

Related Classes of uk.org.woodcraft.bookings.persistence.TransactionAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.