protected internal virtual ISet <string> retrieveProcessKeysFromResources(IDictionary <string, ResourceEntity> resources) { ISet <string> keys = new HashSet <string>(); foreach (ResourceEntity resource in resources.Values) { if (isBpmnResource(resource)) { MemoryStream byteStream = new MemoryStream(resource.Bytes); BpmnModelInstance model = Bpmn.readModelFromStream(byteStream); foreach (Process process in model.Definitions.getChildElementsByType(typeof(Process))) { keys.Add(process.Id); } } else if (isCmmnResource(resource)) { MemoryStream byteStream = new MemoryStream(resource.Bytes); CmmnModelInstance model = Cmmn.readModelFromStream(byteStream); foreach (Case cmmnCase in model.Definitions.Cases) { keys.Add(cmmnCase.Id); } } } return(keys); }
public virtual IList <CaseDefinitionEntity> transform() { // get name of resource string resourceName = resource_Renamed.Name; // create an input stream sbyte[] bytes = resource_Renamed.Bytes; MemoryStream inputStream = new MemoryStream(bytes); try { // read input stream model = Cmmn.readModelFromStream(inputStream); } catch (CmmnModelException e) { throw LOG.transformResourceException(resourceName, e); } // TODO: use model API to validate (ie. // semantic and execution validation) model context.Model = model; context.Deployment = deployment_Renamed; context.ExpressionManager = expressionManager; try { transformRootElement(); } catch (Exception e) { // ALL unexpected exceptions should bubble up since they are not handled // accordingly by underlying parse-methods and the process can't be deployed throw LOG.parseProcessException(resourceName, e); } return(caseDefinitions); }
protected internal override CmmnModelInstance readModelFromStream(Stream cmmnResourceInputStream) { return(Cmmn.readModelFromStream(cmmnResourceInputStream)); }