protected void Process(
            [NotNull] Item integrationItem,
            [NotNull] ObjectModel.Entities.Items.BaseItem sourceSharepointItem,
            [NotNull] SynchContext synchContext)
        {
            Assert.ArgumentNotNull(integrationItem, "integrationItem");
            Assert.ArgumentNotNull(sourceSharepointItem, "sourceSharepointItem");
            Assert.ArgumentNotNull(synchContext, "synchContext");

            var sourceSharepointDocumentItem = sourceSharepointItem as DocumentItem;

            if (sourceSharepointDocumentItem == null)
            {
                return;
            }

            var sharepointDataModifiedField = integrationItem.Fields[FieldNames.SharepointDataModified];

            if (sharepointDataModifiedField != null &&
                DateUtil.ToServerTime(new DateField(sharepointDataModifiedField).DateTime) == DateUtil.ToServerTime(System.Convert.ToDateTime(sourceSharepointDocumentItem["ows_Modified"]).ToUniversalTime()))
            {
                return;
            }

            IntegrationItemProvider.UpdateBlob(integrationItem, sourceSharepointDocumentItem, synchContext);
        }
Example #2
0
        public virtual void Process([NotNull] ProcessIntegrationItemArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            Assert.IsNotNull(args.IntegrationItem, "args.IntegrationItem");
            Assert.IsNotNull(args.SourceSharepointItem, "args.SourceSharepointItem");
            Assert.IsNotNull(args.SynchContext, "args.SynchContext");

            IntegrationItemProvider.UpdateFields(args.IntegrationItem, args.SourceSharepointItem, args.SynchContext);
        }
Example #3
0
        public virtual void Process([NotNull] ProcessIntegrationItemArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            Assert.IsNotNull(args.IntegrationItemID, "args.IntegrationItemID");
            Assert.IsNotNull(args.IntegrationItemTemplateID, "args.IntegrationItemTemplateID");
            Assert.IsNotNull(args.SourceSharepointItem, "args.SourceSharepointItem");
            Assert.IsNotNull(args.SynchContext, "args.SynchContext");

            args.IntegrationItem = IntegrationItemProvider.CreateItem(
                args.IntegrationItemID,
                args.IntegrationItemTemplateID,
                args.SourceSharepointItem,
                args.SynchContext);
        }
        public void UpdateFields_should_update_guid_field()
        {
            // Arrange
            this.sourceSharepointItem.GUID.Returns("SomeGuid");
            Item targetIntegrationItem = new ItemMock().AsConfigurationItem();

            // Act
            IntegrationItemProvider.UpdateFields(
                targetIntegrationItem,
                this.sourceSharepointItem,
                new SynchContext(targetIntegrationItem));

            // Assert
            targetIntegrationItem.Fields[FieldNames.GUID].Value.Should().Be("SomeGuid");
        }
        public void UpdateFields_should_set_IsIntegration_if_guid_is_empty()
        {
            // Arrange
            Item targetIntegrationItem = new ItemMock().AsConfigurationItem();

            using (new EditContext(targetIntegrationItem))
            {
                new CheckboxField(targetIntegrationItem.Fields[FieldIDs.IsIntegrationItem]).Checked = false;
            }

            // Act
            IntegrationItemProvider.UpdateFields(
                targetIntegrationItem,
                this.sourceSharepointItem,
                new SynchContext(targetIntegrationItem));

            // Assert
            new CheckboxField(targetIntegrationItem.Fields[FieldIDs.IsIntegrationItem]).Checked.Should().BeTrue();
        }