コード例 #1
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
            {
                long idOCS = OCSDocumentHelper.getDocumentIdOCS(checkOutStatus.DocumentNumber, null, OCSUtils.getApplicationUserCredentials());

                CorteContentServices.ItemIdRequestType requestId = new DocsPaDocumentale_OCS.CorteContentServices.ItemIdRequestType();
                requestId.userCredentials = OCSServices.OCSUtils.getApplicationUserCredentials();
                requestId.itemId          = idOCS; // id del documento

                CorteContentServices.ResultType result = this.WsDocumentInstance.UnlockDocument(requestId);

                OCSUtils.throwExceptionIfInvalidResult(result);

                retValue = true;
            }
            catch (Exception ex)
            {
                retValue = false;

                logger.Debug("Errore in OCS.UndoCheckOut", ex);
            }

            return(retValue);
        }
コード例 #2
0
        /// <summary>
        /// Checkout di un documento
        /// </summary>
        /// <param name="checkOutStatus">Metadati relativi allo stato del documento in checkout</param>
        /// <param name="user"></param>
        /// <param name="library"></param>
        /// <returns></returns>
        public bool CheckOut(string idDocument, string documentNumber, string documentLocation, string machineName, out CheckOutStatus checkOutStatus)
        {
            checkOutStatus = null;

            bool retValue = false;

            try
            {
                //Il documento viene messo nello stato LOCK
                long idOCS = OCSDocumentHelper.getDocumentIdOCS(documentNumber, null, OCSUtils.getApplicationUserCredentials());
                CorteContentServices.ItemIdRequestType requestId = new DocsPaDocumentale_OCS.CorteContentServices.ItemIdRequestType();
                CorteContentServices.ResultType        result;
                requestId.userCredentials = OCSServices.OCSUtils.getApplicationUserCredentials();
                requestId.itemId          = idOCS; // id del documento
                result = this.WsDocumentInstance.LockDocument(requestId);

                OCSUtils.throwExceptionIfInvalidResult(result);

                retValue = true;
            }
            catch (Exception ex)
            {
                retValue = false;

                logger.Debug("Errore in OCS.CheckOut", ex);
            }

            return(retValue);
        }
コード例 #3
0
        /// <summary>
        /// Ricerca fulltext nell'oggetto document
        ///
        /// nb: da fare anche ricerca allegati
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public ArrayList FullTextSearch(ref FullTextSearchContext context)
        {
            ArrayList result = new ArrayList();

            try
            {
                List <string> fullTextResult = null;

                if (context.SearchResultList != null && context.SearchResultList.Length > 0)
                {
                    // Ricerca già effettuata, reperimento dall'oggetto di contesto
                    // dei risultati precedenti evitando così una dispendiosa
                    // chiamata al sistema documentale
                    fullTextResult = new List <string>(context.SearchResultList);
                }
                else
                {
                    //esegue la ricerca su OCS
                    CorteContentServices.FilterSearchRequestType searchDocumentRequest = new CorteContentServices.FilterSearchRequestType();
                    //costruisco la stringa di ricerca

                    //inserire i filtri di ricerca
                    //1. il path da cui cercare
                    //2. l'ordinamento
                    //3. solo i documenti del protocollo
                    //4. ...
                    searchDocumentRequest.userCredentials                   = OCSServices.OCSUtils.getUserCredentials(_infoUtente);
                    searchDocumentRequest.filter                            = new CorteContentServices.FilterSearchType();
                    searchDocumentRequest.filter.folderPath                 = OCSConfigurations.GetDocRootFolder();
                    searchDocumentRequest.filter.includeSubFolders          = true;
                    searchDocumentRequest.filter.includeSubFoldersSpecified = true;

                    searchDocumentRequest.filter.sortClause = "CREATE_DATE DESC";
                    // Query execution
                    int startIndex = (context.RequestedPageNumber * PAGE_SIZE) - PAGE_SIZE;
                    int maxResults = this.GetMaxRowCount();
                    searchDocumentRequest.filter.count          = maxResults;
                    searchDocumentRequest.filter.countSpecified = true;
                    //l'indice in OCS parte da 1 e non da 0
                    searchDocumentRequest.filter.offset          = startIndex + 1;
                    searchDocumentRequest.filter.offsetSpecified = true;
                    searchDocumentRequest.filter.searchExpress   = new DocsPaDocumentale_OCS.CorteContentServices.searchExpress(); //TODO: da fare!!!
                    searchDocumentRequest.filter.searchExpress.SearchExprType = new DocsPaDocumentale_OCS.CorteContentServices.SearchExprType();
                    string operatCr1  = "CONTAINS";
                    string rightOpCr1 = context.TextToSearch;

                    searchDocumentRequest.filter.searchExpress.SearchExprType.@operator    = operatCr1;
                    searchDocumentRequest.filter.searchExpress.SearchExprType.rightOperand = rightOpCr1;

                    //SABRINA: provo ad eliminare la catgoria in modo da ottenere tutti i documenti (anche allegati e stampe registro)

                    bool profilezioneDinamica = DocsPaDB.Query_DocsPAWS.Documenti.isEnabledProfilazioneAllegati;
                    if (!profilezioneDinamica)
                    {
                        searchDocumentRequest.filter.searchExpress.SearchExprType.sameLevelOperator = "AND";

                        searchDocumentRequest.filter.searchExpress.SearchExprType.SearchExprType1 = new DocsPaDocumentale_OCS.CorteContentServices.SearchExprType();
                        string operatCr2  = "HAS_CATEGORY";
                        string rightOpCr2 = "[" + DocsPaObjectType.ObjectTypes.CATEGOTY_PROTOCOLLO + "]";

                        searchDocumentRequest.filter.searchExpress.SearchExprType.SearchExprType1.@operator    = operatCr2;
                        searchDocumentRequest.filter.searchExpress.SearchExprType.SearchExprType1.rightOperand = rightOpCr2;
                    }
                    CorteContentServices.ItemSearchListResponseType listResult;
                    listResult = this.WsDocumentInstance.SearchDocuments(searchDocumentRequest);

                    OCSUtils.throwExceptionIfInvalidResult(listResult.result);

                    fullTextResult = new List <string>();

                    foreach (CorteContentServices.ItemSearchType item in listResult.items)
                    {
                        // Reperimento docnumber

                        //NB: momentaneamente ricavo il docNumber dall'oggetto info
                        string docNumber = item.info.name.Substring(0, item.info.name.IndexOf("."));

                        if (!fullTextResult.Contains(docNumber)) // Eliminazione dei risultati duplicati
                        {
                            fullTextResult.Add(docNumber);
                        }
                    }
                }

                // Paginazione dei risultati
                if (fullTextResult != null && fullTextResult.Count > 0)
                {
                    int startIndex = (context.RequestedPageNumber * PAGE_SIZE) - PAGE_SIZE;
                    int count      = PAGE_SIZE;
                    if ((fullTextResult.Count - startIndex) < count)
                    {
                        count = (fullTextResult.Count - startIndex);
                    }

                    result = this.GetDocuments(fullTextResult.GetRange(startIndex, count).ToArray(), InfoUtente);

                    int pageCount = (fullTextResult.Count / PAGE_SIZE);
                    if ((fullTextResult.Count % PAGE_SIZE) > 0)
                    {
                        pageCount++;
                    }

                    context.SearchResultList = fullTextResult.ToArray();
                    context.TotalPageNumber  = pageCount;
                    context.TotalRecordCount = fullTextResult.Count;
                }
            }
            catch (Exception ex)
            {
                result.Clear();
            }

            return(result);
        }