Package com.zesped.action

Source Code of com.zesped.action.CheckCanDeleteAccountingAccount

package com.zesped.action;

import net.sourceforge.stripes.action.DefaultHandler;
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.validation.LocalizableError;

import com.zesped.Log;
import com.zesped.model.AccountingAccount;

import es.ipsa.atril.SortableList;
import es.ipsa.atril.doc.user.Dms;
import es.ipsa.atril.doc.user.Document;

public class CheckCanDeleteAccountingAccount extends BaseAjaxBean {

  @DefaultHandler
  public Resolution form() {

    final String id = getParam("id","");

    try {
          connect(getSessionAttribute("nickname"), getSessionAttribute("password"));
          Dms oDms = getSession().getDms();
          AccountingAccount oAacc = new AccountingAccount(oDms, id);
          SortableList<Document> oTcks = oDms.query("Ticket$accounting_uuid='"+oAacc.getUuid()+"'");
      if (!oTcks.isEmpty()) {
        addError(new LocalizableError("com.zesped.action.CheckCanDeleteAccountingAccount.hasTickets"));       
      }
      disconnect();
      } catch (Exception xcpt) {
        Log.out.error("CheckCanDeleteAccountingAccount.form() "+xcpt.getClass().getName()+" "+xcpt.getMessage(), xcpt);
      } finally {
        close();
      }

    return AjaxResponseResolution();
  }   
 
}
TOP

Related Classes of com.zesped.action.CheckCanDeleteAccountingAccount

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.