Package ru.portnyagin.helpdeskru.model

Examples of ru.portnyagin.helpdeskru.model.Request


        return listRequest;
    }

   
    public void addNewRequest() {
        currentRequestBean.setCurrent(new Request());
    }   
View Full Code Here


    public Object getAsObject(FacesContext context, UIComponent component, String value) {
        if (value == null || value.length() == 0){
            return null;
        }

        Request request = requestService.find(Long.valueOf(value));

        if (request == null) {
            throw new ConverterException(new FacesMessage("Unknown Request ID: " + value));
        }
View Full Code Here

   
   
   
    public void update(Request current, UserHD curUser) {
       
        Request preUpdate;
        if (current.getId() == null) {     // новый запрос
            preUpdate = new Request();
        }
        else {
            preUpdate = em.find(Request.class, current.getId());
            if (preUpdate == null) {
                JsfUtil.addErrorMessage(current.getId() + ": "+ ResourceBundle.getBundle("property",
                        FacesContext.getCurrentInstance().getViewRoot().getLocale()).
                        getString("requestNotFound"));           
               
                return;
            }
        }
       
        try {
            try {
                ut.begin();
            } catch (javax.transaction.NotSupportedException | SystemException ex) {
//                ex.printStackTrace();
                JsfUtil.addErrorMessage(ex.toString());
            }
           
            // состояние
            if(!current.getStateRequest().equals(preUpdate.getStateRequest())) {
                current.setStateDate(new Date()); // при изменении состояния обновляем дату состояния
                HistoryRequest h = new HistoryRequest(current, curUser, new Date(),
                        ResourceBundle.getBundle("property",
                        FacesContext.getCurrentInstance().getViewRoot().getLocale()).
                        getString("common.stateRequest"),
                        current.getStateRequest().getName());
                em.persist(h);
            }

            // исполнитель. м.б. null
            String curPerformer;
            String prevPerformer;
            if(current.getPerformer() != null) {
                curPerformer = current.getPerformer().getName();
            }
            else {
                curPerformer = "";
            }
           
            if(preUpdate.getPerformer() != null) {
                prevPerformer = preUpdate.getPerformer().getName();
            }
            else {
                prevPerformer = "";
            }
           
            if(!curPerformer.equals(prevPerformer)) {
                    HistoryRequest h = new HistoryRequest(current, curUser, new Date(),
                        ResourceBundle.getBundle("property",
                        FacesContext.getCurrentInstance().getViewRoot().getLocale()).
                        getString("common.performer"),
                        curPerformer);
                    em.persist(h);
            }

            // объект обслуживания. м.б. null
            String curServiceObject;
            String prevServiceObject;
            if(current.getServiceObject() != null) {
                curServiceObject = current.getServiceObject().getName();
            }
            else {
                curServiceObject = "";
            }
           
            if(preUpdate.getServiceObject() != null) {
                prevServiceObject = preUpdate.getServiceObject().getName();
            }
            else {
                prevServiceObject = "";
            }
           
            if(!curServiceObject.equals(prevServiceObject)) {
                    HistoryRequest h = new HistoryRequest(current, curUser, new Date(),
                        ResourceBundle.getBundle("property",
                        FacesContext.getCurrentInstance().getViewRoot().getLocale()).
                        getString("common.serviceObject"),
                        curServiceObject);
                    em.persist(h);
            }
           
            // описание м.б. null
            String curDescription;
            String prevDescription;
            if(current.getDescription() != null) {
                curDescription = current.getDescription();
            }
            else {
                curDescription = "";
            }
           
            if(preUpdate.getDescription() != null) {
                prevDescription = preUpdate.getDescription();
            }
            else {
                prevDescription = "";
            }
           
            if(!curDescription.equals(prevDescription)) {
                    HistoryRequest h = new HistoryRequest(current, curUser, new Date(),
                        ResourceBundle.getBundle("property",
                        FacesContext.getCurrentInstance().getViewRoot().getLocale()).
                        getString("common.description"),
                        curDescription);
                    em.persist(h);
            }
           
            // приоритет
            if(!current.getPriority().equals(preUpdate.getPriority())) {
                HistoryRequest h = new HistoryRequest(current, curUser, new Date(),
                        ResourceBundle.getBundle("property",
                        FacesContext.getCurrentInstance().getViewRoot().getLocale()).
                        getString("common.priority"),
                        current.getPriority().getName());
View Full Code Here

TOP

Related Classes of ru.portnyagin.helpdeskru.model.Request

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.