コード例 #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ifc">Content interface object</param>
 /// <param name="dv">Internal document version object</param>
 /// <param name="sord">Sord object</param>
 /// <param name="type">Version type</param>
 public FWDocVersion(FWContentInterface ifc, DocVersion dv, FWSord sord, FWDocVersionType type)
     : base(ifc)
 {
     this.typeVal = type;
     this.dvVal   = dv;
     this.sord    = sord;
     updateInternalData(false);
 }
コード例 #2
0
        /// <summary>
        /// Move this object from the current parent folder given in source to the destination folder.
        /// </summary>
        /// <param name="source">Source folder, can be null in which case the main parent folder is used.</param>
        /// <param name="destination">Destination folder.</param>
        public void Move(FWSord source, FWSord destination)
        {
            string sourceId = (source != null) ? source.Id.ToString() : null;

            Conn.Ix.refSord(sourceId, destination.Id.ToString(), Id.ToString(), -1);
            Refresh();
            source.Refresh();
            destination.Refresh();
        }
コード例 #3
0
        /// <summary>
        /// Try to read a document object.
        /// </summary>
        /// <remarks>This function calls internally <see cref="TryGetSord"/>.
        /// An Exception is thrown, if the returned object is not a document object.</remarks>
        /// <param name="objId"><see cref="TryGetSord"/></param>
        /// <param name="accessMode"><see cref="TryGetSord"/></param>
        /// <param name="docAction">DocAction. If set to <c>DocAction.EditDocument</c> and AccessModes.Lock, the document will copied to the checkout-directory.</param>
        /// <returns><see cref="TryGetSord"/></returns>
        /// <exception>IOException: <see cref="TryGetSord"/></exception>
        /// <exception>InvalidOperationException: object is not a document.</exception>
        public virtual FWDocument TryGetDocument(string objId, FWAccessModes accessMode, DocAction docAction)
        {
            FWSord xsord = TryGetSord(objId, accessMode);

            if (xsord != null)
            {
                if (!(xsord is FWDocument))
                {
                    throw new InvalidOperationException("Object " + objId + " is not a document.");
                }
            }
            return((FWDocument)xsord);
        }
コード例 #4
0
        /// <summary>
        /// Try to read a folder object.
        /// </summary>
        /// <remarks>This function calls internally <see cref="TryGetSord"/>.
        /// An Exception is thrown, if the returned object is not a folder object.</remarks>
        /// <param name="objId"><see cref="TryGetSord"/></param>
        /// <param name="accessMode"><see cref="TryGetSord"/></param>
        /// <returns><see cref="TryGetSord"/></returns>
        /// <exception>IOException: <see cref="TryGetSord"/></exception>
        /// <exception>InvalidOperationException: object is not a folder.</exception>
        public virtual FWFolder TryGetFolder(String objId, FWAccessModes accessMode)
        {
            FWSord xsord = TryGetSord(objId, accessMode);

            if (xsord != null)
            {
                if (!(xsord is FWFolder))
                {
                    throw new InvalidOperationException("Object " + objId + " is not a folder.");
                }
            }
            return((FWFolder)xsord);
        }
コード例 #5
0
ファイル: FWDocVersions.cs プロジェクト: ThomasEcherer/elo
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ifc">Content interface object</param>
 /// <param name="dvs">DocVersion objects from IndexServer API</param>
 /// <param name="sord">Sord object from IndexServer API</param>
 /// <param name="type">Type of versions</param>
 public FWDocVersions(FWContentInterface ifc, DocVersion[] dvs, FWSord sord, FWDocVersionType type)
     : base(ifc)
 {
     this.docs = new List <FWDocVersion>(dvs != null ? dvs.Length : 0);
     if (dvs != null)
     {
         foreach (DocVersion v in dvs)
         {
             InternalAdd(v);
         }
     }
     this.typeVal = type;
     this.sord    = sord;
 }
コード例 #6
0
 internal MyAclItems(FWSord sord)
     : base(sord.Conn)
 {
     this._sord = sord;
 }
コード例 #7
0
 internal MyObjKeys(FWSord sord) : base(sord.Conn, sord.Core.mask.ToString())
 {
     _sord = sord;
 }
コード例 #8
0
 /// <summary>
 /// Create a logical copy (reference) of this in the folder given by destination.
 /// </summary>
 /// <param name="destination">A reference is created in this folder.</param>
 public void Copy(FWSord destination)
 {
     Conn.Ix.refSord(null, destination.Id.ToString(), Id.ToString(), -1);
     destination.Refresh();
 }
コード例 #9
0
 /// <summary>
 /// Create a FWDocVersions object.
 /// </summary>
 /// <param name="docs">Array of DocVersion objects</param>
 /// <param name="sord">Sord object.</param>
 /// <param name="type">Type of version object: version, attachment, etc.</param>
 /// <returns>FWDocVersions object</returns>
 public virtual FWDocVersions NewDocVersions(DocVersion[] docs, FWSord sord, FWDocVersionType type)
 {
     return(new FWDocVersions(ifc, docs, sord, type));
 }
コード例 #10
0
 /// <summary>
 /// Create new FWDocVersion object.
 /// </summary>
 /// <param name="dv">DocVersion object</param>
 /// <param name="sord">Sord object.</param>
 /// <param name="type">Type of version object: version, attachment, etc.</param>
 /// <returns>FWDocVersion object</returns>
 public virtual FWDocVersion NewDocVersion(DocVersion dv, FWSord sord, FWDocVersionType type)
 {
     return(new FWDocVersion(ifc, dv, sord, type));
 }
コード例 #11
0
        /// <summary>
        /// Try to read a Sord object.
        /// </summary>
        /// <param name="objId">Object ID</param>
        /// <param name="accessMode">A combination of the FWAccessMode constants.</param>
        /// <param name="docAction">DocAction.
        /// If the Sord object is a <c>FWDocument</c> and the parameter is set to <c>DocAction.EditDocument</c> and FWAccessMode.Lock is set, the document will copied to the checkout-directory.
        /// Th eparameter will be ignored, if the Sord object is a <c>FWFolder</c>.
        /// </param>
        /// <returns>Sord object or null, if the object does not exist and accessMode does not include MustExist.</returns>
        /// <exception>IOException: object already locked, access denied, etc.</exception>
        public virtual FWSord TryGetSord(string objId, FWAccessModes accessMode, DocAction docAction)
        {
            FWSord xsord = null;

            bool   exceptionOccured = false;
            FWSord tmpSord          = null;

            try
            {
                //GetSord(objId);
                LockZ lockZ = FWLockMode.MakeLockZ(FWAccessModes.MustExist);
                Sord  sord  = Conn.Ix.checkoutDoc(objId, null, EditZ, lockZ).sord;
                sord.changedMembers = EditZ.bset;
                if (sord.id == 1 || sord.type < SordC.LBT_DOCUMENT)
                {
                    tmpSord = ClassFactory.NewFolder(sord);
                }
                else
                {
                    tmpSord = ClassFactory.NewDocument(sord);
                }
            }
            catch (Exception e)
            {
                exceptionOccured = true;
                if ((accessMode & FWAccessModes.MustExist) != 0)
                {
                    throw e;
                }
                if (e.Message.IndexOf("[ELOIX:" + IXExceptionC.NOT_FOUND) < 0)
                {
                    throw e;
                }
            }

            if (tmpSord != null && tmpSord.IsDocument() && docAction == DocAction.EditDocument)
            {
                CheckoutResult result = checkedOutDocumentsManagerVal.Checkout(tmpSord as FWDocument);
                if (result.Success)
                {
                    xsord = result.FWDocument;
                }
            }
            else if (!exceptionOccured)
            {
                try
                {
                    LockZ lockZ = FWLockMode.MakeLockZ(accessMode);

                    Sord sord = Conn.Ix.checkoutDoc(objId, null, EditZ, lockZ).sord;
                    sord.changedMembers = EditZ.bset;
                    if (sord.id == 1 || sord.type < SordC.LBT_DOCUMENT)
                    {
                        xsord = ClassFactory.NewFolder(sord);
                    }
                    else
                    {
                        xsord = ClassFactory.NewDocument(sord);
                    }
                }
                catch (Exception e)
                {
                    if ((accessMode & FWAccessModes.MustExist) != 0)
                    {
                        throw e;
                    }
                    if (e.Message.IndexOf("[ELOIX:" + IXExceptionC.NOT_FOUND) < 0)
                    {
                        throw e;
                    }
                }
            }
            return(xsord);
        }