예제 #1
0
        public void TestBase64()
        {
            Console.WriteLine("\nTesting get with Base64 content transfer.");
            ContentTransferMode trMode = ContentTransferMode.BASE64;

            GetWithContent("Pleasanton", trMode);
        }
예제 #2
0
        public void TestMTOM()
        {
            Console.WriteLine("\nTesting get with MTOM content transfer.");
            ContentTransferMode trMode = ContentTransferMode.MTOM;

            GetWithContent("Pleasanton", trMode);
        }
예제 #3
0
 private void GetWithContent(string geoLoc, ContentTransferMode trMode)
 {
     sampleContentManager.CreateDemoObjects();
     if (geoLoc.Equals("") || geoLoc.Equals(null))
     {
         geoLoc = "Pleasanton";
     }
     if (trMode.Equals(null))
     {
         trMode = ContentTransferMode.MTOM;
     }
     try
     {
         ObjectIdentity objIdentity =
             new ObjectIdentity(new Qualification(SampleContentManager.gifImageQualString),
                                objectServiceDemo.DefaultRepository);
         DataObject dataObject = objectServiceDemo.GetWithContent(objIdentity, geoLoc, trMode);
     }
     catch (FaultException <SerializableException> ex)
     {
         Console.WriteLine(String.Format("Got FaultException[{0}] with message: {1}\n", ex.Detail, ex.Message));
     }
     catch (Exception exx)
     {
         Console.WriteLine(exx.StackTrace);
     }
     finally
     {
         sampleContentManager.DeleteTestCabinet();
     }
 }
예제 #4
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;
            }
        }
        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;
        }
 private void GetWithContent(string geoLoc, ContentTransferMode trMode)
 {
     sampleContentManager.CreateDemoObjects();
     if (geoLoc.Equals("") || geoLoc.Equals(null)) { geoLoc = "Pleasanton"; }
     if (trMode.Equals(null)) trMode = ContentTransferMode.MTOM;
     try
     {
         ObjectIdentity objIdentity =
                         new ObjectIdentity(new Qualification(SampleContentManager.gifImageQualString),
                                            objectServiceDemo.DefaultRepository);
         DataObject dataObject = objectServiceDemo.GetWithContent(objIdentity, geoLoc, trMode);
     }
     catch (FaultException<SerializableException> ex)
     {
         Console.WriteLine(String.Format("Got FaultException[{0}] with message: {1}\n", ex.Detail, ex.Message));
     }
     catch (Exception exx)
     {
         Console.WriteLine(exx.StackTrace);
     }
     finally
     {
         sampleContentManager.DeleteTestCabinet();
     }
 }