Esempio n. 1
0
        public bool InsertContent(Object obj, GxContentInfo contentInfo)
        {
            IndexRecord ir = GetIndexRecord(obj, contentInfo);

            if (ir != null)
            {
                Enqueue(new IndexAction(Action.Insert, ir));
            }
            return(true);
        }
Esempio n. 2
0
        private IndexRecord GetIndexRecord(object obj, GxContentInfo contentInfo)
        {
            IndexRecord    ir     = null;
            GxFile         file   = obj as GxFile;
            GxSilentTrnSdt silent = obj as GxSilentTrnSdt;
            string         str    = obj as string;

            if (file != null && contentInfo != null)
            {
                ir         = new IndexRecord();
                ir.Uri     = file.GetAbsoluteName();
                ir.Content = DocumentHandler.GetText(file.GetAbsoluteName(), Path.GetExtension(file.GetAbsoluteName()));
                ir.Entity  = contentInfo.Entity == null?file.GetType().ToString() : contentInfo.Entity;

                ir.Title = contentInfo.Title == null?file.GetName() : contentInfo.Title;

                ir.Viewer = contentInfo.Viewer == null?file.GetName() : contentInfo.Viewer;

                ir.Keys = contentInfo.Keys == null || contentInfo.Keys.Count == 0 ? new List <string>() : contentInfo.Keys;
            }
            else if (silent != null)
            {
                IGxSilentTrn  bc   = (silent).getTransaction();
                GxContentInfo info = bc.GetContentInfo();
                if (info != null)
                {
                    ir         = new IndexRecord();
                    ir.Uri     = info.Id;
                    ir.Content = bc.ToString();
                    ir.Entity  = contentInfo.Entity == null ? info.Entity : contentInfo.Entity;
                    ir.Title   = contentInfo.Title == null ? info.Title : contentInfo.Title;
                    ir.Viewer  = contentInfo.Viewer == null ? info.Viewer : contentInfo.Viewer;
                    ir.Keys    = contentInfo.Keys == null || contentInfo.Keys.Count == 0 ? info.Keys : contentInfo.Keys;
                }
            }
            else if (str != null && contentInfo != null)
            {
                ir         = new IndexRecord();
                ir.Uri     = contentInfo.Id == null ? string.Empty : contentInfo.Id;
                ir.Content = str;
                ir.Entity  = contentInfo.Entity == null ? String.Empty : contentInfo.Entity;
                ir.Title   = contentInfo.Title == null ? String.Empty : contentInfo.Title;
                ir.Viewer  = contentInfo.Viewer == null ? String.Empty : contentInfo.Viewer;
                ir.Keys    = contentInfo.Keys == null || contentInfo.Keys.Count == 0 ? new List <string>() : contentInfo.Keys;
            }
            return(ir);
        }
Esempio n. 3
0
 public static bool UpdateContent(object obj, GxContentInfo contentInfo)
 {
     return((bool)ClassLoader.Invoke(m_IndexerInstance, "UpdateContent", new object[] { obj, contentInfo }));
 }