Package healthwatcher.view.command

Source Code of healthwatcher.view.command.UpdateSymptomData

package healthwatcher.view.command;

import healthwatcher.model.complaint.Symptom;
import healthwatcher.view.IFacade;

import java.io.PrintWriter;

import lib.exceptions.InvalidSessionException;
import lib.util.HTMLCode;

public class UpdateSymptomData extends Command {
 
  public UpdateSymptomData(IFacade f) {
    super(f);
  }

  public void execute() throws Exception {
    PrintWriter out = response.getWriter();
   
    try {
     
          Symptom symptom;      
       
          if (! request.isAuthorized()) {
                throw new InvalidSessionException();
            }         
          symptom = (Symptom) request.get(UpdateSymptomSearch.SYMPTOM);
            String descricao = request.getInput("descricao");           
           
            symptom.setDescription(descricao);
          facade.updateSymptom(symptom);
         
            out.println(HTMLCode.htmlPageAdministrator("Operation executed", "Symptom updated"));

        }catch(Exception e){
            out.println(HTMLCode.errorPage("Comunitation error, please try again later."));
            e.printStackTrace(out);
        } finally {out.close();}
  }

}
TOP

Related Classes of healthwatcher.view.command.UpdateSymptomData

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.