public CheckoutInfo CheckoutInfo(ObjectIdentity objIdentity)
        {
            ObjectIdentitySet objIdSet = new ObjectIdentitySet();
            objIdSet.Identities.Add(objIdentity);
            List<CheckoutInfo> objList;
            OperationOptions operationOptions = null;
            versionControlService.Checkout(objIdSet, operationOptions);
            objList = versionControlService.GetCheckoutInfo(objIdSet);
            CheckoutInfo checkoutInfo = objList[0];

            if (checkoutInfo.IsCheckedOut)
            {
                Console.WriteLine("Object "
                                   + checkoutInfo.Identity
                                   + " is checked out.");
                Console.WriteLine("Lock owner is " + checkoutInfo.UserName);
            }
            else
            {
                Console.WriteLine("Object "
                                   + checkoutInfo.Identity
                                   + " is not checked out.");
            }
            versionControlService.CancelCheckout(objIdSet);
            return checkoutInfo;
        }
        private void createTestVirtualDocument()
        {
                // create a new DataObject to use as the parent node
                ObjectIdentity emptyIdentity = new ObjectIdentity(DefaultRepository);
                DataObject parentDO = new DataObject(emptyIdentity);
                parentDO.Type = "dm_document";
                PropertySet parentProperties = new PropertySet();
                parentProperties.Set("object_name", SampleContentManager.testVdmObjectName);
                parentDO.Properties = parentProperties;

                // link into a folder
                ObjectPath objectPath = new ObjectPath(SampleContentManager.sourcePath);
                ObjectIdentity sampleFolderIdentity = new ObjectIdentity(objectPath, DefaultRepository);
                ReferenceRelationship sampleFolderRelationship = new ReferenceRelationship();
                sampleFolderRelationship.Name = Relationship.RELATIONSHIP_FOLDER;
                sampleFolderRelationship.Target = sampleFolderIdentity;
                sampleFolderRelationship.TargetRole = Relationship.ROLE_PARENT;
                parentDO.Relationships.Add(sampleFolderRelationship);

                // get id of document to use for first child node
                ObjectIdentity child0Id = new ObjectIdentity();
                child0Id.RepositoryName = DefaultRepository;
                child0Id.Value = new Qualification(SampleContentManager.gifImageQualString);

                // get id of document to use for second child node
                ObjectIdentity child1Id = new ObjectIdentity();
                child1Id.RepositoryName = DefaultRepository;
                child1Id.Value = new Qualification(SampleContentManager.gifImage1QualString);

                ObjectIdentitySet childNodes = new ObjectIdentitySet();
                childNodes.AddIdentity(child0Id);
                childNodes.AddIdentity(child1Id);

                virtualDocumentServiceDemo.AddChildNodes(parentDO, childNodes);
        }
        public DataObject AddChildNodes(DataObject parentObject, ObjectIdentitySet childIdentities)
	{
		List<ObjectIdentity> idList = childIdentities.Identities;
		List<VdmChildrenActionInfo> caInfoList = new List<VdmChildrenActionInfo>();
		foreach (ObjectIdentity objIdentity in idList)
		{
			VirtualDocumentNode vdmNode = new VirtualDocumentNode();
			vdmNode.Identity = objIdentity;
			VirtualDocumentInfo vdmInfo = new VirtualDocumentInfo();
			vdmInfo.Binding = VirtualDocumentInfo.BINDING_LATE;
			vdmInfo.CopyBehavior = CopyBehaviorMode.COPY;
			vdmInfo.OverrideLateBinding = false;
			vdmNode.Policy = vdmInfo;
			VdmChildrenActionInfo caInfo = new VdmChildrenActionInfo();
			caInfo.Action = VdmChildrenAction.APPEND;
			caInfo.Node = vdmNode;
			caInfoList.Add(caInfo);
		}
		
        VdmUpdateProfile vdmUpdateProfile = new VdmUpdateProfile();
		List<String> versionLabels = new List<String>();
		versionLabels.Add("testVersionLabel");
		
		// make sure to add the CURRENT label if you
		// want the virtual document to be CURRENT
		versionLabels.Add("CURRENT");
		vdmUpdateProfile.Labels = versionLabels;
		
		OperationOptions options = new OperationOptions();
		options.VdmUpdateProfile = vdmUpdateProfile;
		return virtualDocumentService.Update(parentObject, caInfoList, options);
	}
Example #4
0
        public CheckoutInfo CheckoutInfo(ObjectIdentity objIdentity)
        {
            ObjectIdentitySet objIdSet = new ObjectIdentitySet();

            objIdSet.Identities.Add(objIdentity);
            List <CheckoutInfo> objList;
            OperationOptions    operationOptions = null;

            versionControlService.Checkout(objIdSet, operationOptions);
            objList = versionControlService.GetCheckoutInfo(objIdSet);
            CheckoutInfo checkoutInfo = objList[0];

            if (checkoutInfo.IsCheckedOut)
            {
                Console.WriteLine("Object "
                                  + checkoutInfo.Identity
                                  + " is checked out.");
                Console.WriteLine("Lock owner is " + checkoutInfo.UserName);
            }
            else
            {
                Console.WriteLine("Object "
                                  + checkoutInfo.Identity
                                  + " is not checked out.");
            }
            versionControlService.CancelCheckout(objIdSet);
            return(checkoutInfo);
        }
        public DataPackage Checkout(ObjectIdentity objIdentity)
        {

            ObjectIdentitySet objIdSet = new ObjectIdentitySet();
            objIdSet.Identities.Add(objIdentity);

            OperationOptions operationOptions = null;
            DataPackage resultDp;
            
            resultDp = versionControlService.Checkout(objIdSet, operationOptions);
            Console.WriteLine("Checkout successful");

            List<VersionInfo> vInfo = versionControlService.GetVersionInfo(objIdSet);
            VersionInfo versionInfo = vInfo[0];

            Console.WriteLine("Printing version info for " + versionInfo.Identity);
            Console.WriteLine("IsCurrent is " + versionInfo.IsCurrent);
            Console.WriteLine("Version is " + versionInfo.Version);
            Console.WriteLine("Symbolic labels are: ");
            foreach (String label in versionInfo.SymbolicLabels)
            {
                Console.WriteLine(label);
            }

            versionControlService.CancelCheckout(objIdSet);
            Console.WriteLine("Checkout cancelled");
            return resultDp;
        }
Example #6
0
        public DataPackage Checkout(ObjectIdentity objIdentity)
        {
            ObjectIdentitySet objIdSet = new ObjectIdentitySet();

            objIdSet.Identities.Add(objIdentity);

            OperationOptions operationOptions = null;
            DataPackage      resultDp;

            resultDp = versionControlService.Checkout(objIdSet, operationOptions);
            Console.WriteLine("Checkout successful");

            List <VersionInfo> vInfo       = versionControlService.GetVersionInfo(objIdSet);
            VersionInfo        versionInfo = vInfo[0];

            Console.WriteLine("Printing version info for " + versionInfo.Identity);
            Console.WriteLine("IsCurrent is " + versionInfo.IsCurrent);
            Console.WriteLine("Version is " + versionInfo.Version);
            Console.WriteLine("Symbolic labels are: ");
            foreach (String label in versionInfo.SymbolicLabels)
            {
                Console.WriteLine(label);
            }

            versionControlService.CancelCheckout(objIdSet);
            Console.WriteLine("Checkout cancelled");
            return(resultDp);
        }
        public void ShowObjectIdentitySet()
        {
            String            repName  = "MyRepositoryName";
            ObjectIdentitySet objIdSet = new ObjectIdentitySet();

            ObjectIdentity[] objectIdentities = new ObjectIdentity[4];

            // add some ObjectIdentity instances
            ObjectId objId = new ObjectId("090007d280075180");

            objIdSet.AddIdentity(new ObjectIdentity(objId, repName));

            Qualification qualification = new Qualification("dm_document where object_name = 'bl_upwind.gif'");

            objIdSet.AddIdentity(new ObjectIdentity(qualification, repName));

            ObjectPath objPath = new ObjectPath("/testCabinet/testFolder/testDoc");

            objIdSet.AddIdentity(new ObjectIdentity(objPath, repName));

            // walk through and see what we have
            IEnumerator <ObjectIdentity> identityEnumerator = objIdSet.Identities.GetEnumerator();

            while (identityEnumerator.MoveNext())
            {
                Console.WriteLine("Object Identity: " + identityEnumerator.Current);
            }
        }
Example #8
0
        public void DetachLifecycle(ObjectIdentity objectIdentity)
        {
            ObjectIdentitySet objIdSet         = new ObjectIdentitySet(objectIdentity);
            OperationOptions  operationOptions = null;

            lifecycleService.Detach(objIdSet, operationOptions);
        }
        public DataObject AddChildNodes(DataObject parentObject, ObjectIdentitySet childIdentities)
        {
            List <ObjectIdentity>        idList     = childIdentities.Identities;
            List <VdmChildrenActionInfo> caInfoList = new List <VdmChildrenActionInfo>();

            foreach (ObjectIdentity objIdentity in idList)
            {
                VirtualDocumentNode vdmNode = new VirtualDocumentNode();
                vdmNode.Identity = objIdentity;
                VirtualDocumentInfo vdmInfo = new VirtualDocumentInfo();
                vdmInfo.Binding             = VirtualDocumentInfo.BINDING_LATE;
                vdmInfo.CopyBehavior        = CopyBehaviorMode.COPY;
                vdmInfo.OverrideLateBinding = false;
                vdmNode.Policy = vdmInfo;
                VdmChildrenActionInfo caInfo = new VdmChildrenActionInfo();
                caInfo.Action = VdmChildrenAction.APPEND;
                caInfo.Node   = vdmNode;
                caInfoList.Add(caInfo);
            }

            VdmUpdateProfile vdmUpdateProfile = new VdmUpdateProfile();
            List <String>    versionLabels    = new List <String>();

            versionLabels.Add("testVersionLabel");

            // make sure to add the CURRENT label if you
            // want the virtual document to be CURRENT
            versionLabels.Add("CURRENT");
            vdmUpdateProfile.Labels = versionLabels;

            OperationOptions options = new OperationOptions();

            options.VdmUpdateProfile = vdmUpdateProfile;
            return(virtualDocumentService.Update(parentObject, caInfoList, options));
        }
Example #10
0
        public void DeleteVersionDemo(ObjectIdentity objIdentity)
        {
            ObjectIdentitySet objIdSet = new ObjectIdentitySet();

            objIdSet.Identities.Add(objIdentity);

            versionControlService.DeleteVersion(objIdSet);
        }
Example #11
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;
            }
        }
Example #12
0
        public void CancelCheckout(ObjectIdentity objIdentity)
        {
            ObjectIdentitySet objIdSet = new ObjectIdentitySet();

            objIdSet.Identities.Add(objIdentity);

            versionControlService.CancelCheckout(objIdSet);
            Console.WriteLine("Checkout cancelled.");
        }
Example #13
0
        /// <summary>
        /// Restituisce un DataObject con tutte le proprietà di un oggetto DCTM e
        /// l'insieme dei folder a cui è linkato (quest'ultimi solo come identity però)
        /// </summary>
        /// <param name="objSrvc"></param>
        /// <param name="documentIdentity"></param>
        /// <param name="propertyNames">null == TUTTE; altrimenti quelle indicate. OKKIO: in nessun caso restituisce r_object_id !!</param>
        /// <returns></returns>
        public static DataObject getAllPropsAndFolders(IObjectService objSrvc,
                                                       ObjectIdentity objectIdentity,
                                                       List <string> propertyNames,
                                                       bool includeFolders)
        {
            DataPackage pkg = new DataPackage();

            ObjectIdentitySet objectIdSet = new ObjectIdentitySet(objectIdentity);

            PropertyProfile propertyProfile = null;

            //propertyProfile.filterModeSpecified = true;
            if (propertyNames == null)
            {
                propertyProfile = new PropertyProfile(PropertyFilterMode.ALL);
            }
            else
            {
                propertyProfile = new PropertyProfile(PropertyFilterMode.SPECIFIED_BY_INCLUDE);
                propertyProfile.IncludeProperties = propertyNames;
            }

            RelationshipProfile relationProfile = new RelationshipProfile();

            if (includeFolders)
            {
                //TODO: bug di DFS60sp1:
                // se specifico che voglio solo le relazioni parent non funziona
                // devo chiedere tutte le relazioni

                //relationProfile.ResultDataMode = ResultDataMode.REFERENCE;
                //relationProfile.TargetRoleFilter = TargetRoleFilter.ANY;
                //relationProfile.NameFilter = RelationshipNameFilter.ANY;
                //relationProfile.DepthFilter = DepthFilter.UNLIMITED;

                // proposta di Azzalini per velocizzare eliminazione documento in Fascicolo con DCTM 6.7
                relationProfile.ResultDataMode   = ResultDataMode.REFERENCE;
                relationProfile.TargetRoleFilter = TargetRoleFilter.SPECIFIED;
                relationProfile.TargetRole       = Relationship.ROLE_PARENT;
                relationProfile.NameFilter       = RelationshipNameFilter.SPECIFIED;
                relationProfile.RelationName     = Relationship.RELATIONSHIP_FOLDER;
                relationProfile.DepthFilter      = DepthFilter.SPECIFIED;
                relationProfile.Depth            = 1;
            }

            OperationOptions operationOptions = new OperationOptions();

            //operationOptions.Profiles = new Profile[profilesCount];
            operationOptions.PropertyProfile = propertyProfile;
            if (includeFolders)
            {
                operationOptions.RelationshipProfile = relationProfile;
            }

            pkg = objSrvc.Get(objectIdSet, operationOptions);
            return(pkg.DataObjects[0]);
        }
 public SampleContentManager(DemoBase serviceDemo)
 {
     this.serviceDemo = serviceDemo;
     createdObjectIdentities = new ObjectIdentitySet();
     ServiceFactory serviceFactory = ServiceFactory.Instance;
     objectService =
         serviceFactory.GetRemoteService<IObjectService>(serviceDemo.DemoServiceContext);
     aclService = serviceFactory.GetRemoteService<IAccessControlService>(serviceDemo.DemoServiceContext);
     setSampleFolderRelationship();
 }
Example #15
0
        /// <summary>
        /// Implementazione di un workaround per il checkin dei singoli allegati di un documento (se presenti)
        /// </summary>
        /// <param name="docNumber"></param>
        protected void UndoCheckOutAllegati(string docNumber)
        {
            ObjectIdentitySet identitySet = new ObjectIdentitySet();

            identitySet.Identities.AddRange(Dfs4DocsPa.getAllegatiDocumentoIdentities(this.GetServiceInstance <IQueryService>(false), docNumber));
            if (identitySet.Identities.Count > 0)
            {
                this.GetServiceInstance <IVersionControlService>(false).CancelCheckout(identitySet);
            }
        }
Example #16
0
        public DataObject GetCurrentDemo(ObjectIdentity objIdentity)
        {
            ObjectIdentitySet objIdSet = new ObjectIdentitySet();

            objIdSet.Identities.Add(objIdentity);

            OperationOptions operationOptions  = null;
            DataPackage      resultDataPackage = versionControlService.GetCurrent(objIdSet, operationOptions);

            return(resultDataPackage.DataObjects[0]);
        }
Example #17
0
        public SampleContentManager(DemoBase serviceDemo)
        {
            this.serviceDemo        = serviceDemo;
            createdObjectIdentities = new ObjectIdentitySet();
            ServiceFactory serviceFactory = ServiceFactory.Instance;

            objectService =
                serviceFactory.GetRemoteService <IObjectService>(serviceDemo.DemoServiceContext);
            aclService = serviceFactory.GetRemoteService <IAccessControlService>(serviceDemo.DemoServiceContext);
            setSampleFolderRelationship();
        }
Example #18
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'");
        }
Example #19
0
        public DataObject GetObjectWithDefaults(ObjectIdentity objIdentity)
        {
            objIdentity.RepositoryName = DefaultRepository;
            ObjectIdentitySet     objectIdSet = new ObjectIdentitySet();
            List <ObjectIdentity> objIdList   = objectIdSet.Identities;

            objIdList.Add(objIdentity);

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

            return(dataPackage.DataObjects[0]);
        }
Example #20
0
        public DataObject GetObjectFilterProperties(ObjectIdentity objIdentity)
        {
            PropertyProfile propertyProfile = new PropertyProfile();

            propertyProfile.FilterMode = PropertyFilterMode.ALL_NON_SYSTEM;
            OperationOptions operationOptions = new OperationOptions();

            operationOptions.PropertyProfile = propertyProfile;
            ObjectIdentitySet objectIdSet = new ObjectIdentitySet(objIdentity);
            DataPackage       dataPackage = objectService.Get(objectIdSet, operationOptions);

            return(dataPackage.DataObjects[0]);
        }
Example #21
0
        /// <summary>
        /// Elimina un utente in amministrazione
        /// </summary>
        /// <param name="utente"></param>
        /// <returns></returns>
        public EsitoOperazione EliminaUtenteAmm(OrgUtente utente)
        {
            EsitoOperazione ret = new EsitoOperazione();
            string          logMsg;
            IObjectService  objSrvc        = null;
            String          repositoryName = DctmConfigurations.GetRepositoryName();

            // test sui campi obbligatori
            if (string.IsNullOrEmpty(utente.UserId))
            {
                logMsg          = ERR_HEADER + "EliminaUtente: dati insufficienti";
                ret.Codice      = -1;
                ret.Descrizione = logMsg;
                logger.Debug(logMsg);
                return(ret);
            }

            try
            {
                // verifica se esistono più di un'occorrenza per utente
                if (CountGroupsByUser(utente.UserId) > 1)
                {
                    // rimuove l'utente dal gruppo di root
                    EliminaUtenteDaRuoloAmm(utente.UserId, utente.IDAmministrazione);
                }
                else
                {
                    ObjectIdentitySet identitySet = new ObjectIdentitySet();
                    objSrvc = this.GetObjectServiceInstance();
                    ObjectIdentity userIdentity = Dfs4DocsPa.getUserIdentityByName(TypeUtente.getUserName(utente));
                    // Cancellazione dell'home cabinet per l'utente
                    identitySet.AddIdentity(Dfs4DocsPa.getUserHomeFolderIdentity(utente.UserId));
                    identitySet.AddIdentity(userIdentity);
                    OperationOptions opts = new OperationOptions();
                    opts.DeleteProfile = new DeleteProfile();
                    opts.DeleteProfile.IsPopulateWithReferences = true;
                    objSrvc.Delete(identitySet, opts);
                    logger.Debug(DEBUG_HEADER + "EliminaUtente completata con SUCCESSO");
                }
                return(ret);
            }
            catch (Exception ex)
            {
                String st = ex.ToString();
                logger.Debug(DEBUG_HEADER + "EliminaUtente FALLITA, Exception=" + st);
                ret.Codice      = -1;
                ret.Descrizione = ERR_HEADER + "EliminaUtente";
                return(ret);
            }
        }
Example #22
0
        /// <summary>
        /// UndoCheckout di un documento in stato checkout
        /// </summary>
        /// <param name="checkOutStatus"></param>
        /// <param name="library"></param>
        /// <returns></returns>
        public bool UndoCheckOut(DocsPaVO.CheckInOut.CheckOutStatus checkOutStatus)
        {
            bool retValue = false;

            try
            {
                ObjectIdentity identity = null;

                // Reperimento identity del documento da sbloccare
                if (DocsPaQueryHelper.isStampaRegistro(checkOutStatus.DocumentNumber))
                {
                    identity = Dfs4DocsPa.getDocumentoStampaRegistroIdentityByDocNumber(checkOutStatus.DocumentNumber);
                }
                else
                {
                    identity = Dfs4DocsPa.getDocumentoIdentityByDocNumber(checkOutStatus.DocumentNumber);
                }

                ObjectIdentitySet identitySet = new ObjectIdentitySet();
                identitySet.Identities.Add(identity);
                // Reperimento degli ObjectIdentity per ciascun allegato del documento
                identitySet.Identities.AddRange(Dfs4DocsPa.getAllegatiDocumentoIdentities(this.GetServiceInstance <IQueryService>(false), checkOutStatus.DocumentNumber));

                IVersionControlService service = this.GetServiceInstance <IVersionControlService>(false);
                service.CancelCheckout(identitySet);

                retValue = true;

                if (retValue)
                {
                    this.ClearCheckOutStatusObject(checkOutStatus);

                    retValue = this.SaveCheckOutDocumentProperties(checkOutStatus);

                    if (retValue)
                    {
                        logger.Debug(string.Format("Documentum.UndoCheckOut: effettuato l'undocheckout del documento con id {0} e docnumber {1}", checkOutStatus.IDDocument, checkOutStatus.DocumentNumber));
                    }
                }
            }
            catch (Exception ex)
            {
                retValue = false;

                logger.Debug("Errore in Documentum.UndoCheckOut: " + ex.ToString());
            }

            return(retValue);
        }
Example #23
0
        public void DeleteAllVersionsDemoQual()
        {
            string nonCurrentQual = "dm_document (ALL) " +
                                    "where object_name = 'DFS_sample_image' " +
                                    "and ANY r_version_label = 'test_version'";
            Qualification  qual        = new Qualification(nonCurrentQual);
            ObjectIdentity objIdentity = new ObjectIdentity();

            objIdentity.Value          = qual;
            objIdentity.RepositoryName = DefaultRepository;
            ObjectIdentitySet objIdSet = new ObjectIdentitySet();

            objIdSet.Identities.Add(objIdentity);

            versionControlService.DeleteAllVersions(objIdSet);
        }
Example #24
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);
        }
Example #25
0
        public DataObject GetWithPermissions(ObjectIdentity objectIdentity)
        {
            PermissionProfile permissionProfile = new PermissionProfile();

            permissionProfile.PermissionTypeFilter = PermissionTypeFilter.ANY;
            OperationOptions operationOptions = new OperationOptions();

            operationOptions.PermissionProfile = permissionProfile;

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

            objIdList.Add(objectIdentity);

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

            return(dataPackage.DataObjects[0]);
        }
Example #26
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]);
        }
Example #27
0
        public void ObjServiceDelete(String path)
        {
            ObjectPath     docPath     = new ObjectPath(path);
            ObjectIdentity objIdentity = new ObjectIdentity();

            objIdentity.Value          = docPath;
            objIdentity.RepositoryName = DefaultRepository;
            ObjectIdentitySet objectIdSet = new ObjectIdentitySet(objIdentity);

            DeleteProfile deleteProfile = new DeleteProfile();

            deleteProfile.IsDeepDeleteFolders           = true;
            deleteProfile.IsDeepDeleteChildrenInFolders = true;
            OperationOptions operationOptions = new OperationOptions();

            operationOptions.DeleteProfile = deleteProfile;

            objectService.Delete(objectIdSet, operationOptions);
        }
Example #28
0
        /// <summary>
        /// Eliminazione di un nodo di titolario
        /// </summary>
        /// <param name="nodoTitolario"></param>
        /// <returns></returns>
        public bool DeleteNodoTitolario(OrgNodoTitolario nodoTitolario)
        {
            bool retValue = false;

            try
            {
                IObjectService objSrvc = this.GetObjectServiceInstance();

                DeleteProfile deleteProfile = new DeleteProfile();
                deleteProfile.IsDeepDeleteFolders           = true;
                deleteProfile.IsDeepDeleteChildrenInFolders = true;

                OperationOptions opts = new OperationOptions();
                opts.Profiles = new List <Profile>();
                opts.Profiles.Add(deleteProfile);

                ObjectIdentitySet identitySet = new ObjectIdentitySet();
                identitySet.Identities = new List <ObjectIdentity>();
                identitySet.Identities.Add(Dfs4DocsPa.getNodoTitolarioIdentity(nodoTitolario.ID));

                objSrvc.Delete(identitySet, opts);

                // Rimozione ACL nodo titolario
                this.DeleteAclNodoTitolario(nodoTitolario);

                // Rimozione di tutte le ACL degli eventuali
                // fascicoli procedimentali contenuti nel titolario
                this.ClearAclFascicoliNodoTitolario(nodoTitolario);

                retValue = true;

                logger.Debug(string.Format("Documentum.DeleteNodoTitolario: rimosso nodo di titolario con id {0}", nodoTitolario.ID));
            }
            catch (Exception ex)
            {
                retValue = false;

                logger.Debug("Errore in Documentum.DeleteNodoTitolario: " + ex.ToString());
            }

            return(retValue);
        }
        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;
        }
Example #30
0
 private void undoCreateHomeFolder(OrgUtente utente)
 {
     try
     {
         IObjectService objSrvc      = this.GetObjectServiceInstance();
         string         homePath     = "/" + TypeUtente.getHomeFolderName(utente.UserId);
         ObjectIdentity homeIdentity =
             new ObjectIdentity(new ObjectPath(homePath),
                                DctmConfigurations.GetRepositoryName());
         ObjectIdentitySet idSet = new ObjectIdentitySet(homeIdentity);
         objSrvc.Delete(idSet, null);
     }
     catch (Exception ex)
     {
         //se siamo arrivati qui, significa che siamo già in una condizione di errore
         //non è così grave: rimane un folder, che non pregiudica un eventuale nuovo tentativo dei definire l'utente
         //in ogni caso è inutile rilanciare l'eccezione: già il chiamante è in gestione di una ecc.
         logger.Debug(DEBUG_HEADER + "Impossibile annullare l'inserimento dell'home folder: " + ex.ToString());
     }
 }
        private void createTestVirtualDocument()
        {
            // create a new DataObject to use as the parent node
            ObjectIdentity emptyIdentity = new ObjectIdentity(DefaultRepository);
            DataObject     parentDO      = new DataObject(emptyIdentity);

            parentDO.Type = "dm_document";
            PropertySet parentProperties = new PropertySet();

            parentProperties.Set("object_name", SampleContentManager.testVdmObjectName);
            parentDO.Properties = parentProperties;

            // link into a folder
            ObjectPath            objectPath               = new ObjectPath(SampleContentManager.sourcePath);
            ObjectIdentity        sampleFolderIdentity     = new ObjectIdentity(objectPath, DefaultRepository);
            ReferenceRelationship sampleFolderRelationship = new ReferenceRelationship();

            sampleFolderRelationship.Name       = Relationship.RELATIONSHIP_FOLDER;
            sampleFolderRelationship.Target     = sampleFolderIdentity;
            sampleFolderRelationship.TargetRole = Relationship.ROLE_PARENT;
            parentDO.Relationships.Add(sampleFolderRelationship);

            // get id of document to use for first child node
            ObjectIdentity child0Id = new ObjectIdentity();

            child0Id.RepositoryName = DefaultRepository;
            child0Id.Value          = new Qualification(SampleContentManager.gifImageQualString);

            // get id of document to use for second child node
            ObjectIdentity child1Id = new ObjectIdentity();

            child1Id.RepositoryName = DefaultRepository;
            child1Id.Value          = new Qualification(SampleContentManager.gifImage1QualString);

            ObjectIdentitySet childNodes = new ObjectIdentitySet();

            childNodes.AddIdentity(child0Id);
            childNodes.AddIdentity(child1Id);

            virtualDocumentServiceDemo.AddChildNodes(parentDO, childNodes);
        }
Example #32
0
        public DataObject GetObjectFilterRelationsParentOnly(ObjectIdentity objIdentity)
        {
            // set up relation profile to return only immediate parent
            RelationshipProfile relationProfile = new RelationshipProfile();

            relationProfile.ResultDataMode   = ResultDataMode.REFERENCE;
            relationProfile.TargetRoleFilter = TargetRoleFilter.SPECIFIED;
            relationProfile.TargetRole       = Relationship.ROLE_PARENT;
            relationProfile.NameFilter       = RelationshipNameFilter.ANY;
            relationProfile.DepthFilter      = DepthFilter.SPECIFIED;
            relationProfile.Depth            = 1;
            OperationOptions operationOptions = new OperationOptions();

            operationOptions.RelationshipProfile = relationProfile;

            ObjectIdentitySet objectIdSet = new ObjectIdentitySet(objIdentity);

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

            return(dataPackage.DataObjects[0]);
        }
Example #33
0
        /// <summary>
        /// Restituisce i folders ai quali l'oggetto è linkato (direttamente).
        /// In realtà sembra che DFS60sp1 abbia un bug: non posso imporre nessuna limitazione
        /// nella query per le relationship, quindi per il momento vengono resituite tutte
        /// TODO: cercare solo le relazioni dirette e di tipo "folder"
        /// </summary>
        /// <param name="objSrvc"></param>
        /// <param name="documentIdentity"></param>
        /// <returns></returns>
        public static DataObject getParentFolders(IObjectService objSrvc, ObjectIdentity documentIdentity)
        {
            //TODO: bug di DFS60sp1:
            // se specifico che voglio solo le relazioni parent non funziona
            // devo chiedere tutte le relazioni

            RelationshipProfile relationProfile = new RelationshipProfile();

            relationProfile.ResultDataMode   = ResultDataMode.REFERENCE;
            relationProfile.TargetRoleFilter = TargetRoleFilter.ANY;
            relationProfile.NameFilter       = RelationshipNameFilter.ANY;
            relationProfile.DepthFilter      = DepthFilter.UNLIMITED;
            OperationOptions operationOptions = new OperationOptions();

            operationOptions.RelationshipProfile = relationProfile;

            ObjectIdentitySet objectIdSet = new ObjectIdentitySet(documentIdentity);
            DataPackage       pkg         = objSrvc.Get(objectIdSet, operationOptions);

            return(pkg.DataObjects[0]);
        }
        public void DeleteTestCabinet(String repository)
        {
            if (!isDataCleanedUp)
            {
                Console.WriteLine("Test cabinet, folders, and sample images will not be deleted because SampleContentManager.isDataCleanedUp = false");
                return;
            }
            DeleteProfile deleteProfile = new DeleteProfile();
            deleteProfile.IsDeepDeleteFolders = true;
            deleteProfile.IsDeepDeleteChildrenInFolders = true;
            OperationOptions operationOptions = new OperationOptions();
            operationOptions.DeleteProfile = deleteProfile;

            ObjectPath objectPath = new ObjectPath(testCabinetPath);
            ObjectIdentity sampleCabinetIdentity = new ObjectIdentity(objectPath, repository);
            ObjectIdentitySet objIdSet = new ObjectIdentitySet();
            objIdSet.AddIdentity(sampleCabinetIdentity);

            objectService.Delete(objIdSet, operationOptions);
            Console.WriteLine("Deleted test cabinet " + testCabinetPath + " on " + repository);
        }
 public void ShowLifecycleInfo(ObjectIdentity objectIdentity)
 {
     ObjectIdentitySet objIdSet = new ObjectIdentitySet(objectIdentity);
     List<LifecycleInfo> lcInfoList = lifecycleService.GetLifecycle(objIdSet, null);
     LifecycleInfo lcInfo = lcInfoList[0];
     // if no lifecycle is attached, the policyId will have the null id
     if (lcInfo.PolicyId.GetValueAsString().Equals("0000000000000000"))
     {
         Console.WriteLine("No lifecycle attached to object.");
     }
     else
     {
         Console.WriteLine("Lifecycle name is " + lcInfo.PolicyName);
         Console.WriteLine("Current state is " + lcInfo.StateName);
         Console.WriteLine("Available operations are:");
         foreach (LifecycleOperation lcOperation in lcInfo.EnabledOperations)
         {
             Console.WriteLine("    " + lcOperation.Name);
         }
     }
 }
Example #36
0
        public FileInfo GetObjectWithUrl(ObjectIdentity objIdentity)
        {
            objIdentity.RepositoryName = this.DefaultRepository;
            ObjectIdentitySet     objectIdSet = new ObjectIdentitySet();
            List <ObjectIdentity> objIdList   = objectIdSet.Identities;

            objIdList.Add(objIdentity);
            List <ObjectContentSet> urlList          = objectService.GetObjectContentUrls(objectIdSet);
            ObjectContentSet        objectContentSet = (ObjectContentSet)urlList[0];
            UrlContent urlContent = (UrlContent)objectContentSet.Contents[0];

            if (urlContent.CanGetAsFile())
            {
                // downloads the file using the ACS URL
                FileInfo file = urlContent.GetAsFile();
                Console.WriteLine("File exists: " + file.Exists);
                Console.WriteLine("File full name: " + file.FullName);
                return(file);
            }
            return(null);
        }
Example #37
0
        public DataObject GetObjectFilterPropertiesExclude(ObjectIdentity objIdentity)
        {
            PropertyProfile propertyProfile = new PropertyProfile();

            propertyProfile.FilterMode = PropertyFilterMode.SPECIFIED_BY_EXCLUDE;
            List <string> excludeProperties = new List <string>();

            excludeProperties.Add("title");
            excludeProperties.Add("object_name");
            excludeProperties.Add("r_object_type");
            Console.WriteLine("Explicitly filtering all properties by excluding title, object_name, r_object_type.");
            propertyProfile.ExcludeProperties = excludeProperties;
            OperationOptions operationOptions = new OperationOptions();

            operationOptions.PropertyProfile = propertyProfile;

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

            return(dataPackage.DataObjects[0]);
        }
Example #38
0
        public void ObjServiceCopyWithMods(String sourceObjectPathString,
                                           String targetLocPathString)
        {
            // identify the object to copy
            ObjectPath     objPath   = new ObjectPath(sourceObjectPathString);
            ObjectIdentity docToCopy = new ObjectIdentity();

            docToCopy.Value          = objPath;
            docToCopy.RepositoryName = DefaultRepository;

            // identify the folder to copy to
            ObjectPath folderPath = new ObjectPath();

            folderPath.Path = targetLocPathString;
            ObjectIdentity toFolderIdentity = new ObjectIdentity();

            toFolderIdentity.Value          = folderPath;
            toFolderIdentity.RepositoryName = DefaultRepository;
            ObjectLocation toLocation = new ObjectLocation();

            toLocation.Identity = toFolderIdentity;

            // specify changes to make when copying
            DataObject modDataObject = new DataObject(docToCopy);

            modDataObject.Type = "dm_document";
            PropertySet modProperties = modDataObject.Properties;
            String      newObjectName = "copiedDocument-" + System.DateTime.Now.Ticks;

            modProperties.Set("object_name", newObjectName);
            Console.WriteLine("Modified object by changing object name to " + newObjectName);
            DataPackage dataPackage = new DataPackage(modDataObject);

            ObjectIdentitySet objIdSet = new ObjectIdentitySet();

            objIdSet.Identities.Add(docToCopy);
            OperationOptions operationOptions = null;

            objectService.Copy(objIdSet, toLocation, dataPackage, operationOptions);
        }
        public void ShowObjectIdentitySet()
    {
        String repName = "MyRepositoryName";
        ObjectIdentitySet objIdSet = new ObjectIdentitySet();
        ObjectIdentity[] objectIdentities = new ObjectIdentity[4];

        // add some ObjectIdentity instances
        ObjectId objId = new ObjectId("090007d280075180");
        objIdSet.AddIdentity(new ObjectIdentity(objId, repName));

        Qualification qualification = new Qualification("dm_document where object_name = 'bl_upwind.gif'");
        objIdSet.AddIdentity(new ObjectIdentity(qualification, repName));

        ObjectPath objPath = new ObjectPath("/testCabinet/testFolder/testDoc");
        objIdSet.AddIdentity(new ObjectIdentity(objPath, repName));

        // walk through and see what we have
        IEnumerator<ObjectIdentity> identityEnumerator = objIdSet.Identities.GetEnumerator();
        while (identityEnumerator.MoveNext())
        {
            Console.WriteLine("Object Identity: " + identityEnumerator.Current);
        }
    }
        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'");
        }
        public void VersionInfoDemoQual(String nonCurrentQual)
        {
            Qualification qual = new Qualification(nonCurrentQual);
            ObjectIdentity objIdentity = new ObjectIdentity();
            objIdentity.Value = qual;
            objIdentity.RepositoryName = DefaultRepository;
            ObjectIdentitySet objIdSet = new ObjectIdentitySet();
            objIdSet.Identities.Add(objIdentity);

            List<VersionInfo> vInfo = versionControlService.GetVersionInfo(objIdSet);
            VersionInfo versionInfo = vInfo[0];

            Console.WriteLine("Printing version info for " + versionInfo.Identity);
            Console.WriteLine("isCurrent is " + versionInfo.IsCurrent);
            Console.WriteLine("Version is " + versionInfo.Version);

            Console.WriteLine("Symbolic labels are: ");
            foreach (string label in versionInfo.SymbolicLabels)
            {
                Console.WriteLine(label);
            }
        }
        public void DeleteAllVersionsDemoQual()
        {
            string nonCurrentQual = "dm_document (ALL) " +
                                    "where object_name = 'DFS_sample_image' " +
                                    "and ANY r_version_label = 'test_version'";
            Qualification qual = new Qualification(nonCurrentQual);
            ObjectIdentity objIdentity = new ObjectIdentity();
            objIdentity.Value = qual;
            objIdentity.RepositoryName = DefaultRepository;
            ObjectIdentitySet objIdSet = new ObjectIdentitySet();
            objIdSet.Identities.Add(objIdentity);

            versionControlService.DeleteAllVersions(objIdSet);
        }
Example #43
0
        private DataPackage GetSingle(ObjectIdentitySet objectIdSet, OperationOptions operationOptions)
        {
            try
            {
                return dfsContext.ObjectService.Get(objectIdSet, operationOptions);
            }
            catch (FaultException<SerializableException> ex)
            {
                if (ex.Message.Contains("There is no object in repository with id"))
                {
                    throw new InvalidOperationException("No matching objects found.", ex);
                }
                if (ex.Message.Contains("multiple objects qualify"))
                {
                    throw new InvalidOperationException("Found more than one matching object", ex);
                }

                throw;
            }
        }
 public DataObject GetObjectFilterProperties(ObjectIdentity objIdentity)
 {
     PropertyProfile propertyProfile = new PropertyProfile();
     propertyProfile.FilterMode = PropertyFilterMode.ALL_NON_SYSTEM;
     OperationOptions operationOptions = new OperationOptions();
     operationOptions.PropertyProfile = propertyProfile;
     ObjectIdentitySet objectIdSet = new ObjectIdentitySet(objIdentity);
     DataPackage dataPackage = objectService.Get(objectIdSet, operationOptions);
     return dataPackage.DataObjects[0];
 }
        public DataObject GetObjectFilterPropertiesExclude(ObjectIdentity objIdentity)
        {
            PropertyProfile propertyProfile = new PropertyProfile();
            propertyProfile.FilterMode = PropertyFilterMode.SPECIFIED_BY_EXCLUDE;
            List<string> excludeProperties = new List<string>();
            excludeProperties.Add("title");
            excludeProperties.Add("object_name");
            excludeProperties.Add("r_object_type");
            Console.WriteLine("Explicitly filtering all properties by excluding title, object_name, r_object_type.");
            propertyProfile.ExcludeProperties = excludeProperties;
            OperationOptions operationOptions = new OperationOptions();
            operationOptions.PropertyProfile = propertyProfile;

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

            return dataPackage.DataObjects[0];
        }
Example #46
0
 private ObjectIdentitySet CreateObjectIdentitySet(object objectForIdentity)
 {
     var objIdentity = new ObjectIdentity(objectForIdentity, dfsConfiguration.Repository);
     var objectIdSet = new ObjectIdentitySet();
     objectIdSet.Identities.Add(objIdentity);
     return objectIdSet;
 }
        public void CancelCheckout(ObjectIdentity objIdentity)
        {
            ObjectIdentitySet objIdSet = new ObjectIdentitySet();
            objIdSet.Identities.Add(objIdentity);

            versionControlService.CancelCheckout(objIdSet);
            Console.WriteLine("Checkout cancelled.");
        }
        public void DeleteVersionDemo(ObjectIdentity objIdentity)
        {
            ObjectIdentitySet objIdSet = new ObjectIdentitySet();
            objIdSet.Identities.Add(objIdentity);

            versionControlService.DeleteVersion(objIdSet);
        }
        public DataObject GetObjectWithDefaults(ObjectIdentity objIdentity)
        {
            objIdentity.RepositoryName = DefaultRepository;
            ObjectIdentitySet objectIdSet = new ObjectIdentitySet();
            List<ObjectIdentity> objIdList = objectIdSet.Identities;
            objIdList.Add(objIdentity);

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

            return dataPackage.DataObjects[0];
        }
        public void ObjServiceCopyWithMods(String sourceObjectPathString,
                                      String targetLocPathString)
        {
            // identify the object to copy
            ObjectPath objPath = new ObjectPath(sourceObjectPathString);
            ObjectIdentity docToCopy = new ObjectIdentity();
            docToCopy.Value = objPath;
            docToCopy.RepositoryName = DefaultRepository;

            // identify the folder to copy to
            ObjectPath folderPath = new ObjectPath();
            folderPath.Path = targetLocPathString;
            ObjectIdentity toFolderIdentity = new ObjectIdentity();
            toFolderIdentity.Value = folderPath;
            toFolderIdentity.RepositoryName = DefaultRepository;
            ObjectLocation toLocation = new ObjectLocation();
            toLocation.Identity = toFolderIdentity;

            // specify changes to make when copying
            DataObject modDataObject = new DataObject(docToCopy);
            modDataObject.Type = "dm_document";
            PropertySet modProperties = modDataObject.Properties;
            String newObjectName = "copiedDocument-" + System.DateTime.Now.Ticks;
            modProperties.Set("object_name", newObjectName);
            Console.WriteLine("Modified object by changing object name to " + newObjectName); 
            DataPackage dataPackage = new DataPackage(modDataObject);

            ObjectIdentitySet objIdSet = new ObjectIdentitySet();
            objIdSet.Identities.Add(docToCopy);
            OperationOptions operationOptions = null;
            objectService.Copy(objIdSet, toLocation, dataPackage, operationOptions);
        }
        public void ObjServiceDelete(String path)
        {
            ObjectPath docPath = new ObjectPath(path);
            ObjectIdentity objIdentity = new ObjectIdentity();
            objIdentity.Value = docPath;
            objIdentity.RepositoryName = DefaultRepository;
            ObjectIdentitySet objectIdSet = new ObjectIdentitySet(objIdentity);

            DeleteProfile deleteProfile = new DeleteProfile();
            deleteProfile.IsDeepDeleteFolders = true;
            deleteProfile.IsDeepDeleteChildrenInFolders = true;
            OperationOptions operationOptions = new OperationOptions();
            operationOptions.DeleteProfile = deleteProfile;

            objectService.Delete(objectIdSet, operationOptions);
        }
        public DataObject GetCurrentDemo(ObjectIdentity objIdentity)
        {
            ObjectIdentitySet objIdSet = new ObjectIdentitySet();
            objIdSet.Identities.Add(objIdentity);

            OperationOptions operationOptions = null;
            DataPackage resultDataPackage = versionControlService.GetCurrent(objIdSet, operationOptions);
            return resultDataPackage.DataObjects[0];
        }
 public FileInfo GetObjectWithUrl(ObjectIdentity objIdentity)
 {
     objIdentity.RepositoryName = this.DefaultRepository;
     ObjectIdentitySet objectIdSet = new ObjectIdentitySet();
     List<ObjectIdentity> objIdList = objectIdSet.Identities;
     objIdList.Add(objIdentity);
     List<ObjectContentSet> urlList = objectService.GetObjectContentUrls(objectIdSet);
     ObjectContentSet objectContentSet = (ObjectContentSet)urlList[0];
     UrlContent urlContent =  (UrlContent)objectContentSet.Contents[0];
     if (urlContent.CanGetAsFile())
     {
         // downloads the file using the ACS URL
         FileInfo file = urlContent.GetAsFile();
         Console.WriteLine("File exists: " + file.Exists);
         Console.WriteLine("File full name: " + file.FullName);
         return file;
     }
     return null;
 }
        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;
        }
        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;
        }
 public void DetachLifecycle(ObjectIdentity objectIdentity)
 {
     ObjectIdentitySet objIdSet = new ObjectIdentitySet(objectIdentity);
     OperationOptions operationOptions = null;
     lifecycleService.Detach(objIdSet, operationOptions);
 }
        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 GetObjectFilterRelationsParentOnly(ObjectIdentity objIdentity)
        {
            // set up relation profile to return only immediate parent
            RelationshipProfile relationProfile = new RelationshipProfile();
            relationProfile.ResultDataMode = ResultDataMode.REFERENCE;
            relationProfile.TargetRoleFilter = TargetRoleFilter.SPECIFIED;
            relationProfile.TargetRole = Relationship.ROLE_PARENT;
            relationProfile.NameFilter = RelationshipNameFilter.ANY;
            relationProfile.DepthFilter = DepthFilter.SPECIFIED;
            relationProfile.Depth = 1;
            OperationOptions operationOptions = new OperationOptions();
            operationOptions.RelationshipProfile = relationProfile;

            ObjectIdentitySet objectIdSet = new ObjectIdentitySet(objIdentity);

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

            return dataPackage.DataObjects[0];
        }
        public DataObject GetWithPermissions(ObjectIdentity objectIdentity)
        {
            PermissionProfile permissionProfile = new PermissionProfile();
            permissionProfile.PermissionTypeFilter = PermissionTypeFilter.ANY;
            OperationOptions operationOptions = new OperationOptions();
            operationOptions.PermissionProfile = permissionProfile;

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

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