Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }