| | |
| | | package com.vci.web.service.impl; |
| | | |
| | | import com.vci.client.common.providers.ServiceProvider; |
| | | import com.vci.corba.common.VCIError; |
| | | import com.vci.corba.omd.lcm.LifeCycle; |
| | | import com.vci.starter.web.annotation.log.VciUnLog; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.BaseQueryObject; |
| | |
| | | * @throws VciBaseException 如果目标生命周期和当前生命周期状态没有连接线时抛出异常 |
| | | */ |
| | | @Override |
| | | public void transStatus(BusinessObject bo, String targetStatus) |
| | | public void transStatus(com.vci.corba.omd.data.BusinessObject bo, String targetStatus) |
| | | throws VciBaseException { |
| | | WebUtil.alertNotNull(bo,"业务数据对象",bo.lctId,"生命周期编码",bo.lcStatus,"当前生命周期状态",targetStatus,"目标生命周期状态"); |
| | | OsLifeCycleLineVO transVO = getTransVO(bo.lctId, bo.lcStatus, targetStatus); |
| | |
| | | * @throws VciBaseException 转换生命周期出错的时候抛出异常 |
| | | */ |
| | | @Override |
| | | public void transStatus(List<BusinessObject> boList, String targetStatus) |
| | | public void transStatus(List<com.vci.corba.omd.data.BusinessObject> boList, String targetStatus) |
| | | throws VciBaseException { |
| | | WebUtil.alertNotNull(boList,"业务数据对象",targetStatus,"目标对象"); |
| | | transStatus(boList.toArray(new BusinessObject[0]), targetStatus); |
| | | transStatus(boList.toArray(new com.vci.corba.omd.data.BusinessObject[0]), targetStatus); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @throws VciBaseException 转换生命周期出错的时候抛出异常 |
| | | */ |
| | | @Override |
| | | public void transStatus(BusinessObject[] bos, String targetStatus) |
| | | public void transStatus(com.vci.corba.omd.data.BusinessObject[] bos, String targetStatus) |
| | | throws VciBaseException { |
| | | WebUtil.alertNotNull(bos,"业务数据对象",targetStatus,"目标对象"); |
| | | List<OsLifeCycleLineVO> transVOList = new ArrayList<>(); |
| | | List<BusinessObject> transBOs = new ArrayList<>(); |
| | | List<com.vci.corba.omd.data.BusinessObject> transBOs = new ArrayList<>(); |
| | | for(int i = 0 ; i < bos.length ; i ++){ |
| | | BusinessObject bo = bos[i]; |
| | | com.vci.corba.omd.data.BusinessObject bo = bos[i]; |
| | | WebUtil.alertNotNull(bo,"业务数据对象",bo.lctId,"生命周期编码",bo.lcStatus,"当前生命周期状态"); |
| | | OsLifeCycleLineVO transVO = getTransVO(bo.lctId, bo.lcStatus, targetStatus); |
| | | if(transVO!=null){ |
| | |
| | | } |
| | | } |
| | | if(!CollectionUtils.isEmpty(transBOs)) { |
| | | batchTransVo(transBOs.toArray(new BusinessObject[0]), transVOList.toArray(new OsLifeCycleLineVO[0])); |
| | | batchTransVo(transBOs.toArray(new com.vci.corba.omd.data.BusinessObject[0]), transVOList.toArray(new OsLifeCycleLineVO[0])); |
| | | } |
| | | } |
| | | |
| | |
| | | * @throws VciBaseException 转换生命周期出错的时候抛出异常 |
| | | */ |
| | | @Override |
| | | public void transCboStatus(List<ClientBusinessObject> cboList, |
| | | public void transCboStatus(List<com.vci.client.bof.ClientBusinessObject> cboList, |
| | | String targetStatus) throws VciBaseException { |
| | | WebUtil.alertNotNull(cboList,"业务数据对象",targetStatus,"目标对象"); |
| | | BusinessObject[] bos = new BusinessObject[cboList.size()]; |
| | | com.vci.corba.omd.data.BusinessObject[] bos = new com.vci.corba.omd.data.BusinessObject[cboList.size()]; |
| | | for(int i = 0 ; i < cboList.size() ; i ++){ |
| | | bos[i] = cboList.get(i).getBusinessObject(); |
| | | } |
| | |
| | | * @return 显示对象 |
| | | */ |
| | | @Override |
| | | public List<OsLifeCycleVO> lifeCycleDO2VOs(Collection<LifeCyle> lifeCycles){ |
| | | public List<OsLifeCycleVO> lifeCycleDO2VOs(Collection<LifeCycle> lifeCycles){ |
| | | List<OsLifeCycleVO> lifeCycleVOS = new ArrayList<>(); |
| | | Optional.ofNullable(lifeCycles).orElseGet(()->new ArrayList<>()).stream().forEach(lifeCyle -> { |
| | | OsLifeCycleVO lifeCycleVO = lifeCycleDO2VO(lifeCyle); |
| | |
| | | * @return 显示对象 |
| | | */ |
| | | @Override |
| | | public OsLifeCycleVO lifeCycleDO2VO(LifeCyle lifeCycle){ |
| | | public OsLifeCycleVO lifeCycleDO2VO(LifeCycle lifeCycle){ |
| | | OsLifeCycleVO life = new OsLifeCycleVO(); |
| | | Map<String, OsStatusVO> statusVOMap = statusService.selectAllStatusMap(); |
| | | if(lifeCycle !=null) { |
| | | try { |
| | | life.setCreateTime(VciDateUtil.str2Date(lifeCycle.createTime,VciDateUtil.DateTimeFormat)); |
| | | life.setCreateTime(new Date(lifeCycle.createTime)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | life.setId(lifeCycle.name); |
| | | life.setLastModifier(lifeCycle.modifier); |
| | | try { |
| | | life.setLastModifyTime(VciDateUtil.str2Date(lifeCycle.modifyTime,VciDateUtil.DateTimeFormat)); |
| | | life.setLastModifyTime(new Date(lifeCycle.modifyTime)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | }else { |
| | | OsLifeCycleLineEventVO[] eventVOs = new OsLifeCycleLineEventVO[route.transitionVOEvents.length]; |
| | | for (int i = 0; i < route.transitionVOEvents.length; i++) { |
| | | TransitionVOEvent event = route.transitionVOEvents[i]; |
| | | com.vci.corba.omd.lcm.TransitionVOEvent event = route.transitionVOEvents[i]; |
| | | OsLifeCycleLineEventVO eventVO = new OsLifeCycleLineEventVO(); |
| | | eventVO.setOid(event.id); |
| | | eventVO.setEventFullName(event.name); |
| | |
| | | lifeCyle.bounds = new Bound[0]; |
| | | } |
| | | //加链接线 |
| | | List<TransitionVO> lines = new ArrayList<>(); |
| | | List<com.vci.corba.omd.lcm.TransitionVO> lines = new ArrayList<>(); |
| | | for (int i = 0; i < lifeCycleVO.getLines().size(); i++) { |
| | | OsLifeCycleLineVO lineVO = lifeCycleVO.getLines().get(i); |
| | | lines.add(lifeCycleLineVO2DO(lineVO)); |
| | |
| | | @VciUnLog |
| | | public List<OsLifeCycleVO> selectAllLifeCycle() throws VciBaseException { |
| | | try { |
| | | LifeCyle[] lifeCyles = platformClientUtil.getLifeCycleService().getLifeCyles(); |
| | | // LifeCyle[] lifeCyles = platformClientUtil.getLifeCycleService().getLifeCyles(); |
| | | LifeCycle[] lifeCyles = ServiceProvider.getOMDService().getLifeCycleService().getLifeCycles(); |
| | | return lifeCycleDO2VOs(Arrays.stream(lifeCyles).collect(Collectors.toList())); |
| | | } catch (VCIError vciError) { |
| | | if(logger.isErrorEnabled()){ |
| | |
| | | * @throws VciBaseException 跃迁出错的是会抛出异常 |
| | | */ |
| | | @Override |
| | | public void doTransVO(BusinessObject obj,OsLifeCycleLineVO lineVO) throws VciBaseException { |
| | | public void doTransVO(com.vci.corba.omd.data.BusinessObject obj,OsLifeCycleLineVO lineVO) throws VciBaseException { |
| | | if(lineVO!=null){ |
| | | try { |
| | | TransitionVO transitionVO = lifeCycleLineVO2DO(lineVO); |
| | | platformClientUtil.getBOFactoryService().transferBusinessObject(new BusinessObjectHolder(obj), transitionVO); |
| | | com.vci.corba.omd.lcm.TransitionVO transitionVO = lifeCycleLineVO2DO(lineVO); |
| | | // platformClientUtil.getBOFactoryService().transferBusinessObject(new BusinessObjectHolder(obj), transitionVO); |
| | | ServiceProvider.getBOFService().transferBusinessObject(obj, transitionVO); |
| | | } catch (VCIError e) { |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | |
| | | * @param lineVO 连接线对象 |
| | | * @return 平台的连接线对象 |
| | | */ |
| | | private TransitionVO lifeCycleLineVO2DO(OsLifeCycleLineVO lineVO){ |
| | | TransitionVO transitionVO = new TransitionVO(); |
| | | private com.vci.corba.omd.lcm.TransitionVO lifeCycleLineVO2DO(OsLifeCycleLineVO lineVO){ |
| | | com.vci.corba.omd.lcm.TransitionVO transitionVO = new com.vci.corba.omd.lcm.TransitionVO(); |
| | | transitionVO.id = lineVO.getOid(); |
| | | transitionVO.source = lineVO.getSourceLifeStatus(); |
| | | transitionVO.destination = lineVO.getTargetLifeStatus(); |
| | | transitionVO.connect = lineVO.getName() == null?"":lineVO.getName(); |
| | | //加事件 |
| | | TransitionVOEvent[] events; |
| | | com.vci.corba.omd.lcm.TransitionVOEvent[] events; |
| | | if(lineVO.getEvents() == null || lineVO.getEvents().length == 0){ |
| | | events = new TransitionVOEvent[0]; |
| | | events = new com.vci.corba.omd.lcm.TransitionVOEvent[0]; |
| | | }else{ |
| | | events = new TransitionVOEvent[lineVO.getEvents().length]; |
| | | events = new com.vci.corba.omd.lcm.TransitionVOEvent[lineVO.getEvents().length]; |
| | | for (int j = 0; j < lineVO.getEvents().length; j++) { |
| | | OsLifeCycleLineEventVO eventVO = lineVO.getEvents()[j]; |
| | | TransitionVOEvent event = new TransitionVOEvent(); |
| | | com.vci.corba.omd.lcm.TransitionVOEvent event = new com.vci.corba.omd.lcm.TransitionVOEvent(); |
| | | event.id = eventVO.getOid(); |
| | | event.name = eventVO.getEventFullName(); |
| | | events[j] = event; |
| | |
| | | * @throws VciBaseException 跃迁出错的是会抛出异常 |
| | | */ |
| | | @Override |
| | | public void batchTransVo(BusinessObject[] bos,OsLifeCycleLineVO[] vos) throws VciBaseException{ |
| | | public void batchTransVo(com.vci.corba.omd.data.BusinessObject[] bos,OsLifeCycleLineVO[] vos) throws VciBaseException{ |
| | | batchTransVo(bos,vos,null); |
| | | } |
| | | |
| | |
| | | * @throws VciBaseException 跃迁出错的是会抛出异常 |
| | | */ |
| | | @Override |
| | | public void batchTransVo(BusinessObject[] bos,OsLifeCycleLineVO[] lineVOs,String[] releaseStatus) throws VciBaseException{ |
| | | public void batchTransVo(com.vci.corba.omd.data.BusinessObject[] bos,OsLifeCycleLineVO[] lineVOs,String[] releaseStatus) throws VciBaseException{ |
| | | if(bos!=null && lineVOs != null && lineVOs.length == bos.length){ |
| | | try { |
| | | if(releaseStatus == null){ |
| | |
| | | releaseStatus[i] = ""; |
| | | } |
| | | } |
| | | TransitionVO[] vos = new TransitionVO[lineVOs.length]; |
| | | com.vci.corba.omd.lcm.TransitionVO[] vos = new com.vci.corba.omd.lcm.TransitionVO[lineVOs.length]; |
| | | for(int i = 0 ; i < lineVOs.length; i ++){ |
| | | vos[i] = lifeCycleLineVO2DO(lineVOs[i]); |
| | | } |
| | | platformClientUtil.getBOFactoryService().batchTransferBusinessObjectAndRelease( |
| | | // platformClientUtil.getBOFactoryService().batchTransferBusinessObjectAndRelease( |
| | | // bos, vos, releaseStatus); |
| | | ServiceProvider.getBOFService().batchTransferBusinessObjectAndRelease( |
| | | bos, vos, releaseStatus); |
| | | } catch (VCIError e) { |
| | | throw WebUtil.getVciBaseException(e); |