Integer departmentID = null, degreeID = null; if (this.getUnit().getDepartment() != null) { departmentID = this.getUnit().getDepartment().getIdInternal(); } if (this.getUnit().getDegree() != null) { degreeID = this.getUnit().getDegree().getIdInternal(); }
CreateNewUnitParameters parameters = new CreateNewUnitParameters(departmentID, degreeID, this, 2);
    public String associateParentUnit() throws FenixFilterException, FenixServiceException {        String costCenterCodeString = getValidCosteCenterCode();        Integer departmentID = null, degreeID = null;        if (this.getUnit().getDepartment() != null) {            departmentID = this.getUnit().getDepartment().getIdInternal();        }        if (this.getUnit().getDegree() != null) {            degreeID = this.getUnit().getDegree().getIdInternal();        }        final Object[] argsToRead = { this.getUnit().getIdInternal(),                this.getChooseUnit().getIdInternal(), this.getUnit().getName(), costCenterCodeString,                this.getUnit().getBeginDate(), this.getUnit().getEndDate(), this.getUnit().getType(),                departmentID, degreeID };        try {            ServiceUtils.executeService(getUserView(), "CreateNewUnit", argsToRead);        } catch (FenixServiceException e) {            setErrorMessage(e.getMessage());            return "";        }        return "backToUnitDetails";    }