public EmpDiscipline updateEmpDiscipline(EmpDiscipline empDiscipline) throws SystemException { try { EmpDiscipline o = super.updateEmpDiscipline(empDiscipline); // index new EmpDiscipline Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(EmpDiscipline.class); indexer.reindex(EmpDiscipline.class.getName(), o.getEmpDisciplineId()); return o; } catch (SearchException e) { LOGGER.info(e); } return null; }
public EmpDiscipline createPrePersistedEntity(ServiceContext serviceContext) { try { final long id = counterLocalService.increment(); EmpDiscipline obj = empDisciplinePersistence.create(id); obj.setCompanyId(serviceContext.getCompanyId()); obj.setGroupId(serviceContext.getScopeGroupId()); obj.setUserId(serviceContext.getUserId()); obj.setCreateDate(new Date()); return obj; } catch (SystemException e) { LOGGER.info(e); } return null; }
public EmpDiscipline addEmpDiscipline( EmpDiscipline prePersistedObj, ServiceContext serviceContext) { try { final EmpDiscipline o = super.addEmpDiscipline(prePersistedObj); // add permission resourceLocalService.addResources( o.getCompanyId(), o.getGroupId(), o.getUserId(), EmpDiscipline.class.getName(), o.getEmpDisciplineId(), false, true, true); // index new EmpDiscipline Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(EmpDiscipline.class); indexer.reindex(EmpDiscipline.class.getName(), o.getEmpDisciplineId()); final Emp emp = empLocalService.fetchEmp(o.getEmpId()); emp.setStatus(EmployeeStatus.DISCIPLINE.toString()); empLocalService.updateEmp(emp); return o; } catch (SystemException e) { LOGGER.info(e); } catch (SearchException e) { LOGGER.info(e); } catch (PortalException e) { LOGGER.info(e); } return null; }
public EmpDiscipline addEmpDiscipline( long empId, String decisionNo, String content, String type, Date effectiveDate, String additionalType, String description, ServiceContext serviceContext) { EmpDiscipline obj = createPrePersistedEntity(serviceContext); obj.setEmpId(empId); obj.setDecisionNo(decisionNo); obj.setContent(content); obj.setDisciplineType(type); obj.setEffectiveDate(effectiveDate); obj.setAdditionalDisciplineType(additionalType); obj.setDescription(description); return this.addEmpDiscipline(obj, serviceContext); }
public EmpDiscipline updateEmpDiscipline( long id, String decisionNo, String type, String content, Date effectiveDate, String additionType, String desc) { try { final EmpDiscipline obj = super.fetchEmpDiscipline(id); obj.setDecisionNo(decisionNo); obj.setDisciplineType(type); obj.setContent(content); obj.setEffectiveDate(effectiveDate); obj.setAdditionalDisciplineType(additionType); obj.setDescription(desc); return this.updateEmpDiscipline(obj); } catch (SystemException e) { LOGGER.info(e); } return null; }