Package pl.zgora.uz.wmie.fe.sps.business.service

Examples of pl.zgora.uz.wmie.fe.sps.business.service.AcademyService


  @Override
  public DataResult tableAjax(Map<String, String> filters,
      String[] projections, String columnOrder, String columnOrderDir,
      int startIndex) throws Exception {
    AcademyService academyService = (AcademyService) BusinessUtil
        .findBusiness("AcademyService");

    ProjectionList projectionList = Projections.projectionList();
    for (int i = 0; i < projections.length; i++) {
      projectionList.add(Projections.property(projections[i]));
    }
    List<Criterion> criterions = new ArrayList<Criterion>();

    FiltersUtil filtersUtil = new FiltersUtil();
    criterions = filtersUtil.createCriteriaFromFilters(filters,
        Academy.class);

    List<Order> orders = null;
    // stala czesc sluzaca sortowaniu
    if (columnOrder.compareTo("null") != 0) {
      orders = new ArrayList<Order>();
      if (columnOrderDir.compareTo("desc") == 0) {
        orders.add(Order.desc(columnOrder));
      } else {
        orders.add(Order.asc(columnOrder));
      }
    }

    startIndex = (startIndex - 1) * ROW_AMOUNT;
    DataResult dataResult = academyService.findByParams(projectionList,
        criterions, orders, startIndex, ROW_AMOUNT);
    return dataResult;
  }
View Full Code Here


  private static final String EDIT_ACTION = "edit";

  @Override
  protected void service(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    AcademyService academyService = null;
    try {
      academyService = (AcademyService) BusinessUtil
          .findBusiness("AcademyService");
    } catch (Exception e) {
      e.printStackTrace();
    }

    String targetPage = null;
    String method = getInitParameter("method");
    targetPage = getInitParameter("page");
    if (TABLE_ACTION.equals(method)) {

    } else if (PRE_ADD_ACTION.equals(method)) {

    } else if (ADD_ACTION.equals(method)) {
      String academyName = req.getParameter("academyName");
      String academyAddress = req.getParameter("academyAddress");
      String academyLogin = req.getParameter("academyLogin");
      String academyPassword = req.getParameter("academyPassword");

      Academy academy = new Academy();
      academy.setName(academyName);
      academy.setAddress(academyAddress);
      academy.setRegistrationDate(new Date());
      academy.setUserLogin(academyLogin);
      academy.setUserPassword(academyPassword);
      try {
        academyService.save(academy);
      } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }

      req.setAttribute("refreshTableFunction", "refreshAcademyTable");
    } else if (PRE_EDIT_ACTION.equals(method)) {
      Integer id = Integer.valueOf(req.getParameter("id"));
      try {
        Academy academy = academyService.load(id);
        req.setAttribute("academyId", String.valueOf(id));
        req.setAttribute("academyName", academy.getName());
        req.setAttribute("academyAddress", academy.getAddress());
        req.setAttribute("academyLogin", academy.getUserLogin());
        req.setAttribute("academyPassword", academy.getUserPassword());
      } catch (Exception e) {
        e.printStackTrace();
      }
      req.setAttribute("isEdit", Boolean.TRUE);
    } else if (EDIT_ACTION.equals(method)) {
      String academyId = req.getParameter("academyId");
      String academyName = req.getParameter("academyName");
      String academyAddress = req.getParameter("academyAddress");
      String academyLogin = req.getParameter("academyLogin");
      String academyPassword = req.getParameter("academyPassword");

      Academy academy = new Academy();
      academy.setIdAcademy(Integer.valueOf(academyId));
      academy.setName(academyName);
      academy.setAddress(academyAddress);
      academy.setRegistrationDate(new Date());
      academy.setUserLogin(academyLogin);
      academy.setUserPassword(academyPassword);

      try {
        academyService.update(academy);
      } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      req.setAttribute("refreshTableFunction", "refreshAcademyTable");
View Full Code Here

import pl.zgora.uz.wmie.fe.sps.business.service.AcademyService;
import pl.zgora.uz.wmie.fe.sps.business.util.BusinessUtil;

public class AcademyAjaxAction {
  public void deleteSelectedAcademy(Integer id) throws Exception {
    AcademyService academyService = (AcademyService) BusinessUtil
        .findBusiness("AcademyService");
    academyService.deleteById(id);
  }
View Full Code Here

  protected void service(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    String targetPage = null;
    String method = getInitParameter("method");
    AcademyService academyService = null;
    try {
      academyService = (AcademyService) BusinessUtil
          .findBusiness("AcademyService");
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    StudentGuardianService studentGuardianService = null;
    try {
      studentGuardianService = (StudentGuardianService) BusinessUtil
          .findBusiness("StudentGuardianService");
    } catch (Exception e2) {
      e2.printStackTrace();
    }

    if (TABLE_ACTION.equals(method)) {
      targetPage = getInitParameter("page");
      HashMap<String, String> selectData = null;
      List<Academy> lista;
      try {
        lista = academyService.findAll();
        for (Iterator iterator = lista.iterator(); iterator.hasNext();) {
          Academy academy = (Academy) iterator.next();
          selectData.put(String.valueOf(academy.getIdAcademy()),
              academy.getName());
          req.setAttribute("academy", selectData);
View Full Code Here

TOP

Related Classes of pl.zgora.uz.wmie.fe.sps.business.service.AcademyService

Copyright © 2018 www.massapicom. 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.