Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //1. Login to Ektron Connector through DxH
            ContextBusClient cbClient = new ContextBusClient();
            List<ConnectionParam> paramList = cbClient.LoadConnection("Ektron", "Ektron").ToList();
            cbClient.Login(paramList.ToArray(), "Ektron");

            //2. get "HtmlContent" ObjectDefinition
            FlyweightObjectDefinition flyweight = new FlyweightObjectDefinition() { Id = "HTMLContent" };
            FlyweightObjectDefinition[] flyweights = new FlyweightObjectDefinition[] { flyweight };
            ObjectDefinition contentObjectDef = cbClient.GetObjectDefinitionList(flyweights, "Ektron").FirstOrDefault();

            //3. Define criteria to retrieve content object instances from Ektron Connector
            ObjectInstanceCriteriaFilter criteria = new ObjectInstanceCriteriaFilter();
            List<CriteriaFilter> filters = new List<CriteriaFilter>();

            filters.Add( new CriteriaFilter(){
                FieldID = "FolderId",
                Operator = ObjectInstanceCriteriaFilterOperator.EqualTo,
                Value = 1
            });

            criteria.Filters = filters.ToArray();

            //4. Retrieve Object Instances and databind
            ObjectInstanceList objectInstanceReturn = cbClient.GetObjectInstanceList(contentObjectDef, criteria, "Ektron");

            lvObjects.DataSource = objectInstanceReturn.Results;
            lvObjects.DataBind();
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ContextBusClient       cbClient  = new ContextBusClient();
            List <ConnectionParam> paramList = cbClient.LoadConnection("HubSpot - Adam", "HubSpot").ToList();

            cbClient.Login(paramList.ToArray(), "HubSpot");


            FlyweightObjectDefinition flyweight = new FlyweightObjectDefinition()
            {
                Id = Request.QueryString["id"]
            };

            FlyweightObjectDefinition[] flyweights = new FlyweightObjectDefinition[] { flyweight };

            ObjectDefinition[] objDefList = cbClient.GetObjectDefinitionList(flyweights, "HubSpot");

            Dictionary <string, object> keys = new Dictionary <string, object>();

            keys.Add("vid", 2);
            ObjectInstance instance = cbClient.GetObjectInstance(objDefList.First(), keys, "HubSpot");

            //ObjectInstanceCriteriaFilter criteria = new ObjectInstanceCriteriaFilter();
            //criteria.Filters = new CriteriaFilter[0];
            //ObjectInstanceList objectInstanceReturn = cbClient.GetObjectInstanceList(objDefList.First(), criteria, "HubSpot");

            //lvObjects.DataSource = objectInstanceReturn.Results;
            lvObjects.DataSource = new ObjectInstance[] { instance };
            lvObjects.DataBind();
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ContextBusClient cbClient = new ContextBusClient();
            List<ConnectionParam> paramList = cbClient.LoadConnection("HubSpot - Adam", "HubSpot").ToList();

            cbClient.Login(paramList.ToArray(), "HubSpot");

            FlyweightObjectDefinition flyweight = new FlyweightObjectDefinition() { Id = Request.QueryString["id"] };
            FlyweightObjectDefinition[] flyweights = new FlyweightObjectDefinition[] { flyweight };

            ObjectDefinition[] objDefList = cbClient.GetObjectDefinitionList(flyweights, "HubSpot");

            lvFields.DataSource = objDefList.First().Fields;
            lvFields.DataBind();
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ContextBusClient       cbClient  = new ContextBusClient();
            List <ConnectionParam> paramList = cbClient.LoadConnection("HubSpot - Adam", "HubSpot").ToList();

            cbClient.Login(paramList.ToArray(), "HubSpot");

            FlyweightObjectDefinition flyweight = new FlyweightObjectDefinition()
            {
                Id = Request.QueryString["id"]
            };

            FlyweightObjectDefinition[] flyweights = new FlyweightObjectDefinition[] { flyweight };

            ObjectDefinition[] objDefList = cbClient.GetObjectDefinitionList(flyweights, "HubSpot");

            lvFields.DataSource = objDefList.First().Fields;
            lvFields.DataBind();
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ContextBusClient cbClient = new ContextBusClient();
            List<ConnectionParam> paramList = cbClient.LoadConnection("HubSpot - Adam", "HubSpot").ToList();

            cbClient.Login(paramList.ToArray(), "HubSpot");

            FlyweightObjectDefinition flyweight = new FlyweightObjectDefinition() { Id = Request.QueryString["id"] };
            FlyweightObjectDefinition[] flyweights = new FlyweightObjectDefinition[] { flyweight };

            ObjectDefinition[] objDefList = cbClient.GetObjectDefinitionList(flyweights, "HubSpot");

            Dictionary<string,object> keys = new Dictionary<string,object>();
            keys.Add("vid", 2);
            ObjectInstance instance = cbClient.GetObjectInstance(objDefList.First(), keys, "HubSpot");

            //ObjectInstanceCriteriaFilter criteria = new ObjectInstanceCriteriaFilter();
            //criteria.Filters = new CriteriaFilter[0];
            //ObjectInstanceList objectInstanceReturn = cbClient.GetObjectInstanceList(objDefList.First(), criteria, "HubSpot");

            //lvObjects.DataSource = objectInstanceReturn.Results;
            lvObjects.DataSource = new ObjectInstance[] { instance };
            lvObjects.DataBind();
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //1. Login to Ektron Connector through DxH
            ContextBusClient       cbClient  = new ContextBusClient();
            List <ConnectionParam> paramList = cbClient.LoadConnection("Ektron", "Ektron").ToList();

            cbClient.Login(paramList.ToArray(), "Ektron");

            //2. get "HtmlContent" ObjectDefinition
            FlyweightObjectDefinition flyweight = new FlyweightObjectDefinition()
            {
                Id = "HTMLContent"
            };

            FlyweightObjectDefinition[] flyweights       = new FlyweightObjectDefinition[] { flyweight };
            ObjectDefinition            contentObjectDef = cbClient.GetObjectDefinitionList(flyweights, "Ektron").FirstOrDefault();

            //3. Define criteria to retrieve content object instances from Ektron Connector
            ObjectInstanceCriteriaFilter criteria = new ObjectInstanceCriteriaFilter();
            List <CriteriaFilter>        filters  = new List <CriteriaFilter>();

            filters.Add(new CriteriaFilter()
            {
                FieldID  = "FolderId",
                Operator = ObjectInstanceCriteriaFilterOperator.EqualTo,
                Value    = 1
            });

            criteria.Filters = filters.ToArray();

            //4. Retrieve Object Instances and databind
            ObjectInstanceList objectInstanceReturn = cbClient.GetObjectInstanceList(contentObjectDef, criteria, "Ektron");

            lvObjects.DataSource = objectInstanceReturn.Results;
            lvObjects.DataBind();
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ContextBusClient cbClient = new ContextBusClient();

            //Get Employee definition from adventure works:
            ConnectionParam[] parameters = cbClient.LoadConnection("advworks", AdvWorksConnectorId);
            cbClient.Login(parameters, AdvWorksConnectorId);
            FlyweightObjectDefinition flyweight = new FlyweightObjectDefinition() { Id = "HumanResources.Employee" };
            ObjectDefinition employeeObjDef = cbClient.GetObjectDefinitionList(new FlyweightObjectDefinition[] { flyweight }, AdvWorksConnectorId).First();

            //Get Team definition from Sharepoint
            parameters = cbClient.LoadConnection("Sharepoint-Team", "SharePoint");
            cbClient.Login(parameters, "SharePoint");
            flyweight = new FlyweightObjectDefinition() { Id = "SP|List|/sites/SiteCollection1|Team" };
            ObjectDefinition sharepointObjDef = cbClient.GetObjectDefinitionList(new FlyweightObjectDefinition[] { flyweight }, "SharePoint").First();

            //build the workflow.
            TaskManagerClient taskClient = new TaskManagerClient();

            //1. Create login task
            LoginTask login = taskClient.CreateLoginTask(AdvWorksConnectorId, "advworks");

            //2. Create Mapping Task
            MappingTask map = taskClient.CreateMappingTask(sharepointObjDef, employeeObjDef);

            MappableField field = map.TargetFields.SingleOrDefault(f => f.Id == "p.BusinessEntityID");
            field.Mapping.MappingType = MappingType.ConstMapping;
            field.Mapping.Value = 1;

            field = map.TargetFields.SingleOrDefault(f => f.Id == "p.EmailPromotion");
            field.Mapping.MappingType = MappingType.ConstMapping;
            field.Mapping.Value = 0;

            field = map.TargetFields.SingleOrDefault(f => f.Id == "p.Demographics");
            field.Mapping.MappingType = MappingType.ConstMapping;
            field.Mapping.Value = "";

            field = map.TargetFields.SingleOrDefault(f => f.Id == "p.NameStyle");
            field.Mapping.MappingType = MappingType.ConstMapping;
            field.Mapping.Value = false;

            field = map.TargetFields.SingleOrDefault(f => f.Id == "p.PersonType");
            field.Mapping.MappingType = MappingType.ConstMapping;
            field.Mapping.Value = "EM";

            field = map.TargetFields.SingleOrDefault(f => f.Id == "p.FirstName");
            field.Mapping.MappingType = MappingType.FieldMapping;
            field.Mapping.Value = "First_x0020_Name";

            field = map.TargetFields.SingleOrDefault(f => f.Id == "p.LastName");
            field.Mapping.MappingType = MappingType.FieldMapping;
            field.Mapping.Value = "Last_x0020_Name";

            field = map.TargetFields.SingleOrDefault(f => f.Id == "e.JobTitle");
            field.Mapping.MappingType = MappingType.FieldMapping;
            field.Mapping.Value = "Title";

            //3. Save Task
            SaveObjectInstanceTask saveSharepointToEktron = taskClient.CreateSaveObjectTask(AdvWorksConnectorId);

            //4. Logout Task
            LogoutTask logout = taskClient.CreateLogoutTask(AdvWorksConnectorId);

            //5. Assemble and save workflow
            string workflowName = string.Concat("My Test Workflow");
            Workflow workflow = taskClient.CreateWorkflow(workflowName);
            List<ContextBusTask> tasks = new List<ContextBusTask>();
            tasks.Add(login);
            tasks.Add(map);
            tasks.Add(saveSharepointToEktron);
            tasks.Add(logout);
            workflow.Tasks = tasks.ToArray();
            taskClient.SaveWorkflow(workflow);

            //3. Create associated Event Definitions for workflow.
            EventManagerClient eventClient = new EventManagerClient();
            EventDefinition eventDef = new EventDefinition()
            {
                Id = workflowName,
                Payload = map.SourceObject
            };
            eventClient.AssociateWorkflowsToEvent(new string[] { workflow.WorkflowName }, eventDef);

            //
            //Now raise the event to perform the workflow!
            //

            //first get sharpeoint item
            ObjectInstanceCriteriaFilter criteria = new ObjectInstanceCriteriaFilter();
            criteria.Filters = new CriteriaFilter[0];
            ObjectInstanceList sharepointObjInstance = cbClient.GetObjectInstanceList(sharepointObjDef, criteria, "SharePoint");

            //create event instance with sharepoint item
            EventInstance itemEvent = new EventInstance()
            {
                Id = workflowName,
                Payload = sharepointObjInstance.Results.First()
            };

            //raise the event.
            eventClient.RaiseEvent(itemEvent);
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ContextBusClient cbClient = new ContextBusClient();

            //Get Employee definition from adventure works:
            ConnectionParam[] parameters = cbClient.LoadConnection("advworks", AdvWorksConnectorId);
            cbClient.Login(parameters, AdvWorksConnectorId);
            FlyweightObjectDefinition flyweight = new FlyweightObjectDefinition()
            {
                Id = "HumanResources.Employee"
            };
            ObjectDefinition employeeObjDef = cbClient.GetObjectDefinitionList(new FlyweightObjectDefinition[] { flyweight }, AdvWorksConnectorId).First();

            //Get Team definition from Sharepoint
            parameters = cbClient.LoadConnection("Sharepoint-Team", "SharePoint");
            cbClient.Login(parameters, "SharePoint");
            flyweight = new FlyweightObjectDefinition()
            {
                Id = "SP|List|/sites/SiteCollection1|Team"
            };
            ObjectDefinition sharepointObjDef = cbClient.GetObjectDefinitionList(new FlyweightObjectDefinition[] { flyweight }, "SharePoint").First();


            //build the workflow.
            TaskManagerClient taskClient = new TaskManagerClient();

            //1. Create login task
            LoginTask login = taskClient.CreateLoginTask(AdvWorksConnectorId, "advworks");

            //2. Create Mapping Task
            MappingTask map = taskClient.CreateMappingTask(sharepointObjDef, employeeObjDef);

            MappableField field = map.TargetFields.SingleOrDefault(f => f.Id == "p.BusinessEntityID");

            field.Mapping.MappingType = MappingType.ConstMapping;
            field.Mapping.Value       = 1;

            field = map.TargetFields.SingleOrDefault(f => f.Id == "p.EmailPromotion");
            field.Mapping.MappingType = MappingType.ConstMapping;
            field.Mapping.Value       = 0;

            field = map.TargetFields.SingleOrDefault(f => f.Id == "p.Demographics");
            field.Mapping.MappingType = MappingType.ConstMapping;
            field.Mapping.Value       = "";

            field = map.TargetFields.SingleOrDefault(f => f.Id == "p.NameStyle");
            field.Mapping.MappingType = MappingType.ConstMapping;
            field.Mapping.Value       = false;

            field = map.TargetFields.SingleOrDefault(f => f.Id == "p.PersonType");
            field.Mapping.MappingType = MappingType.ConstMapping;
            field.Mapping.Value       = "EM";

            field = map.TargetFields.SingleOrDefault(f => f.Id == "p.FirstName");
            field.Mapping.MappingType = MappingType.FieldMapping;
            field.Mapping.Value       = "First_x0020_Name";

            field = map.TargetFields.SingleOrDefault(f => f.Id == "p.LastName");
            field.Mapping.MappingType = MappingType.FieldMapping;
            field.Mapping.Value       = "Last_x0020_Name";

            field = map.TargetFields.SingleOrDefault(f => f.Id == "e.JobTitle");
            field.Mapping.MappingType = MappingType.FieldMapping;
            field.Mapping.Value       = "Title";

            //3. Save Task
            SaveObjectInstanceTask saveSharepointToEktron = taskClient.CreateSaveObjectTask(AdvWorksConnectorId);

            //4. Logout Task
            LogoutTask logout = taskClient.CreateLogoutTask(AdvWorksConnectorId);

            //5. Assemble and save workflow
            string   workflowName       = string.Concat("My Test Workflow");
            Workflow workflow           = taskClient.CreateWorkflow(workflowName);
            List <ContextBusTask> tasks = new List <ContextBusTask>();

            tasks.Add(login);
            tasks.Add(map);
            tasks.Add(saveSharepointToEktron);
            tasks.Add(logout);
            workflow.Tasks = tasks.ToArray();
            taskClient.SaveWorkflow(workflow);

            //3. Create associated Event Definitions for workflow.
            EventManagerClient eventClient = new EventManagerClient();
            EventDefinition    eventDef    = new EventDefinition()
            {
                Id      = workflowName,
                Payload = map.SourceObject
            };

            eventClient.AssociateWorkflowsToEvent(new string[] { workflow.WorkflowName }, eventDef);



            //
            //Now raise the event to perform the workflow!
            //

            //first get sharpeoint item
            ObjectInstanceCriteriaFilter criteria = new ObjectInstanceCriteriaFilter();

            criteria.Filters = new CriteriaFilter[0];
            ObjectInstanceList sharepointObjInstance = cbClient.GetObjectInstanceList(sharepointObjDef, criteria, "SharePoint");

            //create event instance with sharepoint item
            EventInstance itemEvent = new EventInstance()
            {
                Id      = workflowName,
                Payload = sharepointObjInstance.Results.First()
            };

            //raise the event.
            eventClient.RaiseEvent(itemEvent);
        }
Exemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ContextBusClient cbClient = new ContextBusClient();
            ConnectionParam[] parameters = cbClient.LoadConnection("Advworks", AdvWorksConnectorId);

            cbClient.Login(parameters, AdvWorksConnectorId);

            FlyweightObjectDefinition[] flyweights = cbClient.GetObjectDefinitionNameList(AdvWorksConnectorId);
            lvObjects.DataSource = flyweights;
            lvObjects.DataBind();

            List<ObjectDefinition> objDefList = cbClient.GetObjectDefinitionList(flyweights, AdvWorksConnectorId).ToList();

            ObjectInstanceCriteriaFilter criteria = new ObjectInstanceCriteriaFilter();
            ObjectInstanceList objectInstanceReturn = cbClient.GetObjectInstanceList(objDefList.First(), criteria, AdvWorksConnectorId);

            lvObjectInstances.DataSource = objectInstanceReturn.Results;
            lvObjectInstances.DataBind();

            //Lets map a sharepoint object to AdventureWorks

            //Get Sharepoint ObjectDefinition
            FlyweightObjectDefinition flyweight = new FlyweightObjectDefinition() { Id = "SP|List|/sites/SiteCollection1|Team"};
            ObjectDefinition sharepointObjDef= cbClient.GetObjectDefinitionList(new FlyweightObjectDefinition[] { flyweight }, "SharePoint").First();

            //Get Employee definition from adventure works:
            ObjectDefinition employeeObjDef = objDefList.Find(d => d.DisplayName == "Employee");

            //build the workflow.
            TaskManagerClient taskClient = new TaskManagerClient();

            //1. Create login task
            LoginTask login = taskClient.CreateLoginTask(AdvWorksConnectorId, "");

            //2. Create Mapping Task
            MappingTask map = taskClient.CreateMappingTask(sharepointObjDef, employeeObjDef);

            MappableField field = map.TargetFields.SingleOrDefault(f => f.Id == "BusinessEntityID");
            field.Mapping.MappingType = MappingType.ConstMapping;
            field.Mapping.Value = 1;

            field = map.TargetFields.SingleOrDefault(f => f.Id == "PersonType");
            field.Mapping.MappingType = MappingType.ConstMapping;
            field.Mapping.Value = "EM";

            field = map.TargetFields.SingleOrDefault(f => f.Id == "FirstName");
            field.Mapping.MappingType = MappingType.FieldMapping;
            field.Mapping.Value = map.SourceObject.Fields.SingleOrDefault(f => f.Id == "First_x0020_Name");

            field = map.TargetFields.SingleOrDefault(f => f.Id == "LastName");
            field.Mapping.MappingType = MappingType.FieldMapping;
            field.Mapping.Value = map.SourceObject.Fields.SingleOrDefault(f => f.Id == "last_x0020_name");

            field = map.TargetFields.SingleOrDefault(f => f.Id == "JobTitle");
            field.Mapping.MappingType = MappingType.FieldMapping;
            field.Mapping.Value = map.SourceObject.Fields.SingleOrDefault(f => f.Id == "Title");

            //3. Save Task
            SaveObjectInstanceTask saveSharepointToEktron = taskClient.CreateSaveObjectTask(AdvWorksConnectorId);

            //4. Logout Task
            LogoutTask logout = taskClient.CreateLogoutTask(AdvWorksConnectorId);
        }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ContextBusClient cbClient = new ContextBusClient();

            ConnectionParam[] parameters = cbClient.LoadConnection("Advworks", AdvWorksConnectorId);

            cbClient.Login(parameters, AdvWorksConnectorId);

            FlyweightObjectDefinition[] flyweights = cbClient.GetObjectDefinitionNameList(AdvWorksConnectorId);
            lvObjects.DataSource = flyweights;
            lvObjects.DataBind();

            List <ObjectDefinition> objDefList = cbClient.GetObjectDefinitionList(flyweights, AdvWorksConnectorId).ToList();

            ObjectInstanceCriteriaFilter criteria             = new ObjectInstanceCriteriaFilter();
            ObjectInstanceList           objectInstanceReturn = cbClient.GetObjectInstanceList(objDefList.First(), criteria, AdvWorksConnectorId);

            lvObjectInstances.DataSource = objectInstanceReturn.Results;
            lvObjectInstances.DataBind();

            //Lets map a sharepoint object to AdventureWorks

            //Get Sharepoint ObjectDefinition
            FlyweightObjectDefinition flyweight = new FlyweightObjectDefinition()
            {
                Id = "SP|List|/sites/SiteCollection1|Team"
            };
            ObjectDefinition sharepointObjDef = cbClient.GetObjectDefinitionList(new FlyweightObjectDefinition[] { flyweight }, "SharePoint").First();

            //Get Employee definition from adventure works:
            ObjectDefinition employeeObjDef = objDefList.Find(d => d.DisplayName == "Employee");

            //build the workflow.
            TaskManagerClient taskClient = new TaskManagerClient();

            //1. Create login task
            LoginTask login = taskClient.CreateLoginTask(AdvWorksConnectorId, "");

            //2. Create Mapping Task
            MappingTask map = taskClient.CreateMappingTask(sharepointObjDef, employeeObjDef);

            MappableField field = map.TargetFields.SingleOrDefault(f => f.Id == "BusinessEntityID");

            field.Mapping.MappingType = MappingType.ConstMapping;
            field.Mapping.Value       = 1;

            field = map.TargetFields.SingleOrDefault(f => f.Id == "PersonType");
            field.Mapping.MappingType = MappingType.ConstMapping;
            field.Mapping.Value       = "EM";

            field = map.TargetFields.SingleOrDefault(f => f.Id == "FirstName");
            field.Mapping.MappingType = MappingType.FieldMapping;
            field.Mapping.Value       = map.SourceObject.Fields.SingleOrDefault(f => f.Id == "First_x0020_Name");

            field = map.TargetFields.SingleOrDefault(f => f.Id == "LastName");
            field.Mapping.MappingType = MappingType.FieldMapping;
            field.Mapping.Value       = map.SourceObject.Fields.SingleOrDefault(f => f.Id == "last_x0020_name");

            field = map.TargetFields.SingleOrDefault(f => f.Id == "JobTitle");
            field.Mapping.MappingType = MappingType.FieldMapping;
            field.Mapping.Value       = map.SourceObject.Fields.SingleOrDefault(f => f.Id == "Title");

            //3. Save Task
            SaveObjectInstanceTask saveSharepointToEktron = taskClient.CreateSaveObjectTask(AdvWorksConnectorId);

            //4. Logout Task
            LogoutTask logout = taskClient.CreateLogoutTask(AdvWorksConnectorId);
        }