Beispiel #1
0
        /// <summary>
        /// Modifica dei dati di un folder
        /// </summary>
        /// <param name="folder"></param>
        /// <returns></returns>
        public bool ModifyFolder(DocsPaVO.fascicolazione.Folder folder)
        {
            bool retValue = false;

            try
            {
                // Reperimento identity per il sottofascicolo
                ObjectIdentity identity = Dfs4DocsPa.getSottofascicoloIdentityById(folder.systemID);

                DataObject dataObject = new DataObject(identity, ObjectTypes.SOTTOFASCICOLO);

                // Reperimento properties del sottofascicolo
                dataObject.Properties.Properties.AddRange(Dfs4DocsPa.getSottoFascicoloProperties(folder));

                DataPackage dataPackage = new DataPackage(dataObject);

                IObjectService objectService = this.GetServiceInstance <IObjectService>(true);
                dataPackage = objectService.Update(dataPackage, null);

                retValue = (dataPackage.DataObjects.Count == 1);

                if (retValue)
                {
                    logger.Debug(string.Format("Documentum.ModifyFolder: modificato sottofascicolo con id {0}", folder.systemID));
                }
            }
            catch (Exception ex)
            {
                retValue = false;

                logger.Debug(string.Format("Errore in Documentum.ModifyFolder:\n{0}", ex.ToString()));
            }

            return(retValue);
        }
Beispiel #2
0
        /// <summary>
        /// Creazione nuovo sottofascicolo
        /// </summary>
        /// <param name="folder"></param>
        /// <param name="ruolo"></param>
        /// <param name="result"></param>
        /// <param name="ruoliSuperiori">
        /// Ruoli superiori cui è impostata la visibilità del sottofascicolo
        /// </param>
        /// <returns></returns>
        public bool CreateFolder(DocsPaVO.fascicolazione.Folder folder, DocsPaVO.utente.Ruolo ruolo, out DocsPaVO.fascicolazione.ResultCreazioneFolder result, out DocsPaVO.utente.Ruolo[] ruoliSuperiori)
        {
            bool retValue = false;

            result         = ResultCreazioneFolder.GENERIC_ERROR;
            ruoliSuperiori = null;

            try
            {
                // Recuperare l'ID del padre del folder: dato che la modalità è diversa se il padre
                // è Fascicolo o Sottofascicolo, è necessario verificare la casistica

                // Caso in cui il parent del sottofascicolo è un sottofascicolo stesso
                Qualification qualSottoFascicoloParent = Dfs4DocsPa.getSottofascicoloQualificationById(folder.idParent);
                string        parentId = DfsHelper.getDctmObjectId(this.GetServiceInstance <IQueryService>(false), qualSottoFascicoloParent);

                if (string.IsNullOrEmpty(parentId))
                {
                    // Caso in cui il parent del sottofascicolo è un fascicolo stesso
                    qualSottoFascicoloParent = Dfs4DocsPa.getFascicoloQualificationById(folder.idFascicolo);
                    parentId = DfsHelper.getDctmObjectId(this.GetServiceInstance <IQueryService>(false), qualSottoFascicoloParent);
                }

                if (!string.IsNullOrEmpty(parentId))
                {
                    ObjectIdentity parentIdentity = new ObjectIdentity(new ObjectId(parentId), DctmConfigurations.GetRepositoryName());

                    ObjectIdentity identity   = new ObjectIdentity(DctmConfigurations.GetRepositoryName());
                    DataObject     dataObject = new DataObject(identity, ObjectTypes.SOTTOFASCICOLO);
                    dataObject.Properties.Properties.AddRange(Dfs4DocsPa.getSottoFascicoloProperties(folder));
                    dataObject.Relationships.Add(DfsHelper.createParentFolderRelationship(parentIdentity));

                    // Reperimento ACL del fascicolo di appartenenza e associazione al sottofascicolo
                    CustomServices.AclDefinition aclDefinition = this.GetAclDefinitionSottoFascicolo(folder);
                    AclHelper.setAclObjectProperties(dataObject.Properties, aclDefinition);

                    DataPackage dataPackage = new DataPackage(dataObject);
                    dataPackage = this.GetServiceInstance <IObjectService>(false).Create(dataPackage, null);

                    retValue = (dataPackage.DataObjects.Count == 1);

                    if (retValue)
                    {
                        result = ResultCreazioneFolder.OK;

                        logger.Debug(string.Format("Documentum.CreateFolder: creato sottofascicolo con id {0}", folder.systemID));
                    }
                }
                else
                {
                    throw new ApplicationException(string.Format("Non è stato possibile reperire l'oggetto parent per il folder con id '{0}'", folder.systemID));
                }
            }
            catch (Exception ex)
            {
                retValue = false;

                logger.Debug(string.Format("Errore in Documentum.CreateFolder:\n{0}", ex.ToString()));
            }

            return(retValue);
        }