protected void setCreateJobOffer(JobOfferBean bean) { setForm(bean); setCreationDate(bean.getCreationDate()); setJobBankYear(JobBankYear.findJobBankYear(bean.getCreationDate().getYear())); setEnterprise(bean.getEnterprise()); setJobOfferProcess(new JobOfferProcess(this)); }
private void checkDates(JobOfferBean bean) { LocalDate beginDate = bean.getBeginDate(); LocalDate endDate = bean.getEndDate(); if (beginDate.isAfter(endDate)) { throw new DomainException( "message.jobOffer.beginDate.isAfter.endDate", ResourceBundle.getBundle(JobBankSystem.JOB_BANK_RESOURCES, Language.getLocale())); } int days = Days.daysBetween(bean.getBeginDate(), bean.getEndDate()).getDays(); if (days < getMinNumberActiveDaysOffer()) { throw new DomainException( "message.error.jobOffer.min.active.days.offer", DomainException.getResourceFor(JobBankSystem.JOB_BANK_RESOURCES), getMinNumberActiveDaysOffer().toString()); } if (days > getMaxNumberActiveDaysOffer()) { throw new DomainException( "message.error.jobOffer.max.active.days.offer", DomainException.getResourceFor(JobBankSystem.JOB_BANK_RESOURCES), getMaxNumberActiveDaysOffer().toString()); } }
private void setForm(JobOfferBean bean) { if (!JobBankSystem.getInstance().isNPEMember()) { checkDates(bean); } setPlace(bean.getPlace()); setFunction(bean.getFunction()); setFunctionDescription(bean.getFunctionDescription()); setJobOfferType(bean.getJobOfferType()); setVacancies(bean.getVacancies()); setRemoteDegrees(bean.getDegrees()); setTerms(bean.getTerms()); setRequirements(bean.getRequirements()); setBeginDate(bean.getBeginDate()); setEndDate(bean.getEndDate()); if (getJobOfferExternal() != null) { getJobOfferExternal().setExternalLink(bean.getExternalLink()); } }