Ejemplo n.º 1
0
        public static CasePlanInstanceAggregate New(string id, StageElementInstance stage, ICollection <CaseFileItemInstance> caseFiles)
        {
            var result = new CasePlanInstanceAggregate();
            var evt    = new CasePlanInstanceCreatedEvent(Guid.NewGuid().ToString(), id, 0, null, new List <CasePlanInstanceRole>(), new List <CasePlanInstanceRole>(), stage.ToJson(), DateTime.UtcNow, null, string.Empty, new Dictionary <string, string>(), caseFiles);

            result.Handle(evt);
            result.DomainEvents.Add(evt);
            return(result);
        }
Ejemplo n.º 2
0
        public static CasePlanInstanceAggregate New(ICollection <DomainEvent> evts)
        {
            var result = new CasePlanInstanceAggregate();

            foreach (var evt in evts)
            {
                result.Handle(evt);
            }

            return(result);
        }
Ejemplo n.º 3
0
        public static CasePlanInstanceAggregate New(string id, CasePlanAggregate caseplan, ICollection <CasePlanInstanceRole> permissions, Dictionary <string, string> parameters)
        {
            var result = new CasePlanInstanceAggregate();
            var roles  = caseplan.Roles.Select(_ => new CasePlanInstanceRole
            {
                Id   = _.Id,
                Name = _.Name
            }).ToList();
            var files = caseplan.Files.Select(_ => new CaseFileItemInstance
            {
                DefinitionType = _.DefinitionType,
                EltId          = _.Id,
                Id             = CaseFileItemInstance.BuildId(id, _.Id),
                Name           = _.Name
            }).ToList();
            var stage = CMMNParser.ExtractStage(caseplan.XmlContent, id);
            var json  = stage.ToJson();
            var evt   = new CasePlanInstanceCreatedEvent(Guid.NewGuid().ToString(), id, 0, caseplan.CaseOwner, roles, permissions, json, DateTime.UtcNow, caseplan.AggregateId, caseplan.Name, parameters, files);

            result.Handle(evt);
            result.DomainEvents.Add(evt);
            return(result);
        }