} catch (DomainException e) { setErrorMessage(e.getMessage());
    public String associateNewFunction() throws FenixFilterException, FenixServiceException,            ParseException {        if (this.getUnit() == null                || (!this.getUnit().getTopUnits().isEmpty() && !this.getUnit().getTopUnits().contains(                        getEmployeeDepartmentUnit()))                || (this.getUnit().getTopUnits().isEmpty() && !this.getUnit().equals(                        getEmployeeDepartmentUnit()))) {            setErrorMessage("error.invalid.unit");        } else if (!this.getUnit().getFunctions().contains(this.getFunction())) {            setErrorMessage("error.invalid.function");        } else if (this.getPerson().containsActiveFunction(this.getFunction())) {            setErrorMessage("error.duplicate.function");        } else {            DateFormat format = new SimpleDateFormat("dd/MM/yyyy");            Integer credits = Integer.valueOf(this.getCredits());            Date beginDate_ = null, endDate_ = null;            try {                beginDate_ = format.parse(this.getBeginDate());                endDate_ = format.parse(this.getEndDate());                final Object[] argsToRead = { this.getFunctionID(), this.getPersonID(), credits,                        beginDate_, endDate_ };                ServiceUtils.executeService(getUserView(), "AssociateNewFunctionToPerson", argsToRead);                setErrorMessage("message.success");                return "success";            } catch (ParseException e) {                setErrorMessage("error.date1.format");            } catch (FenixServiceException e) {                setErrorMessage(e.getMessage());            }        }        return "";    }