///metodo di indagine gestione folder /// public static string checkFolderCompliance(IDMObjects.Library oLibrary) { string folderKey = ""; try { // verifico esistenza folderKey = checkFolder(); if (folderKey != "") { return(folderKey); } else { //devo creare la struttura string yearFolderKey = checkYearFolder(oLibrary); folderKey = checkMonthFolder(oLibrary, yearFolderKey); return(folderKey); } } catch (Exception ex) { logger.Debug("Errore Verifica esistenza Folder:", ex); return(folderKey); } }
internal static IDMObjects.IFnFolderDual getRootFolder(IDMObjects.Library oLibrary) { //string pathName = ConfigurationManager.AppSettings["FNET_pathRootFolder"]; string folderKey = checkFolderCompliance(oLibrary); //return(IDMObjects.IFnFolderDual) oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeFolder,"/"+folderCompliance[3]+"/"+folderCompliance[1],"",null,null); //devi passare la co_key corretta di anno/mese return((IDMObjects.IFnFolderDual)oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeFolder, folderKey, "", null, null)); }
internal static IDMObjects.IFnDocumentDual getDocument(string id, string idamministrazione, string dst) { IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager(); DocsPaDocumentale_FILENET.Documentale.UserManager userManager = new DocsPaDocumentale_FILENET.Documentale.UserManager(); IDMObjects.Library oLibrary = userManager.getFileNETLib(idamministrazione); oLibrary.LogonId = dst; IDMObjects.IFnDocumentDual docFNET = (IDMObjects.IFnDocumentDual)oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeDocument, id, oLibrary, null, null); return(docFNET); }
internal static string createVersionFNET(string nomeFile, ref DocsPaVO.documento.FileRequest fileRequest, string idamministrazione, string dst) { IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager(); try { string path = ConfigurationManager.AppSettings["FNET_pathServer"]; DocsPaDocumentale_FILENET.Documentale.UserManager userManager = new DocsPaDocumentale_FILENET.Documentale.UserManager(); IDMObjects.Library oLibrary = userManager.getFileNETLib(idamministrazione); oLibrary.LogonId = dst; IDMObjects.IFnFolderDual folder = DocumentManagement.getRootFolder(oLibrary); IDMObjects.IFnDocumentDual docFNET = (IDMObjects.IFnDocumentDual)oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeDocument, fileRequest.docNumber, oLibrary, null, null); bool canCheckout = docFNET.GetState(IDMObjects.idmDocState.idmDocCanCheckout); if (canCheckout) { docFNET.Version.CheckoutNoCopy(); } else { throw new Exception("Il file è utilizzato da un altro processo"); } bool canCheckin = docFNET.GetState(IDMObjects.idmDocState.idmDocCanCheckin); docFNET.Version.Checkin(path, nomeFile, IDMObjects.idmCheckin.idmCheckinKeep); IDMObjects.Version vers = docFNET.Version; bool canIndex = docFNET.GetState(IDMObjects.idmDocState.idmDocCanIndex); if (canIndex) { vers.IndexContent(IDMObjects.idmIndex.idmIndexContent); } string numVers = getFNETnumVers(docFNET.Version.Number); //OLD: fileRequest.versionId = numVers + getFNETename(fileRequest.docNumber); fileRequest.fNversionId = numVers + getFNETename(fileRequest.docNumber); return(numVers); } catch (Exception e) { string msg = e.Message; for (int i = 0; i < idmErrorManager.Errors.Count; i++) { msg += " " + idmErrorManager.Errors[i].Description; } throw new Exception(msg); } }
internal void unlock(DocsPaVO.documento.FileRequest fileReq, string idamministrazione) { int numVersione = getNumVers(fileReq.versionId); DocsPaDocumentale_FILENET.Documentale.UserManager userManager = new DocsPaDocumentale_FILENET.Documentale.UserManager(); IDMObjects.Library oLibrary = userManager.getFileNETLib(idamministrazione); IDMObjects.IFnDocumentDual docFNET = (IDMObjects.IFnDocumentDual)oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeDocument, fileReq.docNumber, oLibrary, null, null); bool canCheckin = docFNET.GetState(IDMObjects.idmDocState.idmDocCanCheckin); if (canCheckin) { docFNET.Version.CancelCheckout(IDMObjects.idmCancelCheckout.idmCancelCheckoutNoKeep); } }
internal IDMObjects.Library getFileNETLib(string idamministrazione) { logger.Debug("getFileNETLib"); IDMObjects.Library oLibrary = new IDMObjects.Library(); if (System.Web.HttpContext.Current.Application["SessionManager"] == null) { logger.Debug("prima di add context"); HttpContext.Current.Application.Add("SessionManager", new IDMObjects.SessionManager()); } logger.Debug("prima di set session manager"); oLibrary.SessionManager = (IDMObjects.SessionManager)HttpContext.Current.Application["SessionManager"]; logger.Debug("prima di getlib"); oLibrary.Name = Personalization.getInstance(idamministrazione).getLibrary();; return(oLibrary); }
internal static ArrayList RicercaFT(string testo, string idReg, InfoUtente infoUtente, int numPage, string dst, out int numTotPage, out int nRec) { logger.Debug("RicercaFT"); numTotPage = 0; nRec = 0; ArrayList resultSet = new ArrayList(); DocsPaDocumentale_FILENET.Documentale.UserManager userManager = new DocsPaDocumentale_FILENET.Documentale.UserManager(); IDMObjects.Library oLibrary = userManager.getFileNETLib(infoUtente.idAmministrazione); // oLibrary.LogonId = dst; DocsPaWrapperFilenet.FilenetFullTextClass fullTextClass = new DocsPaWrapperFilenet.FilenetFullTextClass(); Array docNumbers = fullTextClass.RicercaFullText(testo, oLibrary.Name, "Admin", ""); if (docNumbers == null || docNumbers.Length == 0) { return(null); } else { for (int i = 0; i <= docNumbers.Length - 1; i++) { resultSet.Add(Int32.Parse(docNumbers.GetValue(i).ToString())); } } int numDocs = resultSet.Count; string[] resultKey = GetResultKeys(resultSet, numPage, numDocs); resultSet = GetListaDocumenti(resultKey, idReg, infoUtente); numTotPage = (numDocs / PAGE_SIZE); if (numTotPage * PAGE_SIZE < numDocs) { numTotPage++; } nRec = numDocs; return(resultSet); }
private static string checkMonthFolder(IDMObjects.Library oLibrary, string yearFolderKey) { string infoFolder = ""; DocsPaDB.DBProvider dbProvider = new DocsPaDB.DBProvider(); try { DocsPaUtils.Query query = DocsPaUtils.InitQuery.getInstance().getQuery("S_FN_GET_MONTH_FOLDER_CUSTOM"); query.setParam("yearFolderKey", yearFolderKey); string commandText = query.getSQL(); System.Diagnostics.Debug.WriteLine("SQL - checkMonthFolderFN - QUERY : " + commandText); DataSet ds = new DataSet(); dbProvider.ExecuteQuery(ds, commandText); if (ds.Tables[0].Rows.Count != 0) { //co_key anno infoFolder = ds.Tables[0].Rows[0][0].ToString(); } else { //la devo creare string month = DateTime.Now.Month.ToString(); //padre IDMObjects.IFnFolderDual folderParent; //figlio IDMObjects.IFnFolderDual folder; //prelevo il folder del padre folderParent = (IDMObjects.IFnFolderDual)oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeFolder, yearFolderKey, "", null, null); // creo il subfolder partendo dal padre folder = folderParent.CreateSubFolder(month, System.Reflection.Missing.Value); folder.SaveNew(IDMObjects.idmSaveNewOptions.idmDocSaveNewNoKeep); infoFolder = folder.ID.ToString(); } return(infoFolder); } catch (Exception ex) { logger.Debug("Errore Verifica esistenza Folder Mese:", ex); return(infoFolder); } finally { dbProvider.Dispose(); } }
internal void remove(DocsPaVO.documento.FileRequest fileReq, string idamministrazione, string versFNET, string dst) { // int numVersione = getNumVers(fileReq.versionId); int numVersione = getNumVers(versFNET); string strNumVersione = getFNETnumVers(numVersione.ToString()); IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager(); DocsPaDocumentale_FILENET.Documentale.UserManager userManager = new DocsPaDocumentale_FILENET.Documentale.UserManager(); IDMObjects.Library oLibrary = userManager.getFileNETLib(idamministrazione); oLibrary.LogonId = dst; IDMObjects.IFnDocumentDual docFNET = (IDMObjects.IFnDocumentDual)oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeDocument, fileReq.docNumber, oLibrary, null, null); IDMObjects.IFnDocumentDual verFNET = (IDMObjects.IFnDocumentDual)oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeDocument, fileReq.docNumber + ":" + strNumVersione, oLibrary, null, null); try { //TODO: 04/06/2007 (A.B.) //attualmente viene de-indicizzato il file acquisito sulla versione e/o allegato // non viene ne eliminata la versione Filenet ne eliminato il file vero è proprio //in quanto se rimosso viene messo off line la versione e nascono problemi //per eventuali versioni successive. docFNET.Version.IndexContent(IDMObjects.idmIndex.idmIndexContentDeindex); #region testing filenet //docFNET.Version.Series.Remove(numVersione); //docFNET.Version.Archive(IDMObjects.idmArchive.idmArchiveDispose); //string ArchivioFile = DocsPaDocumentale_FILENET.FilenetLib.DocumentManagement.checkFolderCompliance(oLibrary); //verFNET.Version.ArchiveEx(String.Empty); //removeVers(fileReq.versionId); //removeVers(versFNET); //docFNET.Version.Archive(IDMObjects.idmArchive.idmArchiveDispose); #endregion } catch (Exception e) { string msg = e.Message; for (int i = 0; i < idmErrorManager.Errors.Count; i++) { msg += " " + idmErrorManager.Errors[i].Description; } throw new Exception(msg); } }
public void logoutToFilenet(string dst) { IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager(); try { IDMObjects.Library oLibrary = getLibrary(dst); oLibrary.Logoff(); } catch (Exception e) { string msg = e.Message; logger.Debug("msg errore in logout = " + msg); for (int i = 1; i < idmErrorManager.Errors.Count; i++) { msg += " " + idmErrorManager.Errors[i].Description; } throw new Exception(msg); } }
public bool AddUserFilenet(string userID, string userPwd, string idAmministrazione, string userFullName, string userDefaultGroup) { string dst = ""; UserManager userManager = null; IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager(); try { userManager = new UserManager(); IDMObjects.Library oLibrary = userManager.getFileNETLib(idAmministrazione); string ArchivioFile = DocsPaDocumentale_FILENET.FilenetLib.DocumentManagement.checkFolderCompliance(oLibrary); DocsPaDB.Query_DocsPAWS.Utenti userFilenet = new DocsPaDB.Query_DocsPAWS.Utenti(); if (!userFilenet.AddUserFilenet(userID, userDefaultGroup, ArchivioFile, userFullName)) { throw new Exception("Errore durante l'inserimento utente Filenet: " + userID); } bool result = oLibrary.Logon(userID, "", "Administrators", IDMObjects.idmLibraryLogon.idmLogonOptNoUI); oLibrary.ChangePassword("", userPwd, IDMObjects.idmPasswordOptions.idmPasswordNoUI, userID); dst = oLibrary.LogonId.ToString(); return(true); } catch (Exception e) { string msg = e.Message; logger.Debug("msg errore in AddUserFilenet = " + msg); for (int i = 1; i < idmErrorManager.Errors.Count; i++) { msg += " " + idmErrorManager.Errors[i].Description; } throw new Exception(msg); } finally { if (dst.Length > 0) { userManager.logoutToFilenet(dst); } } }
public static bool RemoveDocument(string docnumber, string idamministrazione) { try { IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager(); DocsPaDocumentale_FILENET.Documentale.UserManager userManager = new DocsPaDocumentale_FILENET.Documentale.UserManager(); IDMObjects.Library oLibrary = userManager.getFileNETLib(idamministrazione); IDMObjects.IFnDocumentDual docFNET = (IDMObjects.IFnDocumentDual)oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeDocument, docnumber, oLibrary, null, null); if (docFNET != null) { docFNET.Delete(); } return(true); } catch (Exception exception) { logger.Debug("Errore durante la rimozione del documento.", exception); return(false); } }
public bool ChangeUserFilenetPassword(string username, string oldpwd, string newPwd, string idAmministrazione) { bool changed = false; string dst = string.Empty; IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager(); try { IDMObjects.Library oLibrary = this.getFileNETLib(idAmministrazione); DocsPaDB.Query_DocsPAWS.Utenti userFilenet = new DocsPaDB.Query_DocsPAWS.Utenti(); bool result = oLibrary.Logon(username, oldpwd, "Administrators", IDMObjects.idmLibraryLogon.idmLogonOptNoUI); oLibrary.ChangePassword(oldpwd, newPwd, IDMObjects.idmPasswordOptions.idmPasswordNoUI, username); dst = oLibrary.LogonId.ToString(); changed = true; } catch (Exception e) { string msg = e.Message; logger.Debug("msg errore in UpdateUserFilenet = " + msg); for (int i = 1; i < idmErrorManager.Errors.Count; i++) { msg += " " + idmErrorManager.Errors[i].Description; } throw new Exception(msg); } finally { if (!string.IsNullOrEmpty(dst)) { this.logoutToFilenet(dst); } } return(changed); }
private static string checkYearFolder(IDMObjects.Library oLibrary) { string infoFolder = ""; DocsPaDB.DBProvider dbProvider = new DocsPaDB.DBProvider(); try { DocsPaUtils.Query query = DocsPaUtils.InitQuery.getInstance().getQuery("S_FN_GET_YEAR_FOLDER_CUSTOM"); string commandText = query.getSQL(); System.Diagnostics.Debug.WriteLine("SQL - checkYearFolderFN - QUERY : " + commandText); DataSet ds = new DataSet(); dbProvider.ExecuteQuery(ds, commandText); if (ds.Tables[0].Rows.Count != 0) { //co_key anno infoFolder = ds.Tables[0].Rows[0][0].ToString(); } else { // la devo creare string year = DateTime.Now.Year.ToString(); IDMObjects.IFnFolderDual folder; folder = (IDMObjects.IFnFolderDual)oLibrary.CreateObject(IDMObjects.idmObjectType.idmObjTypeFolder, "", System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value); folder.Name = year; folder.SaveNew(IDMObjects.idmSaveNewOptions.idmDocSaveNewNoKeep); infoFolder = folder.ID.ToString(); } return(infoFolder); } catch (Exception ex) { logger.Debug("Errore Verifica esistenza Folder Anno:", ex); return(infoFolder); } finally { dbProvider.Dispose(); } }
public bool UpdateUserFilenet(string username, string oldpwd, string newPwd, string userfullname, string idamministrazione) { string dst = ""; UserManager userManager = null; IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager(); try { userManager = new UserManager(); IDMObjects.Library oLibrary = userManager.getFileNETLib(idamministrazione); DocsPaDB.Query_DocsPAWS.Utenti userFilenet = new DocsPaDB.Query_DocsPAWS.Utenti(); if (!userFilenet.UpdateUserFilenet(username, userfullname)) { throw new Exception("Errore durante la modifica dell'utente Filenet: " + username); } bool result = oLibrary.Logon(username, oldpwd, "Administrators", IDMObjects.idmLibraryLogon.idmLogonOptNoUI); oLibrary.ChangePassword(oldpwd, newPwd, IDMObjects.idmPasswordOptions.idmPasswordNoUI, username); dst = oLibrary.LogonId.ToString(); return(true); } catch (Exception e) { string msg = e.Message; logger.Debug("msg errore in UpdateUserFilenet = " + msg); for (int i = 1; i < idmErrorManager.Errors.Count; i++) { msg += " " + idmErrorManager.Errors[i].Description; } throw new Exception(msg); } finally { if (dst.Length > 0) { userManager.logoutToFilenet(dst); } } }
internal static IDMObjects.ClassDescription getClassFolder(IDMObjects.Library oLibrary) { return((IDMObjects.ClassDescription)oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeClassDesc, "", IDMObjects.idmObjectType.idmObjTypeFolder, "", "")); }
internal IDMObjects.Library getLibrary(string dst) { IDMObjects.Library oLibrary = new IDMObjects.Library(); oLibrary.LogonId = dst; return(oLibrary); }
internal static IDMObjects.ClassDescription getClassDocument(IDMObjects.Library oLibrary) { return((IDMObjects.ClassDescription)oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeClassDesc, "General", IDMObjects.idmObjectType.idmObjTypeDocument, null, null)); }