snaker-core/src/main/java/org/snaker/engine/core/ProcessService.java
public String deploy(InputStream input, String creator) {
		AssertHelper.notNull(input);
		try {
			byte[] bytes = StreamHelper.readBytes(input);
			ProcessModel model = ModelParser.parse(bytes);
			Integer version = access().getLatestProcessVersion(model.getName());
			Process entity = new Process();
			entity.setId(StringHelper.getPrimaryKey());
			if(version == null || version < 0) {
				entity.setVersion(0);
			} else {
				entity.setVersion(version + 1);
			}
			entity.setState(STATE_ACTIVE);
			entity.setModel(model);
			entity.setBytes(bytes);
			entity.setCreateTime(DateHelper.getTime());
			entity.setCreator(creator);
			saveProcess(entity);
			cache(entity);
			return entity.getId();
		} catch(Exception e) {
			e.printStackTrace();
			log.error(e.getMessage());
			throw new SnakerException(e.getMessage(), e.getCause());
		}
	}
public String deploy(InputStream input, String creator) {
		AssertHelper.notNull(input);
		try {
			byte[] bytes = StreamHelper.readBytes(input);
			ProcessModel model = ModelParser.parse(bytes);
			Integer version = access().getLatestProcessVersion(model.getName());
			Process entity = new Process();
			entity.setId(StringHelper.getPrimaryKey());
			if(version == null || version < 0) {
				entity.setVersion(0);
			} else {
				entity.setVersion(version + 1);
			}
			entity.setState(STATE_ACTIVE);
			entity.setModel(model);
			entity.setBytes(bytes);
			entity.setCreateTime(DateHelper.getTime());
			entity.setCreator(creator);
			saveProcess(entity);
			cache(entity);
			return entity.getId();
		} catch(Exception e) {
			e.printStackTrace();
			log.error(e.getMessage());
			throw new SnakerException(e.getMessage(), e.getCause());
		}
	}
public String deploy ( InputStream input , String creator ) { AssertHelper . notNull ( input ) ; try { byte [ ] bytes = StreamHelper . readBytes ( input ) ; ProcessModel model = ModelParser . parse ( bytes ) ; Integer version = access ( ) . getLatestProcessVersion ( model . getName ( ) ) ; Process entity = new Process ( ) ; entity . setId ( StringHelper . getPrimaryKey ( ) ) ; if ( version == null || version < 0 ) { entity . setVersion ( 0 ) ; } else { entity . setVersion ( version + 1 ) ; } entity . setState ( STATE_ACTIVE ) ; entity . setModel ( model ) ; entity . setBytes ( bytes ) ; entity . setCreateTime ( DateHelper . getTime ( ) ) ; entity . setCreator ( creator ) ; saveProcess ( entity ) ; cache ( entity ) ; return entity . getId ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; log . error ( e . getMessage ( ) ) ; throw new SnakerException ( e . getMessage ( ) , e . getCause ( ) ) ; } }
根据流程定义xml的输入流解析为字节数组，保存至数据库中，并且put到缓存中
@param input 定义输入流
@param creator 创建人
根据流程定义xml的输入流解析为字节数组，保存至数据库中，并且put到缓存中