Example #1
0
        private JObject GetActivity(string rootCode, PivotData initData)
        {
            var rootModel = this.storageProvider.GetRootModel(rootCode);

            if (string.IsNullOrEmpty(rootModel?.JsonStructure))
            {
                throw new Exception($"No root model with name {rootModel}");
            }

            var tree   = ObjectHelper.GetInnerObject(JObject.Parse(rootModel.JsonStructure));
            var bpNode = tree[ParserHelper.GetPivotName(PivotType.BusinessProcess)];

            if (bpNode == null)
            {
                throw new Exception("No BP in your model");
            }

            var ac = bpNode[initData.GetJTokenName()];

            if (!(ac is JObject))
            {
                throw new Exception($"No ac with objectCode {initData.MainValue}");
            }

            var res = new JObject {
                [initData.MainValue] = ac
            };

            return(res);
        }