コード例 #1
0
        /// <summary>
        /// Modifica dei metadati di un fascicolo
        /// </summary>
        /// <param name="fascicolo"></param>
        /// <param name="refreshAclIfUpdate">
        /// Se true, indica di aggiornare le entries dell'ACL associata al nodo titolario
        /// </param>
        /// <returns></returns>
        public bool ModifyProject(DocsPaVO.fascicolazione.Fascicolo fascicolo, bool refreshAclIfUpdate)
        {
            bool retValue = false;

            try
            {
                // Solo gli attributi del fascicolo procedimentale può essere modificato in documentum
                if (fascicolo.tipo == "P")
                {
                    // Reperimento identity del fascicolo procedimentale
                    ObjectIdentity identity = Dfs4DocsPa.getFascicoloProcedimentaleIdentityById(fascicolo.systemID);

                    DataObject dataObject = new DataObject(identity);

                    // Impostazione proprietà fascicolo
                    dataObject.Properties.Properties.AddRange(Dfs4DocsPa.getFascicoloProcedimentaleProperties(fascicolo));

                    DataPackage dataPackage = new DataPackage(dataObject);

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

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

                    if (retValue)
                    {
                        if (refreshAclIfUpdate)
                        {
                            // Aggiornamento delle entries dell'acl associata al fascicolo
                            this.RefreshAclFascicolo(fascicolo);
                        }

                        logger.Debug(string.Format("Documentum.ModifyProject: modificato fascicolo con id {0}", fascicolo.systemID));
                    }
                }
                else
                {
                    retValue = true;
                }
            }
            catch (Exception ex)
            {
                retValue = false;

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

            return(retValue);
        }
コード例 #2
0
        /// <summary>
        /// Creazione di un nuovo fascicolo in DCTM
        /// </summary>
        /// <remarks>
        ///
        /// PreCondizioni:
        ///     Il fascicolo è stato inserito correttamente in DocsPa
        ///     ed è stato generato un'identificativo univoco
        ///
        /// PostCondizioni:
        ///     Creato un oggetto in Documentum corrispondente all'oggetto
        ///     fascicolo di DocsPa. L'oggetto avrà i metadati del fascicolo
        ///     per la sola consultazione in documentum.
        ///
        /// </remarks>
        /// <param name="classifica"></param>
        /// <param name="fascicolo"></param>
        /// <param name="ruolo"></param>
        /// <param name="enableUfficioReferente"></param>
        /// <returns></returns>
        public bool CreateProject(Classificazione classifica, Fascicolo fascicolo, Ruolo ruolo, bool enableUfficioReferente, out ResultCreazioneFascicolo result)
        {
            logger.Info("BEGIN");
            bool retValue = false;

            result = ResultCreazioneFascicolo.GENERIC_ERROR;

            CustomServices.AclDefinition aclFascicolo = null;

            try
            {
                //fascicolo.systemID  viene SEMPRE valorizzato da ETDOCS; se così non è --> ERRORE
                if (string.IsNullOrEmpty(fascicolo.systemID))
                {
                    logger.Debug("Errore passaggio dati da ETDOCS.");
                }
                else
                {
                    // Reperimento dell'objectidentity relativo al nodo titolario in cui andrà inserito il fascicolo
                    ObjectIdentity nodoTitolarioIdentity = Dfs4DocsPa.getNodoTitolarioIdentity(fascicolo.idClassificazione);

                    // Reperimento properties del fascicolo procedimentale
                    PropertySet props = new PropertySet();
                    props.Properties.AddRange(Dfs4DocsPa.getFascicoloProcedimentaleProperties(fascicolo));

                    // Creazione delle ACL per il fascicolo
                    aclFascicolo = this.CreateAclFascicolo(fascicolo, ruolo);

                    // Associazione delle ACL al fascicolo da creare
                    AclHelper.setAclObjectProperties(props, aclFascicolo);

                    ObjectIdentity identity   = new ObjectIdentity(DctmConfigurations.GetRepositoryName());
                    DataObject     dataObject = new DataObject(identity, ObjectTypes.FASCICOLO_PROCEDIMENTALE);
                    dataObject.Properties = props;
                    dataObject.Relationships.Add(DfsHelper.createParentFolderRelationship(nodoTitolarioIdentity));

                    DataPackage dataPackage = new DataPackage(dataObject);

                    IObjectService objectService = this.GetServiceInstance <IObjectService>(false);
                    dataPackage = objectService.Create(dataPackage, null);

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

                    if (retValue)
                    {
                        result = ResultCreazioneFascicolo.OK;

                        logger.Debug(string.Format("Documentum.CreateProject: creato fascicolo con id {0}", fascicolo.systemID));
                    }
                }
            }
            catch (Exception ex)
            {
                retValue = false;
                result   = ResultCreazioneFascicolo.GENERIC_ERROR;

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

                if (aclFascicolo != null)
                {
                    // Rimozione ACL fascicolo in caso di errore
                    this.DeleteAcl(aclFascicolo);
                }
            }
            logger.Info("END");
            return(retValue);
        }