Ejemplo n.º 1
0
        protected static void ProcessProfileKeys(ContentProfile profile, ProfileItem profileItem)
        {
            Assert.ArgumentNotNull(profile, "profile");
            Assert.ArgumentNotNull(profileItem, "profileItem");
            Assert.IsFalse(profile.ProfileID == ID.Null, "profile ID");

            foreach (ProfileKeyItem profileKeyItem in profileItem.Keys.ToList())
            {
                ProfileKeyItem keyItem = profileKeyItem;
                // NM: Check to see if there are any keys
                if (profile.Keys.Length == 0)
                {
                    continue;
                }

                if (profile.Keys.FirstOrDefault(k => string.Compare(k.Key, keyItem.Name, StringComparison.OrdinalIgnoreCase) == 0) == null)
                {
                    ContentProfileKeyData key = new ContentProfileKeyData(keyItem)
                    {
                        Value = keyItem.GetDefaultValue()
                    };
                    profile.AddKey(key);
                }
            }
            foreach (ContentProfileKeyData key in profile.Keys.Where(key => key.ProfileDefinitionId == Guid.Empty))
            {
                profile.RemoveKey(key);
            }
            UpdateKeyValues(profile);
        }
Ejemplo n.º 2
0
 public override void Pack(BinaryWriter writer)
 {
     Qualities.Pack(writer);
     PlayerModule.Pack(writer);
     ContentProfile.Pack(writer);
     InventoryPlacement.Pack(writer);
 }
Ejemplo n.º 3
0
        static ContentProfile ReadItems(BinaryReader reader)
        {
            var item = new ContentProfile();

            item.Unpack(reader);
            return(item);
        }
        public async Task <IActionResult> Edit(int id, [Bind("ContentProfileId,ContentName,ContentMedium,VisitsPerMonth,IsVerified,PublisherProfileId")] ContentProfile contentProfile)
        {
            if (id != contentProfile.ContentProfileId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(contentProfile);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ContentProfileExists(contentProfile.ContentProfileId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PublisherProfileId"] = new SelectList(_context.PublisherProfiles, "ProfileId", "Discriminator", contentProfile.PublisherProfileId);
            return(View(contentProfile));
        }
Ejemplo n.º 5
0
 protected void NormalizeProfiles(AnalyticsItems analytics)
 {
     Assert.ArgumentNotNull(analytics, "analytics");
     foreach (ProfileItem profileItem1 in analytics.Profiles)
     {
         ProfileItem    profileItem = profileItem1;
         ContentProfile profile     = null;
         // NM: Replaced the list first or default with a dictionary contains key
         string profileKey = profileItem.Name;
         if (profilesDictionary.ContainsKey(profileKey))
         {
             profile = profilesDictionary[profileKey];
         }
         if (profile == null)
         {
             profile = new ContentProfile(profileItem)
             {
                 IsSavedInField = false
             };
             profiles.Add(profile);
             profilesDictionary.Add(profileKey, profile);
         }
         ProcessProfileKeys(profile, profileItem);
     }
 }
Ejemplo n.º 6
0
        protected void InitializeProfiles()
        {
            profiles = new List <ContentProfile>();
            AnalyticsItems analytics = InnerField.Database.Analytics(InnerField.Language);

            if (!string.IsNullOrEmpty(Value))
            {
                foreach (XElement node in Root.Elements("profile"))
                {
                    // NM: Don't know the usage ouside of the tracking field, but internally, it only ever uses first or default. Dictionary should be quicker

                    ContentProfile contentProfile = ContentProfile.Parse(node, InnerField.Item, analytics);
                    if (contentProfile != null)
                    {
                        contentProfile.IsSavedInField = true;
                        profiles.Add(contentProfile);
                        string profileKey = contentProfile.Name.ToLowerInvariant();
                        if (!profilesDictionary.ContainsKey(profileKey))
                        {
                            profilesDictionary.Add(profileKey, contentProfile);
                        }
                    }
                }
            }
            NormalizeProfiles(analytics);
        }
        public async Task <IActionResult> Create([Bind("PublisherProfileId,ContentName,ContentMedium,VisitsPerMonth,SelectedTags")] CreateContentProfileViewModel createContentProfileViewModel)
        {
            if (ModelState.IsValid)
            {
                ContentProfile contentProfile = new ContentProfile
                {
                    PublisherProfileId = createContentProfileViewModel.PublisherProfileId,
                    ContentName        = createContentProfileViewModel.ContentName,
                    ContentMedium      = createContentProfileViewModel.ContentMedium,
                    VisitsPerMonth     = createContentProfileViewModel.VisitsPerMonth,
                    IsVerified         = false
                };
                _context.Add(contentProfile);
                await _context.SaveChangesAsync();

                var selectedTags       = _context.Tags.Where(t => createContentProfileViewModel.SelectedTags.Contains(t.TagId.ToString())).ToList();
                var contentProfileTags = selectedTags.Select(st => new ContentProfileTag {
                    ContentProfile = contentProfile as ContentProfile, Tag = st
                }).ToList();
                _context.AddRange(contentProfileTags.ToArray());
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index), "ContentProfiles"));
            }
            return(View(createContentProfileViewModel));
        }
Ejemplo n.º 8
0
        public static ContentProfile read(BinaryReader binaryReader)
        {
            ContentProfile newObj = new ContentProfile();

            newObj.m_iid = binaryReader.ReadUInt32();
            newObj.m_uContainerProperties = binaryReader.ReadUInt32();
            return(newObj);
        }
Ejemplo n.º 9
0
 public override void Unpack(BinaryReader reader)
 {
     base.Unpack(reader);
     Qualities.Unpack(reader);
     PlayerModule.Unpack(reader);
     ContentProfile.Unpack(reader);
     InventoryPlacement.Unpack(reader);
 }
Ejemplo n.º 10
0
        public FileInfo GetWithContent(ObjectIdentity objectIdentity, String geoLoc, ContentTransferMode transferMode, String objectID)
        {
            try
            {
                // Console.WriteLine("GetWithContent");
                //ObjectId objectId = new ObjectId(objectID);
                //ObjectIdentity objectIdent = new ObjectIdentity(objectId, objectIdentity.RepositoryName);
                //ObjectIdentitySet objectIdentitySet = new ObjectIdentitySet(objectIdent);
                //DataPackage dataPackageas = objectService.Get(objectIdentitySet, null);


                ContentTransferProfile transferProfile = new ContentTransferProfile();
                transferProfile.Geolocation  = geoLoc;
                transferProfile.TransferMode = transferMode;
                DemoServiceContext.SetProfile(transferProfile);

                ContentProfile contentProfile = new ContentProfile();
                contentProfile.FormatFilter    = FormatFilter.ANY;
                contentProfile.UrlReturnPolicy = UrlReturnPolicy.PREFER;

                OperationOptions operationOptions = new OperationOptions();
                operationOptions.ContentProfile = contentProfile;
                operationOptions.SetProfile(contentProfile);

                ObjectIdentitySet     objectIdSet = new ObjectIdentitySet(objectIdentity);
                List <ObjectIdentity> objIdList   = objectIdSet.Identities;
                objIdList.Add(objectIdentity);

                DataPackage dataPackage = objectService.Get(objectIdSet, operationOptions);
                DataObject  dataObject  = dataPackage.DataObjects[0];

                Content resultContent    = dataObject.Contents[0];
                String  contentClassName = resultContent.GetType().FullName;
                //Console.WriteLine("Returned content as type " + contentClassName);
                if (contentClassName.Equals("Emc.Documentum.FS.DataModel.Core.Content.UrlContent"))
                {
                    UrlContent urlContent = (UrlContent)resultContent;
                    // Console.WriteLine("Content ACS URL is: " + (urlContent.Url));
                }
                if (resultContent.CanGetAsFile())
                {
                    FileInfo fileInfo = resultContent.GetAsFile();
                    return(fileInfo);
                    //Console.WriteLine("Got content as file " + fileInfo.FullName);
                }
                else if (contentClassName.Equals("Emc.Documentum.FS.DataModel.Core.Content.UcfContent"))
                {
                    UcfContent ucfContent = (UcfContent)resultContent;
                    // Console.WriteLine("Got content as file " + ucfContent.LocalFilePath);
                }
                return(null);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                throw ex;
            }
        }
Ejemplo n.º 11
0
            public override void Calculate()
            {
                if (Profile.Presets == null || Profile.Presets.Count == 0)
                {
                    return;
                }
                int num = 0;
                Dictionary <string, float> dictionary1 = new Dictionary <string, float>();

                foreach (string presetKey in Profile.Presets.Keys)
                {
                    if (string.IsNullOrEmpty(presetKey))
                    {
                        return;
                    }
                    ContentProfile presetProfileData = GetPresetProfileData(Profile, presetKey);
                    if (presetProfileData == null)
                    {
                        return;
                    }
                    ++num;
                    foreach (ContentProfileKeyData contentProfileKeyData in presetProfileData.Keys)
                    {
                        string key = contentProfileKeyData.Key.ToLowerInvariant();
                        if (!dictionary1.ContainsKey(key))
                        {
                            dictionary1.Add(key, 0.0f);
                        }
                        Dictionary <string, float> dictionary2;
                        string index;
                        (dictionary2 = dictionary1)[index = key] = dictionary2[index] + contentProfileKeyData.Value;
                    }
                }
                if (num <= 0)
                {
                    return;
                }
                List <string> list = new List <string>(dictionary1.Keys);

                foreach (string str in list)
                {
                    Dictionary <string, float> dictionary2;
                    string index;
                    (dictionary2 = dictionary1)[index = str] = dictionary2[index] / num;
                }
                foreach (string str in list)
                {
                    string keyId = str;
                    ContentProfileKeyData contentProfileKeyData = Profile.Keys.FirstOrDefault(k => string.Compare(k.Key, keyId, StringComparison.InvariantCultureIgnoreCase) == 0);
                    if (contentProfileKeyData != null)
                    {
                        contentProfileKeyData.Value = dictionary1[keyId];
                    }
                }
            }
Ejemplo n.º 12
0
            protected virtual ContentProfile GetPresetProfileData(ContentProfile profile, string presetKey)
            {
                Assert.ArgumentNotNull(profile, "profile");
                Assert.ArgumentNotNull(presetKey, "presetKey");
                LightTrackingField presetTrackingField = GetPresetTrackingField(profile, presetKey);

                if (presetTrackingField == null)
                {
                    return(null);
                }
                return(presetTrackingField.Profiles.FirstOrDefault(p => p.ProfileID == profile.ProfileID));
            }
Ejemplo n.º 13
0
            protected virtual LightTrackingField GetPresetTrackingField(ContentProfile profile, string presetKey)
            {
                Assert.ArgumentNotNull(profile, "profile");
                Assert.ArgumentNotNull(presetKey, "presetKey");
                Item presetItem = profile.GetPresetItem(presetKey);

                if (presetItem == null)
                {
                    return(null);
                }
                return(GetTrackingField(profile, presetItem));
            }
Ejemplo n.º 14
0
            protected virtual LightTrackingField GetTrackingField(ContentProfile profile, Item presetItem)
            {
                Assert.ArgumentNotNull(profile, "profile");
                Assert.ArgumentNotNull(presetItem, "presetItem");
                Field innerField = presetItem.Fields[TrackingField.PresetFieldName];

                if (innerField == null)
                {
                    return(null);
                }
                return(new LightTrackingField(innerField));
            }
Ejemplo n.º 15
0
        public void VersionSampleObjects()
        {
            Console.WriteLine("Creating versions of sample data for VersionControlService samples.");
            ServiceFactory         serviceFactory = ServiceFactory.Instance;
            IVersionControlService versionSvc
                = serviceFactory.GetRemoteService <IVersionControlService>(serviceDemo.DemoServiceContext);

            ObjectIdentitySet objIdSet = new ObjectIdentitySet();

            ObjectIdentity docObjId = new ObjectIdentity();

            docObjId.RepositoryName = serviceDemo.DefaultRepository;
            docObjId.Value          = new ObjectPath(gifImageObjPath);
            ObjectIdentity doc1ObjId = new ObjectIdentity();

            doc1ObjId.RepositoryName = serviceDemo.DefaultRepository;
            doc1ObjId.Value          = new ObjectPath(gifImage1ObjPath);
            objIdSet.AddIdentity(docObjId);
            objIdSet.AddIdentity(doc1ObjId);

            OperationOptions operationOptions = new OperationOptions();
            ContentProfile   contentProfile
                = new ContentProfile(FormatFilter.ANY,
                                     null,
                                     PageFilter.ANY, -1,
                                     PageModifierFilter.ANY,
                                     null);

            operationOptions.ContentProfile = contentProfile;

            DataPackage checkinPackage = versionSvc.Checkout(objIdSet, operationOptions);

            Console.WriteLine("Checked out sample objects.");

            for (int i = 0; i <= 1; i++)
            {
                DataObject checkinObj = checkinPackage.DataObjects[i];
                checkinObj.Contents = null;
                FileContent newContent = new FileContent();
                newContent.LocalPath     = gifImageFilePath;
                newContent.RenditionType = RenditionType.PRIMARY;
                newContent.Format        = "gif";
                checkinObj.Contents.Add(newContent);
            }

            bool          retainLock = false;
            List <String> labels     = new List <String>();

            labels.Add("test_version");
            versionSvc.Checkin(checkinPackage, VersionStrategy.NEXT_MINOR, retainLock, labels, operationOptions);
            Console.WriteLine("Checked in sample object with label 'test_version'");
        }
        // GET: ContentProfiles
        public async Task <IActionResult> Index()
        {
            var publisherProfileId = _context.Profiles
                                     .Where(p => p.UserId == SessionExtensions
                                            .GetInt32(HttpContext.Session, "UserId"))
                                     .FirstOrDefault().ProfileId;
            ContentProfile contentProfiles = _context.ContentProfiles
                                             .FirstOrDefault();

            foreach (ContentProfileTag apt in contentProfiles.ContentProfileTags)
            {
                apt.Tag = _context.Tags.Where(t => t.TagId == apt.TagId).FirstOrDefault();
            }
            return(View(contentProfiles));
        }
Ejemplo n.º 17
0
        public DataPackage Checkin(ObjectIdentity objIdentity, String newContentPath)
        {
            ObjectIdentitySet objIdSet = new ObjectIdentitySet();

            objIdSet.Identities.Add(objIdentity);

            OperationOptions operationOptions = new OperationOptions();
            ContentProfile   contentProfile   = new ContentProfile(FormatFilter.ANY, null,
                                                                   PageFilter.ANY,
                                                                   -1,
                                                                   PageModifierFilter.ANY, null);

            operationOptions.ContentProfile = contentProfile;

            DataPackage checkinPackage = versionControlService.Checkout(objIdSet, operationOptions);

            DataObject checkinObj = checkinPackage.DataObjects[0];

            checkinObj.Contents = null;
            FileContent newContent = new FileContent();

            newContent.LocalPath     = newContentPath;
            newContent.RenditionType = RenditionType.PRIMARY;
            newContent.Format        = "gif";
            checkinObj.Contents.Add(newContent);

            bool          retainLock = false;
            List <String> labels     = new List <String>();

            labels.Add("test_version");
            DataPackage resultDp;

            try
            {
                resultDp = versionControlService.Checkin(checkinPackage,
                                                         VersionStrategy.NEXT_MINOR,
                                                         retainLock,
                                                         labels,
                                                         operationOptions);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
                throw new Exception(e.Message);
            }
            return(resultDp);
        }
Ejemplo n.º 18
0
        public DataObject GetFilterContentNone(ObjectIdentity objectIdentity)
        {
            ContentProfile contentProfile = new ContentProfile();

            contentProfile.FormatFilter = FormatFilter.NONE;
            OperationOptions operationOptions = new OperationOptions();

            operationOptions.ContentProfile = contentProfile;

            ObjectIdentitySet     objectIdSet = new ObjectIdentitySet();
            List <ObjectIdentity> objIdList   = objectIdSet.Identities;

            objIdList.Add(objectIdentity);

            DataPackage dataPackage = objectService.Get(objectIdSet, operationOptions);

            return(dataPackage.DataObjects[0]);
        }
Ejemplo n.º 19
0
        public static void UpdateKeyValues(ContentProfile profile)
        {
            Assert.ArgumentNotNull(profile, "profile");
            Assert.IsFalse(profile.ProfileID == ID.Null, "profile ID");
            if (profile.Presets == null || profile.Presets.Count == 0)
            {
                return;
            }
            Item profileItem = profile.GetProfileItem();

            if (profileItem == null)
            {
                return;
            }
            Item presetsFolder = ProfileUtil.GetPresetsFolder(profileItem);

            if (presetsFolder == null)
            {
                return;
            }
            SimpleProfileKeyCalculator profileKeyCalculator = null;
            string strA = presetsFolder["Authoring Selection"];

            if (string.Compare(strA, "{C4960DD5-8B07-4025-8E48-57C3BC578CE1}", StringComparison.InvariantCultureIgnoreCase) == 0)
            {
                profileKeyCalculator = new SimpleProfileKeyCalculator(profile);
            }
            else if (string.Compare(strA, "{DF9486E3-C239-406E-83DD-7A30BEF2599D}", StringComparison.InvariantCultureIgnoreCase) == 0)
            {
                profileKeyCalculator = new MultipleProfileKeyCalculator(profile);
            }
            else if (string.Compare(strA, "{2DE135D7-FB39-42B2-B10A-13CB4285E5C5}", StringComparison.InvariantCultureIgnoreCase) == 0)
            {
                profileKeyCalculator = new MultipleWithPercentageProfileKeyCalculator(profile);
            }
            if (profileKeyCalculator == null)
            {
                return;
            }
            profileKeyCalculator.Calculate();
        }
Ejemplo n.º 20
0
            public virtual void Calculate()
            {
                if (Profile.Presets == null || Profile.Presets.Count == 0)
                {
                    return;
                }
                if (Profile.Presets.Count > 1)
                {
                    profile.Presets = new Dictionary <string, float>
                    {
                        {
                            Profile.Presets.Keys.First(),
                            100f
                        }
                    }
                }
                ;
                string presetKey = Profile.Presets.Keys.First();

                if (string.IsNullOrEmpty(presetKey))
                {
                    return;
                }
                ContentProfile presetProfileData = GetPresetProfileData(Profile, presetKey);

                if (presetProfileData == null)
                {
                    return;
                }
                foreach (ContentProfileKeyData contentProfileKeyData1 in presetProfileData.Keys)
                {
                    string keyId = contentProfileKeyData1.Key;
                    ContentProfileKeyData contentProfileKeyData2 = Profile.Keys.FirstOrDefault(k => string.Compare(k.Key, keyId, StringComparison.InvariantCultureIgnoreCase) == 0);
                    if (contentProfileKeyData2 != null)
                    {
                        contentProfileKeyData2.Value = contentProfileKeyData1.Value;
                    }
                }
            }
Ejemplo n.º 21
0
        public DataObject GetFilterContentSpecific(String qualificationString)
        {
            ContentProfile contentProfile = new ContentProfile();

            contentProfile.FormatFilter    = FormatFilter.SPECIFIED;
            contentProfile.Format          = "gif";
            contentProfile.UrlReturnPolicy = UrlReturnPolicy.PREFER;
            OperationOptions operationOptions = new OperationOptions();

            operationOptions.ContentProfile = contentProfile;

            ObjectIdentity objectIdentity =
                new ObjectIdentity
                    (new Qualification(qualificationString), DefaultRepository);
            ObjectIdentitySet objectIdSet = new ObjectIdentitySet(objectIdentity);
            DataPackage       dataPackage = null;

            dataPackage = objectService.Get(objectIdSet, operationOptions);

            DataObject dataObject = dataPackage.DataObjects[0];

            Content resultContent    = dataObject.Contents[0];
            String  contentClassName = resultContent.GetType().FullName;

            Console.WriteLine("Returned content as type " + contentClassName);
            if (contentClassName.Equals("Emc.Documentum.FS.DataModel.Core.Content.UrlContent"))
            {
                UrlContent urlContent = (UrlContent)resultContent;
                Console.WriteLine("Content ACS URL is: " + (urlContent.Url));
            }
            if (resultContent.CanGetAsFile())
            {
                FileInfo fileInfo = resultContent.GetAsFile();
                Console.WriteLine("Returned content format is " + resultContent.Format);
                Console.WriteLine("Got content as file " + fileInfo.FullName);
            }
            return(dataObject);
        }
Ejemplo n.º 22
0
        public void AssignContentProfile(Profile profile, string profileName)
        {
            if (Item == null)
            {
                return;
            }

            Field field = Item.Fields[trackingFieldName];

            if (field == null)
            {
                return;
            }

            var            trackingField  = new TrackingField(field);
            ContentProfile contentProfile = trackingField.Profiles.FirstOrDefault(p => p.Name == profileName);

            if (contentProfile == null || !contentProfile.IsSavedInField)
            {
                return;
            }

            ContentProfile = contentProfile;
        }
Ejemplo n.º 23
0
 public SimpleProfileKeyCalculator(ContentProfile profile)
 {
     Assert.ArgumentNotNull(profile, "profile");
     this.profile = profile;
 }
        public DataPackage Checkin(ObjectIdentity objIdentity, String newContentPath)
        {
            ObjectIdentitySet objIdSet = new ObjectIdentitySet();
            objIdSet.Identities.Add(objIdentity);

            OperationOptions operationOptions = new OperationOptions();
            ContentProfile contentProfile = new ContentProfile(FormatFilter.ANY, null,
                                                               PageFilter.ANY,
                                                               -1,
                                                               PageModifierFilter.ANY, null);
            operationOptions.ContentProfile = contentProfile;

            DataPackage checkinPackage = versionControlService.Checkout(objIdSet, operationOptions);

            DataObject checkinObj = checkinPackage.DataObjects[0];

            checkinObj.Contents = null;
            FileContent newContent = new FileContent();
            newContent.LocalPath = newContentPath;
            newContent.RenditionType = RenditionType.PRIMARY;
            newContent.Format = "gif";
            checkinObj.Contents.Add(newContent);

            bool retainLock = false;
            List<String> labels = new List<String>();
            labels.Add("test_version");
            DataPackage resultDp;
            try
            {
                resultDp = versionControlService.Checkin(checkinPackage,
                                              VersionStrategy.NEXT_MINOR,
                                              retainLock,
                                              labels,
                                              operationOptions);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
                throw new Exception(e.Message);
            }
            return resultDp;
        }
        public void VersionSampleObjects()
        {
            Console.WriteLine("Creating versions of sample data for VersionControlService samples.");
            ServiceFactory serviceFactory = ServiceFactory.Instance;
            IVersionControlService versionSvc
                = serviceFactory.GetRemoteService<IVersionControlService>(serviceDemo.DemoServiceContext);

            ObjectIdentitySet objIdSet = new ObjectIdentitySet();

            ObjectIdentity docObjId = new ObjectIdentity();
            docObjId.RepositoryName = serviceDemo.DefaultRepository;
            docObjId.Value = new ObjectPath(gifImageObjPath);
            ObjectIdentity doc1ObjId = new ObjectIdentity();
            doc1ObjId.RepositoryName = serviceDemo.DefaultRepository;
            doc1ObjId.Value = new ObjectPath(gifImage1ObjPath);
            objIdSet.AddIdentity(docObjId);
            objIdSet.AddIdentity(doc1ObjId);

            OperationOptions operationOptions = new OperationOptions();
            ContentProfile contentProfile
                = new ContentProfile(FormatFilter.ANY,
                                     null,
                                     PageFilter.ANY, -1,
                                     PageModifierFilter.ANY,
                                     null);
            operationOptions.ContentProfile = contentProfile;

            DataPackage checkinPackage = versionSvc.Checkout(objIdSet, operationOptions);
            Console.WriteLine("Checked out sample objects.");

            for (int i = 0; i <= 1; i++)
            {
                DataObject checkinObj = checkinPackage.DataObjects[i];
                checkinObj.Contents = null;
                FileContent newContent = new FileContent();
                newContent.LocalPath = gifImageFilePath;
                newContent.RenditionType = RenditionType.PRIMARY;
                newContent.Format = "gif";
                checkinObj.Contents.Add(newContent);
            }

            bool retainLock = false;
            List<String> labels = new List<String>();
            labels.Add("test_version");
            versionSvc.Checkin(checkinPackage, VersionStrategy.NEXT_MINOR, retainLock, labels, operationOptions);
            Console.WriteLine("Checked in sample object with label 'test_version'");
        }
Ejemplo n.º 26
0
 public MultipleWithPercentageProfileKeyCalculator(ContentProfile profile)
     : base(profile)
 {
     Assert.ArgumentNotNull(profile, "profile");
 }
Ejemplo n.º 27
0
        private OperationOptions GetOperationOptionsForRetrievingContent()
        {
            var contentProfile = new ContentProfile
                                 {
                                     FormatFilter = FormatFilter.ANY,
                                     UrlReturnPolicy = UrlReturnPolicy.PREFER
                                 };

            var operationOptions = new OperationOptions { ContentProfile = contentProfile };
            operationOptions.SetProfile(contentProfile);

            return operationOptions;
        }
        public DataObject GetWithContent(ObjectIdentity objectIdentity, String geoLoc, ContentTransferMode transferMode)
        {
            ContentTransferProfile transferProfile = new ContentTransferProfile();
            transferProfile.Geolocation = geoLoc;
            transferProfile.TransferMode = transferMode;
            DemoServiceContext.SetProfile(transferProfile);

            ContentProfile contentProfile = new ContentProfile();
            contentProfile.FormatFilter = FormatFilter.ANY;
            contentProfile.UrlReturnPolicy = UrlReturnPolicy.PREFER;

            OperationOptions operationOptions = new OperationOptions();
            operationOptions.ContentProfile = contentProfile;
            operationOptions.SetProfile(contentProfile);

            ObjectIdentitySet objectIdSet = new ObjectIdentitySet();
            List<ObjectIdentity> objIdList = objectIdSet.Identities;
            objIdList.Add(objectIdentity);

            DataPackage dataPackage = objectService.Get(objectIdSet, operationOptions);
            DataObject dataObject = dataPackage.DataObjects[0];

            Content resultContent = dataObject.Contents[0];
            String contentClassName = resultContent.GetType().FullName;
            Console.WriteLine("Returned content as type " + contentClassName);
            if (contentClassName.Equals("Emc.Documentum.FS.DataModel.Core.Content.UrlContent"))
            {
                UrlContent urlContent = (UrlContent)resultContent;
                Console.WriteLine("Content ACS URL is: " + (urlContent.Url));
            }
            if (resultContent.CanGetAsFile())
            {
                FileInfo fileInfo = resultContent.GetAsFile();
                Console.WriteLine("Got content as file " + fileInfo.FullName);
            }
            else if (contentClassName.Equals("Emc.Documentum.FS.DataModel.Core.Content.UcfContent"))
            {
                UcfContent ucfContent = (UcfContent)resultContent;
                Console.WriteLine("Got content as file " + ucfContent.LocalFilePath);
            }
            return dataObject;
        }
Ejemplo n.º 29
0
 static void WriteItems(BinaryWriter writer, ContentProfile item)
 {
     item.Pack(writer);
 }
        public DataObject GetFilterContentNone(ObjectIdentity objectIdentity)
        {
            ContentProfile contentProfile = new ContentProfile();
            contentProfile.FormatFilter = FormatFilter.NONE;
            OperationOptions operationOptions = new OperationOptions();
            operationOptions.ContentProfile = contentProfile;

            ObjectIdentitySet objectIdSet = new ObjectIdentitySet();
            List<ObjectIdentity> objIdList = objectIdSet.Identities;
            objIdList.Add(objectIdentity);

            DataPackage dataPackage = objectService.Get(objectIdSet, operationOptions);
            return dataPackage.DataObjects[0];
        }
        public DataObject GetFilterContentSpecific(String qualificationString)
        {
            ContentProfile contentProfile = new ContentProfile();
            contentProfile.FormatFilter = FormatFilter.SPECIFIED;
            contentProfile.Format = "gif";
            contentProfile.UrlReturnPolicy = UrlReturnPolicy.PREFER;
            OperationOptions operationOptions = new OperationOptions();
            operationOptions.ContentProfile = contentProfile;

            ObjectIdentity objectIdentity =
                new ObjectIdentity
                    (new Qualification(qualificationString), DefaultRepository);
            ObjectIdentitySet objectIdSet = new ObjectIdentitySet(objectIdentity);
            DataPackage dataPackage = null;

            dataPackage = objectService.Get(objectIdSet, operationOptions);

            DataObject dataObject = dataPackage.DataObjects[0];

            Content resultContent = dataObject.Contents[0];
            String contentClassName = resultContent.GetType().FullName;
            Console.WriteLine("Returned content as type " + contentClassName);
            if (contentClassName.Equals("Emc.Documentum.FS.DataModel.Core.Content.UrlContent"))
            {
                UrlContent urlContent = (UrlContent)resultContent;
                Console.WriteLine("Content ACS URL is: " + (urlContent.Url));
            }
            if (resultContent.CanGetAsFile())
            {
                FileInfo fileInfo = resultContent.GetAsFile();
                Console.WriteLine("Returned content format is " + resultContent.Format);
                Console.WriteLine("Got content as file " + fileInfo.FullName);
            }
            return dataObject;
        }