示例#1
0
        /// <summary>
        /// Read the working version of the document and attachment.
        /// </summary>
        protected virtual void readWorkVersion()
        {
            if (haveReadWorkVersion)
            {
                return;
            }
            haveReadWorkVersion = true;

            // Existing object?
            if (sordVal.id >= 0)
            {
                // read versions
                long      editC = EditInfoC.mbDocumentMembers | EditInfoC.mbSignatureMembers | EditInfoC.mbAttachmentMembers;
                EditInfoZ editZ = new EditInfoZ(editC, new SordZ(0));

                EditInfo ed = Conn.Ix.checkoutDoc(sordVal.guid, null, editZ, LockC.NO);

                // object has versions and/or attachments
                if (ed.document != null)
                {
                    // The current working versions might have been set by
                    // a previsious call to Version.File=c:/hello.txt.
                    // Thus do not overwrite the current working versions.

                    FWDocVersion wver = docs.WorkVersion;
                    FWDocVersion watt = atts.WorkVersion;

                    if (ed.document.docs != null && ed.document.docs.Length != 0)
                    {
                        DocVersion dv = ed.document.docs[0];
                        if (wver == null)
                        {
                            // ANPASSUNG
                            if (dv.workVersion)  // <-- Diese Zeile wurde eingefügt
                            {
                                wver = docs.InternalAdd(dv);
                            }
                        }
                        else if (wver.Signature == null)
                        {
                            wver.Signature = ClassFactory.NewDocVersion(dv.sig, this, FWDocVersionType.TYPE_SIGNATURE);
                        }
                    }

                    if (watt == null)
                    {
                        if (ed.document.atts != null && ed.document.atts.Length != 0)
                        {
                            DocVersion dv = ed.document.atts[0];
                            watt = atts.InternalAdd(dv);
                        }
                    }
                }
            }
        }
示例#2
0
        /// <summary>
        /// Read all versions.
        /// </summary>
        /// <returns></returns>
        protected virtual void readAllVersions()
        {
            if (haveReadAll)
            {
                return;
            }
            haveReadAll = true;
            if (sordVal.id < 0)
            {
                return;
            }

            FWDocVersion wdoc = Version;
            FWDocVersion watt = Attachment;

            EditInfoZ editZ = new EditInfoZ(EditInfoC.mbDocumentMembers | EditInfoC.mbAttachmentMembers, new SordZ(0));
            EditInfo  ed    = Conn.Ix.checkoutDoc(sordVal.guid, "-1", editZ, LockC.NO);

            if (ed.document.docs != null)
            {
                foreach (DocVersion dv in ed.document.docs)
                {
                    if (wdoc != null)
                    {
                        if (wdoc.Id == dv.id)
                        {
                            continue;
                        }
                        dv.workVersion = false;
                    }
                    docs.InternalAdd(dv);
                }
            }
            else

            if (ed.document.atts != null)
            {
                foreach (DocVersion dv in ed.document.atts)
                {
                    FWDocVersion xdv = ClassFactory.NewDocVersion(dv, this, FWDocVersionType.TYPE_ATTACHMENT);
                    if (watt != null)
                    {
                        if (watt.Id == dv.id)
                        {
                            continue;
                        }
                        dv.workVersion = false;
                    }
                    atts.InternalAdd(dv);
                }
            }
        }
示例#3
0
        /// <summary>
        /// Initialize
        /// </summary>
        /// <param name="conn">Connection object</param>
        /// <param name="arcName">Archive name</param>
        /// <param name="connProps">Connection properties</param>
        /// <returns></returns>
        public virtual void Init(FWConnection conn, string arcName, IXProperties connProps)
        {
            this.connVal         = conn;
            this.classFactoryVal = new FWContentClassFactory(this);
            this.sordZVal        = new SordZ(SordC.mbLeanMembers | SordC.mbDocVersionMembers);
            this.editZVal        = new EditInfoZ(EditInfoC.mbDocumentMembers | EditInfoC.mbSignatureMembers | EditInfoC.mbAttachmentMembers, sordZVal);

            // try to get the temporary directory from the connection properties
            String tmpDir = (connProps != null) ? connProps[FWConnFactory.PROP_TEMP_DIR] : null;

            if (tmpDir != null && tmpDir.Length != 0)
            {
                tempDirVal     = makeTempDir(tmpDir, Path.Combine(arcName, "Temp"));
                checkoutDirVal = makeTempDir(tmpDir, Path.Combine(arcName, "Checkout"));
            }
            else
            {
                try
                {
                    // not found: use the users APPDATA directory
                    tempDirVal     = makeTempDir(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ELO Digital Office"), Path.Combine(arcName, "Temp"));
                    checkoutDirVal = makeTempDir(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ELO Digital Office"), Path.Combine(arcName, "Checkout"));
                }
                catch (Exception)
                {
                    try
                    {
                        tempDirVal     = makeTempDir(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ELO Digital Office"), Path.Combine(arcName, "Temp"));
                        checkoutDirVal = makeTempDir(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ELO Digital Office"), Path.Combine(arcName, "Checkout"));
                    }
                    catch (Exception)
                    {
                        // Konto "Local System" unter Windows 2003 kann nicht auf APPDATA zugreifen.

                        tempDirVal     = makeTempDir(Path.Combine(Path.GetTempPath(), "ELO Digital Office"), Path.Combine(arcName, "Temp"));
                        checkoutDirVal = makeTempDir(Path.Combine(Path.GetTempPath(), "ELO Digital Office"), Path.Combine(arcName, "Checkout"));
                    }
                }
            }


            // Initialize the FWDownloadManager object
            downloadManagerVal = ClassFactory.NewDownloadManager(
                tempDirVal,
                connProps.Get(FWConnFactory.PROP_CACHE_DOCUMENT_LIFETIME_SECONDS,
                              FWConnFactory.PROP_CACHE_DOCUMENT_LIFETIME_DEFAULT));

            checkedOutDocumentsManagerVal = ClassFactory.NewCheckedOutDocumentsManager(checkoutDirVal);
        }
示例#4
0
        private Sord readSord(IXConnection conn, int objId, SordZ sordZ)
        {
            Sord ret = null;

            try
            {
                EditInfoZ editZ = new EditInfoZ(0, sordZ);
                EditInfo  ed    = conn.Ix.checkoutSord(Convert.ToString(objId), editZ, LockC.IF_FREE);
                ret = ed.sord;
            }
            catch (Exception e)
            {
                throw new IOException("Cannot read sord, sord.id=" + objId, e);
            }
            return(ret);
        }