IDDocumentType identificationDocumentType = IDDocumentType.valueOf((String) choosePersonForm.get("identificationDocumentType"));
String identificationDocumentString = (String) choosePersonForm.get("identificationDocumentType"); IDDocumentType identificationDocumentType = null; if(identificationDocumentString != null && !identificationDocumentString.equals("")){ identificationDocumentType = IDDocumentType.valueOf(identificationDocumentString); }
    public ActionForward getPersonGuideList(ActionMapping mapping, ActionForm form,            HttpServletRequest request, HttpServletResponse response) throws Exception {        HttpSession session = request.getSession(false);        if (session != null) {            IUserView userView = (IUserView) session.getAttribute(SessionConstants.U_VIEW);            DynaActionForm choosePersonForm = (DynaActionForm) form;            String identificationDocumentNumber = (String) choosePersonForm                    .get("identificationDocumentNumber");            IDDocumentType identificationDocumentType = IDDocumentType.valueOf((String) choosePersonForm.get("identificationDocumentType"));            String studentNumber = (String) choosePersonForm.get("studentNumber");            if (identificationDocumentNumber == null || identificationDocumentNumber.length() == 0) {                InfoStudent infoStudent = null;                if (studentNumber != null && studentNumber.length() > 0) {                    Object args[] = { Integer.valueOf(studentNumber) };                    try {                        infoStudent = (InfoStudent) ServiceManagerServiceFactory.executeService(                                userView, "ReadStudentByNumberAndAllDegreeTypes", args);                    } catch (FenixServiceException e) {                        throw new FenixActionException(e);                    }                }                if (infoStudent == null) {                    throw new NonExistingActionException("A Person");                }                identificationDocumentNumber = infoStudent.getInfoPerson()                        .getNumeroDocumentoIdentificacao();                identificationDocumentType = infoStudent.getInfoPerson().getTipoDocumentoIdentificacao();            }            Object args[] = { identificationDocumentNumber, identificationDocumentType };            List result = null;            try {                result = (List) ServiceManagerServiceFactory.executeService(userView, "ChooseGuide",                        args);            } catch (NonExistingServiceException e) {                throw new NonExistingActionException("A Person", e);            }            if (result == null) {                throw new NonExistingActionException("error.exception.noGuidesForPerson",                        "Guias para esta pessoa");            }            request.setAttribute(SessionConstants.GUIDE_LIST, result);            return mapping.findForward("ShowGuideList");        }        throw new Exception();    }