public AttachToContextTemplate(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, ObjectClass cls)
            : base(_host)
        {
			this.ctx = ctx;
			this.cls = cls;

        }
Example #2
0
        public static object[] MakeArgs(IZetboxContext ctx, ObjectClass cls, NameValueCollection templateSettings)
        {
            if (ctx == null) { throw new ArgumentNullException("ctx"); }
            if (cls == null) { throw new ArgumentNullException("cls"); }
            if (templateSettings == null) { throw new ArgumentNullException("templateSettings"); }

            string extraSuffix = templateSettings["extrasuffix"];
            string interfaceName = cls.Name;
            string implementationName = cls.Name + extraSuffix + Zetbox.API.Helper.ImplementationSuffix;
            string schemaName = cls.Module.SchemaName;
            string tableName = cls.TableName;

            string qualifiedImplementationName = GetAssemblyQualifiedProxy(cls, templateSettings);

            bool isAbstract = cls.IsAbstract;

            List<Property> properties = cls.Properties.ToList();
            List<ObjectClass> subClasses = cls.SubClasses.ToList();

            bool needsRightTable = Templates.ObjectClasses.Template.NeedsRightsTable(cls);
            string qualifiedRightsClassName =
                cls.Module.Namespace + "."
                + Construct.SecurityRulesClassName(cls) + extraSuffix + Zetbox.API.Helper.ImplementationSuffix
                + ", Zetbox.Objects." + extraSuffix + Zetbox.API.Helper.ImplementationSuffix;

            bool needsConcurrency = cls.ImplementsIChangedBy(true);

            return new object[] { interfaceName, implementationName, schemaName, tableName, qualifiedImplementationName, isAbstract, properties, subClasses, needsRightTable, needsConcurrency, qualifiedRightsClassName, cls.GetTableMapping() };
        }
Example #3
0
        public static string InheritanceAssociationName(ObjectClass parentClass, ObjectClass childClass)
        {
            if (parentClass == null) { throw new ArgumentNullException("parentClass"); }
            if (childClass == null) { throw new ArgumentNullException("childClass"); }

            return InheritanceAssociationName(parentClass.Name, childClass.Name);
        }
Example #4
0
 protected virtual void ApplyObjectClassTemplate(ObjectClass cls)
 {
     this.CallTemplate("Mappings.ObjectClassHbm",
          new object[] { ctx }
              .Concat(ObjectClassHbm.MakeArgs(ctx, cls, new NameValueCollection() { { "extrasuffix", extraSuffix } }))
              .ToArray());
 }
Example #5
0
 public ObjectClassViewModel(
     IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent,
     ObjectClass cls)
     : base(appCtx, dataCtx, parent, cls)
 {
     _class = cls;
 }
Example #6
0
 public ObjectClassViewModel(IViewModelDependencies appCtx,
     IZetboxContext dataCtx, ViewModel parent, ObjectClass cls)
     : base(appCtx, dataCtx, parent, cls)
 {
     _cls = cls;
     cls.PropertyChanged += ModulePropertyChanged;
 }
        public ModelMslEntityTypeMapping(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, ObjectClass cls)
            : base(_host)
        {
			this.ctx = ctx;
			this.cls = cls;

        }
Example #8
0
 public override void RenderObjectAs(ObjectContext context, ObjectClass objectClass)
 {
     if(!string.IsNullOrEmpty(objectClass.Atts["Table"]))
         RenderTableObjectAs(context, objectClass);
     else if(!string.IsNullOrEmpty(objectClass.Atts["Proc"]))
         RenderProcObjectAs(context, objectClass);
 }
Example #9
0
        public static void Call(Arebis.CodeGeneration.IGenerationHost host, IZetboxContext ctx, ObjectClass cls, string ifName, string implName)
        {
            if (host == null) { throw new ArgumentNullException("host"); }

            string propertyDescriptorName = host.Settings["propertydescriptorname"];
            host.CallTemplate("ObjectClasses.CustomTypeDescriptor", ctx, cls, ifName, implName, propertyDescriptorName);
        }
Example #10
0
        public FilterListViewModel(IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent, ObjectClass type, IFulltextSupport fulltextSupport = null)
            : base(appCtx, dataCtx, parent)
        {
            if (type == null) throw new ArgumentNullException("type");

            _type = type;
            _fulltextSupport = fulltextSupport;
        }
Example #11
0
 protected static IEnumerable<ObjectClass> SelectAndParents(ObjectClass cls)
 {
     yield return cls;
     while (cls.BaseObjectClass != null)
     {
         cls = cls.BaseObjectClass;
         yield return cls;
     }
 }
        public SecurityRulesClass(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, ObjectClass cls, string assocName, string targetRoleName, string referencedImplementation)
            : base(_host)
        {
			this.ctx = ctx;
			this.cls = cls;
			this.assocName = assocName;
			this.targetRoleName = targetRoleName;
			this.referencedImplementation = referencedImplementation;

        }
Example #13
0
        public static string GetWrapperTypeReference(ObjectClass cls, NameValueCollection templateSettings)
        {
            if (cls == null) { throw new ArgumentNullException("cls"); }
            if (templateSettings == null) { throw new ArgumentNullException("templateSettings"); }

            string extraSuffix = templateSettings["extrasuffix"];

            return cls.Module.Namespace + "."
                + cls.Name + extraSuffix + Zetbox.API.Helper.ImplementationSuffix;
        }
        public CustomTypeDescriptor(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, ObjectClass cls, string ifName, string implName, string propertyDescriptorName)
            : base(_host)
        {
			this.ctx = ctx;
			this.cls = cls;
			this.ifName = ifName;
			this.implName = implName;
			this.propertyDescriptorName = propertyDescriptorName;

        }
        public ModelSsdlEntityTypeColumnsRel(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, ObjectClass cls, IEnumerable<Relation> relations, string prefix, ISchemaProvider schemaProvider)
            : base(_host)
        {
			this.ctx = ctx;
			this.cls = cls;
			this.relations = relations;
			this.prefix = prefix;
			this.schemaProvider = schemaProvider;

        }
Example #16
0
 public static void Call(IGenerationHost host, IZetboxContext ctx, ObjectClass cls)
 {
     if (host == null) { throw new ArgumentNullException("host"); }
     if (ctx == null) { throw new ArgumentNullException("ctx"); }
     if (cls == null) { throw new ArgumentNullException("cls"); }
     host.CallTemplate("ObjectClasses.SecurityRulesClass", ctx, cls,
         Construct.SecurityRulesFKName(cls),
         Construct.SecurityRulesClassName(cls),
         Construct.SecurityRulesClassName(cls) + host.Settings["extrasuffix"] + Zetbox.API.Helper.ImplementationSuffix);
 }
        public static bool Required(ObjectClass objectClass, string name)
        {
            if (objectClass == ObjectClass.Armor || objectClass == ObjectClass.Clothing ||
                objectClass == ObjectClass.MeleeWeapon || objectClass == ObjectClass.MissileWeapon || objectClass == ObjectClass.WandStaffOrb ||
                objectClass == ObjectClass.Jewelry ||
                (objectClass == ObjectClass.Gem && !String.IsNullOrEmpty(name) && name.Contains("Aetheria")) || // Aetheria are Gems
                (objectClass == ObjectClass.Misc && !String.IsNullOrEmpty(name) && name.Contains("Essence"))) // Essences (Summoning Gems) are Misc
                return true;

            return false;
        }
 public TreeItemInstanceListViewModel(
     IViewModelDependencies appCtx,
     ZetboxConfig config,
     IFileOpener fileOpener,
     ITempFileService tmpService,
     Lazy<IUIExceptionReporter> errorReporter,
     IZetboxContext dataCtx, ViewModel parent,
     ObjectClass type,
     Func<IQueryable> qry)
     : base(appCtx, config, fileOpener, tmpService, errorReporter, dataCtx, parent, type, qry)
 {
 }
Example #19
0
 public static void GetInheritedMethods(ObjectClass obj, MethodReturnEventArgs<IEnumerable<Method>> e)
 {
     ObjectClass baseObjectClass = obj.BaseObjectClass;
     if (baseObjectClass != null)
     {
         e.Result = baseObjectClass.GetInheritedMethods().Concat(baseObjectClass.Methods);
     }
     else
     {
         e.Result = new List<Method>();
     }
 }
Example #20
0
        public static string GetAssemblyQualifiedProxy(ObjectClass cls, NameValueCollection templateSettings)
        {
            if (cls == null) { throw new ArgumentNullException("cls"); }
            if (templateSettings == null) { throw new ArgumentNullException("templateSettings"); }

            string extraSuffix = templateSettings["extrasuffix"];

            return cls.Module.Namespace + "."
                + cls.Name + extraSuffix + Zetbox.API.Helper.ImplementationSuffix
                + "+" + cls.Name + "Proxy"
                + ", Zetbox.Objects." + extraSuffix + Zetbox.API.Helper.ImplementationSuffix;
        }
        public PropertySelectionTaskViewModel(
            IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent,
            ObjectClass objClass,
            Action<IEnumerable<Property>> callback)
            : base(appCtx, dataCtx, parent)
        {
            if (objClass == null) throw new ArgumentNullException("objClass");
            if (callback == null) throw new ArgumentNullException("callback");

            _callback = callback;
            _objClass = objClass;
        }
 public TreeItemInstanceListViewModel(
     IViewModelDependencies appCtx,
     ZetboxConfig config,
     IFileOpener fileOpener,
     ITempFileService tmpService,
     IZetboxContext dataCtx, ViewModel parent,
     Func<IZetboxContext> workingCtxFactory,
     ObjectClass type,
     Func<IQueryable> qry)
     : base(appCtx, config, fileOpener, tmpService, dataCtx, parent, workingCtxFactory, type, qry)
 {
 }
Example #23
0
        public bool HasIndexedFields(ObjectClass cls)
        {
            if (cls.ImplementsICustomFulltextFormat()) return true;

            foreach (var prop in cls.GetAllProperties())
            {
                if (prop is StringProperty /* && further restictions */) return true;
                if (prop is EnumerationProperty) return true;
            }

            return false;
        }
Example #24
0
		/// <summary>
		/// Gets the closest object found of the specified object class. If no object is found, null is returned.
		/// </summary>
		/// <returns></returns>
		public static WorldObject GetClosestObject(ObjectClass objectClass)
		{
			WorldObject closest = null;

			foreach (WorldObject obj in CoreManager.Current.WorldFilter.GetLandscape())
			{
				if (obj.ObjectClass != objectClass)
					continue;

				if (closest == null || GetDistanceFromPlayer(obj) < GetDistanceFromPlayer(closest))
					closest = obj;
			}

			return closest;
		}
Example #25
0
        public static void get_CodeTemplate(ObjectClass obj, PropertyGetterEventArgs<string> e)
        {
            StringBuilder sb = new StringBuilder();

            string type = obj.Name;

            sb.AppendFormat("[Invocation]\npublic static void ToString({0} obj, MethodReturnEventArgs<string> e)\n{{\n}}\n\n", type);
            sb.AppendFormat("[Invocation]\npublic static void NotifyPreSave({0} obj)\n{{\n}}\n\n", type);
            sb.AppendFormat("[Invocation]\npublic static void NotifyPostSave({0} obj)\n{{\n}}\n\n", type);
            sb.AppendFormat("[Invocation]\npublic static void NotifyCreated({0} obj)\n{{\n}}\n\n", type);
            sb.AppendFormat("[Invocation]\npublic static void NotifyDeleting({0} obj)\n{{\n}}\n\n", type);
            sb.AppendFormat("[Invocation]\npublic static void ObjectIsValid({0} obj, ObjectIsValidEventArgs e)\n{{\n}}\n\n", type);

            e.Result = sb.ToString();
        }
Example #26
0
        public static void CreateRelation(ObjectClass obj, MethodReturnEventArgs<Relation> e)
        {
            e.Result = obj.Context.Create<Relation>();
            e.Result.Module = obj.Module;

            if (e.Result.A == null)
            {
                e.Result.A = obj.Context.Create<RelationEnd>();
            }
            e.Result.A.Type = obj;

            if (e.Result.B == null)
            {
                e.Result.B = obj.Context.Create<RelationEnd>();
            }
        }
        public InheritanceStorageAssociationInfo(ObjectClass cls)
        {
            if (cls.BaseObjectClass == null)
                throw new ArgumentOutOfRangeException("cls", "should be a derived ObjectClass");

            var parent = cls.BaseObjectClass;
            var child = cls;

            AssociationName = Construct.InheritanceAssociationName(parent, child);

            ParentRoleName = Construct.AssociationParentRoleName(parent);
            ChildRoleName = Construct.AssociationChildRoleName(child);

            ParentEntitySetName = parent.Name;
            ChildEntitySetName = child.Name;
        }
Example #28
0
        public override void RenderObjectAs(ObjectContext context, ObjectClass objectClass)
        {
            if(context.ObjectClass != objectClass)
                return;

            foreach(FieldContext field in context.Fields) {
                xw.WriteStartElement(field.ObjectClassField.Name);

                xw.WriteAttributeString("Name", field.Name);

                foreach(TerminalNodeValue t in field.Value.Terminals)
                    xw.WriteElementString(t.GetType().Name, t.Display);

                xw.WriteEndElement();
            }
        }
        public static void Call(IGenerationHost host, IZetboxContext ctx, ObjectClass cls)
        {
            if (host == null) { throw new ArgumentNullException("host"); }
            if (ctx == null) { throw new ArgumentNullException("ctx"); }
            if (cls == null) { throw new ArgumentNullException("cls"); }

            string assocName = Construct.SecurityRulesFKName(cls);
            string targetRoleName = Construct.SecurityRulesClassName(cls);
            string referencedImplementation = Construct.SecurityRulesClassName(cls) + host.Settings["extrasuffix"] + Zetbox.API.Helper.ImplementationSuffix;
            string efNameRightsPropertyName = "SecurityRightsCollection" + Zetbox.API.Helper.ImplementationSuffix;

            host.CallTemplate("Properties.SecurityRulesProperties", ctx, cls,
                assocName,
                targetRoleName,
                referencedImplementation,
                efNameRightsPropertyName);
        }
Example #30
0
        public static void Call(IGenerationHost host, IZetboxContext ctx, ObjectClass cls)
        {
            if (host == null) { throw new ArgumentNullException("host"); }
            if (ctx == null) { throw new ArgumentNullException("ctx"); }
            if (cls == null) { throw new ArgumentNullException("cls"); }
            if (cls.BaseObjectClass == null)
            {
                var msg = String.Format("Only subclasses can be joined subclasses, but {0} doesn't have a base class",
                        cls.Name);
                throw new ArgumentOutOfRangeException("cls", msg);
            }

            host.CallTemplate("Mappings.SubclassHbm",
                new object[] { ctx }
                    .Concat(ObjectClassHbm.MakeArgs(ctx, cls, host.Settings))
                    .ToArray());
        }
        private string GetFullFileName(Item log)
        {
            string text           = LocalLongFullPath.ConvertInvalidCharactersInFileName(log.GetValueOrDefault <string>(ItemSchema.NormalizedSubject, string.Empty));
            int    num            = 0;
            string valueOrDefault = log.PropertyBag.GetValueOrDefault <string>(StoreObjectSchema.ItemClass);

            if (!ObjectClass.IsMeetingInquiry(valueOrDefault))
            {
                num = log.GetValueOrDefault <int>(CalendarItemBaseSchema.AppointmentSequenceNumber, 0);
            }
            string text2 = string.Format("{0}.{1}.{2}.{3}", new object[]
            {
                log.LastModifiedTime.UtcTicks,
                num,
                this.GetParentFolderName(log),
                text
            });

            if (text2.Length > 120)
            {
                text2.Substring(0, 120 - ".msg".Length);
            }
            return(Path.Combine(this.outputDirectoryPath, text2 + ".msg"));
        }
        // Token: 0x06000314 RID: 788 RVA: 0x0001B85C File Offset: 0x00019A5C
        public static NavigationModule GetNavigationModuleFromFolder(UserContext userContext, StoreObjectId folderId)
        {
            if (folderId == null)
            {
                throw new ArgumentNullException("folderId");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            ModuleViewState moduleViewState = userContext.LastClientViewState as ModuleViewState;

            if (moduleViewState != null && moduleViewState.FolderId == folderId)
            {
                return(moduleViewState.NavigationModule);
            }
            string className;

            using (Folder folder = Folder.Bind(userContext.MailboxSession, folderId))
            {
                className = folder.ClassName;
            }
            if (className == null)
            {
                return(NavigationModule.Mail);
            }
            if (ObjectClass.IsCalendarFolder(className))
            {
                return(NavigationModule.Calendar);
            }
            if (ObjectClass.IsContactsFolder(className))
            {
                return(NavigationModule.Contacts);
            }
            return(NavigationModule.Mail);
        }
Example #33
0
        public JsObject Wrap(object value)
        {
            switch (Convert.GetTypeCode(value))
            {
            case TypeCode.Boolean:
                return(BooleanClass.New((bool)value));

            case TypeCode.Char:
            case TypeCode.String:
                return(StringClass.New(Convert.ToString(value)));

            case TypeCode.DateTime:
                return(DateClass.New((DateTime)value));

            case TypeCode.Byte:
            case TypeCode.Int16:
            case TypeCode.Int32:
            case TypeCode.Int64:
            case TypeCode.SByte:
            case TypeCode.UInt16:
            case TypeCode.UInt32:
            case TypeCode.UInt64:
            case TypeCode.Decimal:
            case TypeCode.Double:
            case TypeCode.Single:
                return(NumberClass.New(Convert.ToDouble(value)));

            case TypeCode.Object:
                return(ObjectClass.New(value));

            case TypeCode.DBNull:
            case TypeCode.Empty:
            default:
                throw new ArgumentNullException("value");
            }
        }
        public void Sync(ObjectClass objClass, SyncToken token,
                         SyncResultsHandler handler,
                         OperationOptions options)
        {
            for (int i = 0; i < _config.numResults; i++)
            {
                ConnectorObjectBuilder obuilder =
                    new ConnectorObjectBuilder();
                obuilder.SetUid(i.ToString());
                obuilder.SetName(i.ToString());
                obuilder.ObjectClass = (objClass);

                SyncDeltaBuilder builder =
                    new SyncDeltaBuilder();
                builder.Object    = (obuilder.Build());
                builder.DeltaType = (SyncDeltaType.CREATE_OR_UPDATE);
                builder.Token     = (new SyncToken("mytoken"));
                SyncDelta rv = builder.Build();
                if (!handler(rv))
                {
                    break;
                }
            }
        }
Example #35
0
 public void Sync(ObjectClass objectClass, SyncToken token, SyncResultsHandler handler, OperationOptions options)
 {
     Assert.IsNotNull(objectClass);
     Assert.IsNotNull(token);
     Assert.IsNotNull(handler);
     Assert.IsNotNull(options);
     AddCall("Sync", objectClass, token, handler, options);
     if (ObjectClass.ALL.Equals(objectClass))
     {
         if (null != CollectionUtil.GetValue(options.Options, "FAIL_DELETE", null))
         {
             //Require ObjectClass when delta is 'delete'
             var builder = new SyncDeltaBuilder();
             builder.DeltaType = SyncDeltaType.DELETE;
             builder.Uid       = new Uid("DELETED");
             builder.Token     = new SyncToken(99);
             handler.Handle(builder.Build());
         }
         else
         {
             ((SyncTokenResultsHandler)handler).HandleResult(new SyncToken(100));
         }
     }
 }
        public void ExecuteQuery(ObjectClass oclass, String query, ResultsHandler handler, OperationOptions options)
        {
            int remaining = _config.numResults;

            for (int i = 0; i < _config.numResults; i++)
            {
                int?delay = (int?)CollectionUtil.GetValue(options.Options, "delay", null);
                if (delay != null)
                {
                    Thread.Sleep((int)delay);
                }
                ConnectorObjectBuilder builder =
                    new ConnectorObjectBuilder();
                builder.SetUid("" + i);
                builder.SetName(i.ToString());
                builder.ObjectClass = oclass;
                for (int j = 0; j < 50; j++)
                {
                    builder.AddAttribute("myattribute" + j, "myvaluevaluevalue" + j);
                }
                ConnectorObject rv = builder.Build();
                if (handler.Handle(rv))
                {
                    remaining--;
                }
                else
                {
                    break;
                }
            }

            if (handler is SearchResultsHandler)
            {
                ((SearchResultsHandler)handler).HandleResult(new SearchResult("", remaining));
            }
        }
Example #37
0
        private void SelectObject(Guid objectPoolUid, Guid objectClassUid)
        {
            ObjectClass prevClass = _selectedObjects.ContainsKey(objectPoolUid)
                ? _selectedObjects[objectPoolUid]
                : null;

            if (prevClass != null && prevClass.Uid == objectClassUid)
            {
                return;
            }

            _selectedObjects.Remove(objectPoolUid);

            // Bind new object
            if (objectClassUid != null && _editor.Project.ObjectPoolManager.Pools.Contains(objectPoolUid) &&
                _editor.Project.ObjectPoolManager.Pools[objectPoolUid].Objects.Contains(objectClassUid))
            {
                _selectedObjects[objectPoolUid] = _editor.Project.ObjectPoolManager.Pools[objectPoolUid].Objects[objectClassUid];
            }

            InvalidateObjectProtoCommands();

            OnSyncCurrentObject(new SyncObjectEventArgs(prevClass));
        }
Example #38
0
 // Token: 0x060016AB RID: 5803 RVA: 0x00080390 File Offset: 0x0007E590
 protected override void HandleEventInternal(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item, List <KeyValuePair <string, object> > customDataToLog)
 {
     if (ObjectClass.IsOfClass(mapiEvent.ObjectClass, "IPM.Configuration.DarTask") && itemStore != null && item != null)
     {
         try
         {
             ExceptionHandler.Handle(delegate
             {
                 using (HostRpcClient hostRpcClient = new HostRpcClient(itemStore.ServerFullyQualifiedDomainName))
                 {
                     hostRpcClient.NotifyTaskStoreChange(itemStore.MailboxOwner.MailboxInfo.OrganizationId.GetBytes(Encoding.UTF8));
                 }
             }, new ExceptionGroupHandler(ExceptionGroupHandlers.Rpc), new ExceptionHandlingOptions(TimeSpan.FromMinutes(1.0))
             {
                 ClientId  = "TaskStoreEventBasedAssistant",
                 Operation = "NotifyTaskStoreChange"
             });
         }
         catch (AggregateException ex)
         {
             ExTraceGlobals.GeneralTracer.TraceError <string>((long)this.GetHashCode(), "Error during call to TaskStoreEventBasedAssistant {0}", ex.ToString());
         }
     }
 }
Example #39
0
        internal static bool IsForwardSupported(Item item)
        {
            bool             flag             = ObjectClass.IsOfClass(item.ClassName, "IPM.Note.Microsoft.Approval.Request");
            bool             flag2            = ObjectClass.IsOfClass(item.ClassName, "IPM.Sharing");
            bool             flag3            = false;
            CalendarItemBase calendarItemBase = item as CalendarItemBase;

            if (calendarItemBase != null && !calendarItemBase.IsMeeting)
            {
                if (calendarItemBase.IsCalendarItemTypeOccurrenceOrException)
                {
                    flag3 = true;
                }
                else
                {
                    CalendarItem calendarItem = calendarItemBase as CalendarItem;
                    if (calendarItem != null)
                    {
                        flag3 = (calendarItem.Recurrence != null);
                    }
                }
            }
            return(!flag && !flag2 && !flag3);
        }
        // Token: 0x06000926 RID: 2342 RVA: 0x0003DDB4 File Offset: 0x0003BFB4
        internal void HandleEvent(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item)
        {
            MailboxData fromCache = MailboxData.GetFromCache(mapiEvent.MailboxGuid);

            if (fromCache == null)
            {
                return;
            }
            using (fromCache.CreateReadLock())
            {
                ExDateTime eventTime = new ExDateTime(fromCache.Settings.TimeZone.ExTimeZone, mapiEvent.CreateTime);
                try
                {
                    if (ObjectClass.IsMeetingMessage(mapiEvent.ObjectClass))
                    {
                        CalendarChangeProcessor.HandleMeetingEvent(eventTime, fromCache, mapiEvent, itemStore, item);
                    }
                    else if (ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(mapiEvent.ObjectClass))
                    {
                        CalendarChangeProcessor.HandleCalendarEvent(eventTime, fromCache, mapiEvent, itemStore, item);
                    }
                    else
                    {
                        ExTraceGlobals.AssistantTracer.TraceDebug <IExchangePrincipal, MapiEvent>((long)this.GetHashCode(), "why runs to here?! unhandled event for user {0}, event: {1}", itemStore.MailboxOwner, mapiEvent);
                    }
                }
                catch (ConnectionFailedTransientException arg)
                {
                    ExTraceGlobals.AssistantTracer.TraceDebug <IExchangePrincipal, MapiEvent, ConnectionFailedTransientException>((long)this.GetHashCode(), "Exception is caught for user {0} when processing event: {1}\n{2}", itemStore.MailboxOwner, mapiEvent, arg);
                }
                catch (AdUserNotFoundException arg2)
                {
                    ExTraceGlobals.AssistantTracer.TraceDebug <IExchangePrincipal, MapiEvent, AdUserNotFoundException>((long)this.GetHashCode(), "Exception is caught for user {0} when processing event: {1}\n{2}", itemStore.MailboxOwner, mapiEvent, arg2);
                }
            }
        }
Example #41
0
        /// <summary>
        /// Implementation of CreateOp.Create
        /// </summary>
        /// <param name="oclass">Object class</param>
        /// <param name="attributes">Object attributes</param>
        /// <param name="options">Operation options</param>
        /// <returns>Uid of the created object</returns>
        public Uid Create(ObjectClass oclass, ICollection <ConnectorAttribute> attributes, OperationOptions options)
        {
            const string operation = "Create";

            ExchangeUtility.NullCheck(oclass, "oclass", this._configuration);
            ExchangeUtility.NullCheck(attributes, "attributes", this._configuration);

            LOGGER_API.TraceEvent(TraceEventType.Information, CAT_DEFAULT,
                                  "Exchange.Create method for {0}; attributes:\n{1}", oclass.GetObjectClassValue(), CommonUtils.DumpConnectorAttributes(attributes));

            CreateOpContext context = new CreateOpContext()
            {
                Attributes             = attributes,
                Connector              = this,
                ConnectorConfiguration = this._configuration,
                ObjectClass            = oclass,
                OperationName          = operation,
                Options = options
            };

            try {
                _scripting.ExecutePowerShell(context, Scripting.Position.BeforeMain);

                if (!_scripting.ExecutePowerShell(context, Scripting.Position.InsteadOfMain))
                {
                    CreateMain(context);
                }

                _scripting.ExecutePowerShell(context, Scripting.Position.AfterMain);

                return(context.Uid);
            } catch (Exception e) {
                LOGGER.TraceEvent(TraceEventType.Error, CAT_DEFAULT, "Exception while executing Create operation: {0}", e);
                throw;
            }
        }
Example #42
0
 public static IList <ConnectorObject> SearchToList(SearchApiOp search,
                                                    ObjectClass oclass,
                                                    Filter filter)
 {
     return(SearchToList(search, oclass, filter, null));
 }
Example #43
0
 /// <summary>
 /// Performs a raw, unfiltered search at the SPI level,
 /// eliminating duplicates from the result set.
 /// </summary>
 /// <param name="search">The search SPI</param>
 /// <param name="oclass">The object class - passed through to
 /// connector so it may be null if the connecor
 /// allowing it to be null. (This is convenient for
 /// unit tests, but will not be the case in general)</param>
 /// <param name="filter">The filter to search on</param>
 /// <param name="options">The options - may be null - will
 /// be cast to an empty OperationOptions</param>
 /// <returns>The list of results.</returns>
 public static IList <ConnectorObject> SearchToList <T>(SearchOp <T> search,
                                                        ObjectClass oclass,
                                                        Filter filter) where T : class
 {
     return(SearchToList(search, oclass, filter, null));
 }
Example #44
0
 public DetailInfoView(ObjectClass _objectClass)
 {
     InitializeComponent();
     this.BindingContext = _objectClass;
 }
        // Token: 0x060004A4 RID: 1188 RVA: 0x00022330 File Offset: 0x00020530
        private bool IsEventRelevant(MapiEvent mapiEvent)
        {
            if ((mapiEvent.ExtendedEventFlags & MapiExtendedEventFlags.NonIPMFolder) == MapiExtendedEventFlags.NonIPMFolder)
            {
                ElcEventBasedAssistant.Tracer.TraceDebug <MapiEvent>((long)this.GetHashCode(), "Non IPM Folder events are not relevant. MapiEvent: {0}", mapiEvent);
                return(false);
            }
            if ((mapiEvent.EventFlags & MapiEventFlags.SearchFolder) == MapiEventFlags.SearchFolder)
            {
                ElcEventBasedAssistant.Tracer.TraceDebug <MapiEvent>((long)this.GetHashCode(), "SearchFolder events are not relevant. MapiEvent: {0}", mapiEvent);
                return(false);
            }
            if ((mapiEvent.EventFlags & MapiEventFlags.ContentOnly) == MapiEventFlags.ContentOnly)
            {
                ElcEventBasedAssistant.Tracer.TraceDebug <MapiEvent>((long)this.GetHashCode(), "ContentOnly events are not relevant. MapiEvent: {0}", mapiEvent);
                return(false);
            }
            if (ObjectClass.IsCalendarItem(mapiEvent.ObjectClass) || ObjectClass.IsTask(mapiEvent.ObjectClass))
            {
                ElcEventBasedAssistant.Tracer.TraceDebug <MapiEvent>((long)this.GetHashCode(), "Calendar and task items are not relevent. Mapievent: {0}", mapiEvent);
                return(false);
            }
            if (mapiEvent.ClientType == MapiEventClientTypes.Transport)
            {
                ElcEventBasedAssistant.Tracer.TraceDebug <MapiEvent>((long)this.GetHashCode(), "Skip events from Transport. Mapievent: {0}", mapiEvent);
                return(false);
            }
            MapiEventTypeFlags mapiEventTypeFlags = MapiEventTypeFlags.ObjectCreated | MapiEventTypeFlags.ObjectModified | MapiEventTypeFlags.ObjectMoved | MapiEventTypeFlags.ObjectCopied;

            if ((mapiEvent.EventMask & mapiEventTypeFlags) == (MapiEventTypeFlags)0)
            {
                ElcEventBasedAssistant.Tracer.TraceDebug <MapiEvent>((long)this.GetHashCode(), "No interesting MapiEventTypeFlags. Skip. Mapievent: {0}", mapiEvent);
                return(false);
            }
            if ((mapiEvent.EventMask & MapiEventTypeFlags.ObjectModified) != (MapiEventTypeFlags)0 && (mapiEvent.EventFlags & MapiEventFlags.FolderAssociated) == MapiEventFlags.None && mapiEvent.ItemType == ObjectType.MAPI_MESSAGE && (mapiEvent.ExtendedEventFlags & MapiExtendedEventFlags.RetentionTagModified) == MapiExtendedEventFlags.None && (mapiEvent.ExtendedEventFlags & MapiExtendedEventFlags.RetentionPropertiesModified) == MapiExtendedEventFlags.None)
            {
                ElcEventBasedAssistant.Tracer.TraceDebug <MapiEvent>((long)this.GetHashCode(), "Item was modified. Either the property modified is not relevent to us . Mapievent: {0}", mapiEvent);
                return(false);
            }
            if (mapiEvent.ClientType == MapiEventClientTypes.TimeBasedAssistants && !RetentionPolicyCheck.IsEventConfigChange(mapiEvent) && !RetentionPolicyCheck.IsAutoTagFai(mapiEvent))
            {
                ElcEventBasedAssistant.Tracer.TraceDebug <MapiEvent>((long)this.GetHashCode(), "Event is from Time Based Assistant and not FAI related. Ignoring. Mapievent: {0}", mapiEvent);
                return(false);
            }
            if (mapiEvent.ClientType == MapiEventClientTypes.EventBasedAssistants)
            {
                ElcEventBasedAssistant.Tracer.TraceDebug <MapiEvent>((long)this.GetHashCode(), "Event is from this assistant. Ignoring. Mapievent: {0}", mapiEvent);
                return(false);
            }
            if ((mapiEvent.EventFlags & MapiEventFlags.FolderAssociated) != MapiEventFlags.None && !RetentionPolicyCheck.IsEventConfigChange(mapiEvent) && !RetentionPolicyCheck.IsAutoTagFai(mapiEvent))
            {
                ElcEventBasedAssistant.Tracer.TraceDebug <MapiEvent>((long)this.GetHashCode(), "FAI we don't care about. Ignoring. Mapievent: {0}", mapiEvent);
                return(false);
            }
            if (mapiEvent.ItemType != ObjectType.MAPI_MESSAGE && mapiEvent.ItemType != ObjectType.MAPI_FOLDER)
            {
                ElcEventBasedAssistant.Tracer.TraceDebug <MapiEvent>((long)this.GetHashCode(), "Not a message or a folder. Ignoring. Mapievent: {0}", mapiEvent);
                return(false);
            }
            if ((mapiEvent.EventMask & MapiEventTypeFlags.ObjectDeleted) != (MapiEventTypeFlags)0)
            {
                ElcEventBasedAssistant.Tracer.TraceDebug <MapiEvent>((long)this.GetHashCode(), "Item Deleted. Ignoring. Mapievent: {0}", mapiEvent);
                return(false);
            }
            ElcEventBasedAssistant.Tracer.TraceDebug <MapiEvent>((long)this.GetHashCode(), "IsEventRelevant is true. Mapievent: {0}", mapiEvent);
            return(true);
        }
        // Token: 0x0600254B RID: 9547 RVA: 0x000D7AD0 File Offset: 0x000D5CD0
        protected override void RenderButtons()
        {
            ToolbarButtonFlags flags = this.isEmbeddedItem ? ToolbarButtonFlags.Disabled : ToolbarButtonFlags.None;
            bool flag  = Utilities.IsPublic(this.message);
            bool flag2 = Utilities.IsOtherMailbox(this.message);

            base.RenderHelpButton(ObjectClass.IsSmsMessage(this.message.ClassName) ? HelpIdsLight.DefaultLight.ToString() : HelpIdsLight.MailLight.ToString(), string.Empty);
            if (ItemUtility.ShouldRenderSendAgain(this.message, this.isEmbeddedItem) && !flag2)
            {
                base.RenderButton(ToolbarButtons.SendAgain, flag ? ToolbarButtonFlags.Disabled : ToolbarButtonFlags.None);
            }
            if (this.isInJunkEmailFolder && base.UserContext.IsJunkEmailEnabled && !this.isSuspectedPhishingItem)
            {
                base.RenderButton(ToolbarButtons.NotJunk);
            }
            ToolbarButtonFlags flags2 = ToolbarButtonFlags.None;
            ToolbarButtonFlags flags3 = ToolbarButtonFlags.None;

            if (this.isInJunkEmailFolder || (this.isSuspectedPhishingItem && !this.isLinkEnabled))
            {
                flags2 = ToolbarButtonFlags.Disabled;
                flags3 = ToolbarButtonFlags.Disabled;
            }
            if (!base.UserContext.IsFeatureEnabled(Feature.Tasks) && ObjectClass.IsOfClass(this.message.ClassName, "IPM.Task"))
            {
                flags2 = ToolbarButtonFlags.Disabled;
                flags3 = ToolbarButtonFlags.Disabled;
            }
            bool flag3 = ReadMessageToolbar.IsReplySupported(this.message);
            bool flag4 = base.UserContext.IsSmsEnabled && ObjectClass.IsSmsMessage(this.message.ClassName);

            if (this.isReplyRestricted)
            {
                flags2 = ToolbarButtonFlags.Disabled;
            }
            if (this.isReplyAllRestricted)
            {
                flags3 = ToolbarButtonFlags.Disabled;
            }
            if (flag3)
            {
                base.RenderButton(flag4 ? ToolbarButtons.ReplySms : ToolbarButtons.Reply, flags2);
                base.RenderButton(flag4 ? ToolbarButtons.ReplyAllSms : ToolbarButtons.ReplyAll, flags3);
            }
            ToolbarButtonFlags flags4 = ToolbarButtonFlags.None;

            if (ObjectClass.IsOfClass(this.message.ClassName, "IPM.Note.Microsoft.Approval.Request") || this.isForwardRestricted || this.isInJunkEmailFolder || (this.isSuspectedPhishingItem && !this.isLinkEnabled))
            {
                flags4 = ToolbarButtonFlags.Disabled;
            }
            if (!ObjectClass.IsOfClass(this.message.ClassName, "IPM.Conflict.Message"))
            {
                base.RenderButton(flag4 ? ToolbarButtons.ForwardSms : ToolbarButtons.Forward, flags4);
            }
            bool flag5 = this.message is CalendarItemBase;
            bool flag6 = ItemUtility.UserCanEditItem(this.message);

            if (base.UserContext.IsInstantMessageEnabled() && (!flag5 || (flag5 && flag3)))
            {
                base.RenderButton(ToolbarButtons.Chat, ToolbarButtonFlags.Disabled);
            }
            MessageItem        messageItem = this.message as MessageItem;
            bool               flag7       = messageItem != null && messageItem.IsDraft;
            ToolbarButtonFlags flags5      = (flag6 && !flag7) ? ToolbarButtonFlags.None : ToolbarButtonFlags.Disabled;

            if (!this.isEmbeddedItem && base.UserContext.ExchangePrincipal.RecipientTypeDetails == RecipientTypeDetails.DiscoveryMailbox)
            {
                base.RenderButton(ToolbarButtons.MessageNoteInToolbar);
            }
            if (!flag5 && !this.isInDeleteItems && !this.isEmbeddedItem)
            {
                base.RenderButton(ToolbarButtons.Flag, flags5);
            }
            ToolbarButtonFlags flags6 = flag6 ? ToolbarButtonFlags.None : ToolbarButtonFlags.Disabled;

            if (!this.isEmbeddedItem)
            {
                bool flag8 = true;
                if (flag5)
                {
                    CalendarItemBase calendarItemBase = (CalendarItemBase)this.message;
                    flag8 = (CalendarItemType.Occurrence != calendarItemBase.CalendarItemType && CalendarItemType.Exception != calendarItemBase.CalendarItemType);
                }
                if (flag8)
                {
                    base.RenderButton(ToolbarButtons.Categories, flags6);
                }
            }
            if (!flag5)
            {
                base.RenderButton(ToolbarButtons.MessageDetails);
            }
            base.RenderButton(ToolbarButtons.Print, this.isPrintRestricted ? ToolbarButtonFlags.Disabled : ToolbarButtonFlags.None);
            if (base.UserContext.IsFeatureEnabled(Feature.Rules) && this.isMessageReadForm && !flag2 && !this.isEmbeddedItem)
            {
                base.RenderButton(ToolbarButtons.CreateRule, (base.UserContext.IsWebPartRequest || flag) ? ToolbarButtonFlags.Disabled : ToolbarButtonFlags.None);
            }
            bool flag9;

            if (flag5)
            {
                flag9 = CalendarUtilities.UserCanDeleteCalendarItem((CalendarItemBase)this.message);
            }
            else
            {
                flag9 = ItemUtility.UserCanDeleteItem(this.message);
            }
            ToolbarButtonFlags flags7 = (!flag9 || this.isEmbeddedItem) ? ToolbarButtonFlags.Disabled : ToolbarButtonFlags.None;

            base.RenderButton(ToolbarButtons.Delete, flags7);
            if (!this.isEmbeddedItem && !flag5)
            {
                base.RenderButton(ToolbarButtons.Move);
            }
            if (!flag5)
            {
                base.RenderButton(ToolbarButtons.Previous, flags);
                base.RenderButton(ToolbarButtons.Next, flags);
            }
        }
        /// <summary>
        /// Gets Recipient Type/Database from Exchange database, this method can be more general, but it is ok
        /// for out needs
        /// </summary>
        /// <param name="oc">object class, currently the moethod works for <see cref="ObjectClass.ACCOUNT"/> only</param>
        /// <param name="cobject">connector object to get the recipient type/database for</param>
        /// <param name="attToGet">attributes to get</param>
        /// <returns>Connector Object with recipient type added</returns>
        /// <exception cref="ConnectorException">In case of some troubles in powershell (if the
        /// user is not found we get this exception too)</exception>
        private ConnectorObject AddExchangeAttributes(ObjectClass oc, ConnectorObject cobject, IEnumerable <string> attToGet)
        {
            ExchangeUtility.NullCheck(oc, "name", this.configuration);
            ExchangeUtility.NullCheck(oc, "cobject", this.configuration);

            // we support ACCOUNT only or there is nothing to add
            if (!oc.Is(ObjectClass.ACCOUNT_NAME) || attToGet == null)
            {
                return(cobject);
            }

            // check it is not deleted object
            bool?deleted = ExchangeUtility.GetAttValue(AttIsDeleted, cobject.GetAttributes()) as bool?;

            if (deleted != null && deleted == true)
            {
                // do nothing, it is deleted object
                return(cobject);
            }

            ICollection <string> lattToGet = CollectionUtil.NewCaseInsensitiveSet();

            CollectionUtil.AddAll(lattToGet, attToGet);
            foreach (string att in attToGet)
            {
                if (cobject.GetAttributeByName(att) != null && att != AttDatabase)
                {
                    lattToGet.Remove(att);
                }
            }

            if (lattToGet.Count == 0)
            {
                return(cobject);
            }

            ConnectorObjectBuilder cobjBuilder = new ConnectorObjectBuilder();

            cobjBuilder.AddAttributes(cobject.GetAttributes());

            PSExchangeConnector.CommandInfo cmdInfo = PSExchangeConnector.CommandInfo.GetUser;

            // prepare the connector attribute list to get the command
            ICollection <ConnectorAttribute> attributes = new Collection <ConnectorAttribute> {
                cobject.Name
            };

            // get the command
            Command cmd = ExchangeUtility.GetCommand(cmdInfo, attributes, this.configuration);
            ICollection <PSObject> foundObjects = this.InvokePipeline(cmd);
            PSObject user = null;

            if (foundObjects != null && foundObjects.Count == 1)
            {
                user = GetFirstElement(foundObjects);
                foreach (var info in user.Properties)
                {
                    ConnectorAttribute att = GetAsAttribute(info);
                    if (att != null && lattToGet.Contains(att.Name))
                    {
                        cobjBuilder.AddAttribute(att);
                        lattToGet.Remove(att.Name);
                    }
                }

                if (lattToGet.Count == 0)
                {
                    return(cobjBuilder.Build());
                }
            }

            if (user == null)
            {
                // nothing to do
                return(cobject);
            }

            string rcptType = user.Members[AttRecipientType].Value.ToString();

            foundObjects = null;

            // get detailed information
            if (rcptType == RcptTypeMailBox)
            {
                foundObjects = this.InvokePipeline(ExchangeUtility.GetCommand(PSExchangeConnector.CommandInfo.GetMailbox, attributes, this.configuration));
            }
            else if (rcptType == RcptTypeMailUser)
            {
                foundObjects = this.InvokePipeline(ExchangeUtility.GetCommand(PSExchangeConnector.CommandInfo.GetMailUser, attributes, this.configuration));
            }

            if (foundObjects != null && foundObjects.Count == 1)
            {
                PSObject userDetails = GetFirstElement(foundObjects);
                foreach (var info in userDetails.Properties)
                {
                    ConnectorAttribute att = GetAsAttribute(info);
                    if (att != null && lattToGet.Contains(att.Name))
                    {
                        cobjBuilder.AddAttribute(att);
                        lattToGet.Remove(att.Name);
                    }
                }
            }

            return(cobjBuilder.Build());
        }
        /// <summary>
        /// Implementation of CreateOp.Create
        /// </summary>
        /// <param name="oclass">Object class</param>(oc
        /// <param name="attributes">Object attributes</param>
        /// <param name="options">Operation options</param>
        /// <returns>Uid of the created object</returns>
        public override Uid Create(
            ObjectClass oclass, ICollection <ConnectorAttribute> attributes, OperationOptions options)
        {
            ExchangeUtility.NullCheck(oclass, "oclass", this.configuration);
            ExchangeUtility.NullCheck(attributes, "attributes", this.configuration);

            // we handle accounts only
            if (!oclass.Is(ObjectClass.ACCOUNT_NAME))
            {
                return(base.Create(oclass, attributes, options));
            }

            const string METHOD = "Create";

            Debug.WriteLine(METHOD + ":entry", ClassName);

            // get recipient type
            string rcptType = ExchangeUtility.GetAttValue(AttRecipientType, attributes) as string;

            PSExchangeConnector.CommandInfo cmdInfoEnable = null;
            PSExchangeConnector.CommandInfo cmdInfoSet    = null;
            switch (rcptType)
            {
            case RcptTypeMailBox:
                cmdInfoEnable = PSExchangeConnector.CommandInfo.EnableMailbox;
                cmdInfoSet    = PSExchangeConnector.CommandInfo.SetMailbox;
                break;

            case RcptTypeMailUser:
                cmdInfoEnable = PSExchangeConnector.CommandInfo.EnableMailUser;
                cmdInfoSet    = PSExchangeConnector.CommandInfo.SetMailUser;
                break;

            case RcptTypeUser:
                break;

            default:
                throw new ArgumentException(
                          this.configuration.ConnectorMessages.Format(
                              "ex_bad_rcpt", "Recipient type [{0}] is not supported", rcptType));
            }

            // first create the object in AD
            Uid uid = base.Create(oclass, FilterOut(attributes, cmdInfoEnable, cmdInfoSet), options);

            if (rcptType == RcptTypeUser)
            {
                // AD account only, we do nothing
                return(uid);
            }

            // prepare the command
            Command cmdEnable = ExchangeUtility.GetCommand(cmdInfoEnable, attributes, this.configuration);
            Command cmdSet    = ExchangeUtility.GetCommand(cmdInfoSet, attributes, this.configuration);

            try
            {
                this.InvokePipeline(cmdEnable);
                this.InvokePipeline(cmdSet);
            }
            catch
            {
                Trace.TraceWarning("Rolling back AD create for UID: " + uid.GetUidValue());

                // rollback AD create
                try
                {
                    Delete(oclass, uid, options);
                }
                catch
                {
                    Trace.TraceWarning("Not able to rollback AD create for UID: " + uid.GetUidValue());

                    // note: this is not perfect, we hide the original exception
                    throw;
                }

                // rethrow original exception
                throw;
            }

            Debug.WriteLine(METHOD + ":exit", ClassName);
            return(uid);
        }
Example #49
0
 public void Delete(ObjectClass objClass, Uid uid, OperationOptions options)
 {
 }
Example #50
0
 private void RenderAlternateBodyForIrm(TextWriter writer)
 {
     if (writer == null)
     {
         throw new ArgumentNullException("writer");
     }
     writer.Write(Utilities.GetAlternateBodyForIrm(base.UserContext, Microsoft.Exchange.Data.Storage.BodyFormat.TextHtml, this.irmDecryptionStatus, ObjectClass.IsVoiceMessage(this.message.ClassName)));
 }
Example #51
0
 public static void NotifyCreated(ObjectClass obj)
 {
     obj.DefaultViewModelDescriptor = ViewModelDescriptors.Zetbox_Client_Presentables_DataObjectViewModel.Find(obj.Context);
 }
Example #52
0
 protected SnappingManager GetSnappingManager(ObjectClass objClass)
 {
     return(new SnappingManager(GetSnappingSourceOrigin(objClass), GetSnappingSourceBounds(objClass), GridSize));
 }
Example #53
0
 public UnknownUidException(Uid uid, ObjectClass objclass) :
     base(String.Format(MSG, uid, objclass))
 {
 }
        // Token: 0x06001F51 RID: 8017 RVA: 0x000B43CC File Offset: 0x000B25CC
        private void RenderConversationMetaDataExpandos(TextWriter writer, int globalCount, IList <StoreObjectId> itemIds)
        {
            base.InternalRenderItemMetaDataExpandos(writer);
            int itemProperty = this.DataSource.GetItemProperty <int>(ConversationItemSchema.ConversationUnreadMessageCount, 0);

            writer.Write(" ");
            writer.Write("iUC");
            writer.Write("=");
            writer.Write(itemProperty);
            int itemProperty2 = this.DataSource.GetItemProperty <int>(ConversationItemSchema.ConversationMessageCount, 0);

            writer.Write(" ");
            writer.Write("iTC");
            writer.Write("=");
            writer.Write(itemProperty2);
            writer.Write(" ");
            writer.Write("iGC");
            writer.Write("=");
            writer.Write(globalCount);
            if (itemIds.Count > 0)
            {
                writer.Write(" ");
                writer.Write("sMID");
                writer.Write("=\"");
                Utilities.HtmlEncode(Utilities.GetItemIdString(itemIds[0], this.parentFolderId), writer);
                writer.Write("\"");
            }
            if (globalCount == 1)
            {
                string[] itemProperty3 = this.DataSource.GetItemProperty <string[]>(ConversationItemSchema.ConversationGlobalMessageClasses, null);
                if (base.UserContext.DraftsFolderId.Equals(this.parentFolderId.StoreObjectId))
                {
                    writer.Write(" ");
                    writer.Write("sMS");
                    writer.Write("=\"Draft\"");
                }
                writer.Write(" ");
                writer.Write("sMT");
                writer.Write("=\"");
                Utilities.HtmlEncode(itemProperty3[0], writer);
                writer.Write("\"");
                if (ObjectClass.IsMeetingRequest(itemProperty3[0]))
                {
                    writer.Write(" fMR=1");
                    writer.Write(" fRR=1");
                }
            }
            if (itemProperty > 0)
            {
                writer.Write(" ");
                writer.Write("read");
                writer.Write("=\"0\"");
            }
            FlagStatus itemProperty4 = (FlagStatus)this.DataSource.GetItemProperty <int>(ConversationItemSchema.ConversationFlagStatus, 0);

            if (itemProperty4 != FlagStatus.NotFlagged)
            {
                ExDateTime itemProperty5 = this.DataSource.GetItemProperty <ExDateTime>(ConversationItemSchema.ConversationFlagCompleteTime, ExDateTime.MinValue);
                if (itemProperty5 != ExDateTime.MinValue)
                {
                    writer.Write(" sFlgDt=\"");
                    writer.Write(DateTimeUtilities.GetJavascriptDate(itemProperty5));
                    writer.Write("\"");
                }
                FlagAction flagActionForItem = FlagContextMenu.GetFlagActionForItem(base.UserContext, itemProperty5, itemProperty4);
                writer.Write(" sFA=");
                writer.Write((int)flagActionForItem);
            }
            if (this.RenderLastModifiedTime)
            {
                base.RenderLastModifiedTimeExpando(writer);
            }
        }
Example #55
0
 public Org.IdentityConnectors.Framework.Common.Objects.Filters.FilterTranslator <string> CreateFilterTranslator(ObjectClass oclass, OperationOptions options)
 {
     return(new CustomExchangeFilterTranslator());
 }
        /// <summary>
        /// Implementation of UpdateOp.Update
        /// </summary>
        /// <param name="type">Update type</param>
        /// <param name="oclass">Object class</param>
        /// <param name="attributes">Object attributes</param>
        /// <param name="options">Operation options</param>
        /// <returns>Uid of the updated object</returns>
        public override Uid Update(
            UpdateType type,
            ObjectClass oclass,
            ICollection <ConnectorAttribute> attributes,
            OperationOptions options)
        {
            const string METHOD = "Update";

            Debug.WriteLine(METHOD + ":entry", ClassName);

            ExchangeUtility.NullCheck(type, "updatetype", this.configuration);
            ExchangeUtility.NullCheck(oclass, "oclass", this.configuration);
            ExchangeUtility.NullCheck(attributes, "attributes", this.configuration);

            // we handle accounts only
            if (!oclass.Is(ObjectClass.ACCOUNT_NAME))
            {
                return(base.Update(type, oclass, attributes, options));
            }

            // get recipient type and database
            string rcptType = ExchangeUtility.GetAttValue(AttRecipientType, attributes) as string;
            string database = ExchangeUtility.GetAttValue(AttDatabase, attributes) as string;

            // update in AD first
            var filtered = FilterOut(
                attributes,
                PSExchangeConnector.CommandInfo.EnableMailbox,
                PSExchangeConnector.CommandInfo.EnableMailUser,
                PSExchangeConnector.CommandInfo.SetMailbox,
                PSExchangeConnector.CommandInfo.SetMailUser);
            Uid uid = base.Update(type, oclass, filtered, options);

            ConnectorObject aduser = this.ADSearchByUid(uid, oclass, ExchangeUtility.AddAttributeToOptions(options, AttDatabaseADName));

            attributes.Add(aduser.Name);
            PSExchangeConnector.CommandInfo cmdInfo = PSExchangeConnector.CommandInfo.GetUser;
            if (aduser.GetAttributeByName(AttDatabaseADName) != null)
            {
                // we can be sure it is user mailbox type
                cmdInfo = PSExchangeConnector.CommandInfo.GetMailbox;
            }

            PSObject psuser       = this.GetUser(cmdInfo, attributes);
            string   origRcptType = psuser.Members[AttRecipientType].Value.ToString();

            if (String.IsNullOrEmpty(rcptType))
            {
                rcptType = origRcptType;
            }

            if (rcptType == RcptTypeMailUser)
            {
                if (type == UpdateType.REPLACE)
                {
                    if (origRcptType != rcptType)
                    {
                        Command cmdEnable = ExchangeUtility.GetCommand(
                            PSExchangeConnector.CommandInfo.EnableMailUser, attributes, this.configuration);
                        this.InvokePipeline(cmdEnable);
                    }

                    Command cmdSet = ExchangeUtility.GetCommand(PSExchangeConnector.CommandInfo.SetMailUser, attributes, this.configuration);
                    this.InvokePipeline(cmdSet);
                }
                else
                {
                    throw new ConnectorException(this.configuration.ConnectorMessages.Format(
                                                     "ex_wrong_update_type", "Update type [{0}] not supported", type));
                }
            }
            else if (rcptType == RcptTypeMailBox)
            {
                // we should execute something like this here:
                // get-user -identity id|?{$_.RecipientType -eq "User"}|enable-mailbox -database "db"
                // unfortunately I was not able to get it working with the pipeline... that's why there are two commands
                // executed :-(
                // alternatively there can be something like:
                // get-user -identity id -RecipientTypeDetails User|enable-mailbox -database "db", but we have then trouble
                // with detecting attempt to change the database attribute
                string origDatabase = psuser.Members[AttDatabase] != null ? psuser.Members[AttDatabase].Value.ToString() : null;
                if (origRcptType != rcptType)
                {
                    Command cmdEnable = ExchangeUtility.GetCommand(PSExchangeConnector.CommandInfo.EnableMailbox, attributes, this.configuration);
                    this.InvokePipeline(cmdEnable);
                }
                else
                {
                    // trying to update the database?
                    if (database != null && database != origDatabase)
                    {
                        throw new ArgumentException(
                                  this.configuration.ConnectorMessages.Format(
                                      "ex_not_updatable", "Update of [{0}] attribute is not supported", AttDatabase));
                    }
                }

                Command cmdSet = ExchangeUtility.GetCommand(PSExchangeConnector.CommandInfo.SetMailbox, attributes, this.configuration);
                this.InvokePipeline(cmdSet);
            }
            else if (rcptType == RcptTypeUser && origRcptType != rcptType)
            {
                throw new ArgumentException(
                          this.configuration.ConnectorMessages.Format(
                              "ex_update_notsupported", "Update of [{0}] to [{1}] is not supported", AttRecipientType, rcptType));
            }
            else if (rcptType != RcptTypeUser)
            {
                // unsupported rcpt type
                throw new ArgumentException(
                          this.configuration.ConnectorMessages.Format(
                              "ex_bad_rcpt", "Recipient type [{0}] is not supported", rcptType));
            }

            Debug.WriteLine(METHOD + ":exit", ClassName);
            return(uid);
        }
Example #57
0
 public void ExecuteQuery(ObjectClass oclass, string query, ResultsHandler handler, OperationOptions options)
 {
 }
 /// <summary>
 /// Implementation of SearchOp.CreateFilterTranslator
 /// </summary>
 /// <param name="oclass">Object class</param>
 /// <param name="options">Operation options</param>
 /// <returns>Filter translator</returns>
 public override FilterTranslator <string> CreateFilterTranslator(ObjectClass oclass, OperationOptions options)
 {
     return(new LegacyExchangeConnectorFilterTranslator());
 }
Example #59
0
        public Uid Update(ObjectClass objclass, Uid uid, ICollection <ConnectorAttribute> replaceAttributes, OperationOptions options)
        {
            StringBuilder sb = new StringBuilder();
            PowerShell    PowerShellInstance = PowerShell.Create();

            ConnectorAttribute StatusAttribute = ConnectorAttributeUtil.Find(OperationalAttributes.ENABLE_NAME, replaceAttributes);
            String             enable          = ConnectorAttributeUtil.GetAsStringValue(StatusAttribute).ToLower();

            string parameter = ConnectorAttributeUtil.GetAsStringValue(uid);

            string[] login = parameter.Split('@');

            if (enable.Equals("false"))
            {
                PowerShellInstance.AddCommand(this.config.createScript + "disable.ps1");
                PowerShellInstance.AddArgument(login[0]);

                Collection <PSObject>    results;
                Collection <ErrorRecord> errors;

                results = PowerShellInstance.Invoke();
                errors  = PowerShellInstance.Streams.Error.ReadAll();

                if (errors.Count > 0)
                {
                    foreach (ErrorRecord error in errors)
                    {
                        sb.AppendLine(error.ToString());
                    }

                    throw new ConnectorException(sb.ToString());
                }
                else
                {
                    return(uid);
                }
            }
            else if (enable.Equals("true"))
            {
                PowerShellInstance.AddCommand(this.config.createScript + "enable.ps1");
                PowerShellInstance.AddArgument(login[0]);

                Collection <PSObject>    results;
                Collection <ErrorRecord> errors;

                results = PowerShellInstance.Invoke();
                errors  = PowerShellInstance.Streams.Error.ReadAll();

                if (errors.Count > 0)
                {
                    foreach (ErrorRecord error in errors)
                    {
                        sb.AppendLine(error.ToString());
                    }

                    throw new ConnectorException(sb.ToString());
                }
                else
                {
                    return(uid);
                }
            }
            else
            {
                return(uid);
            }
        }
Example #60
0
 public static void AppendObject(ObjectClass newObject)
 {
     objectRepository.Add(newObject);
 }