public SubpropertyRelationship(IPropertyEntity descendant, IPropertyEntity parent) : base(2) { base.Entities[0] = descendant; base.Entities[1] = parent; base.GenerateIdentity(); }
public PropertyRelationship(IPropertyEntity propertyEntity, IClassEntity classEntity) : base(2) { base.Entities[0] = propertyEntity; base.Entities[1] = classEntity; base.GenerateIdentity(); }
public ConditionalRuleRelationship(IClassEntity classEntity, IPropertyEntity ifProperty, IPropertyEntity thenProperty) : base(3) { base.Entities[0] = classEntity; base.Entities[1] = ifProperty; base.Entities[2] = thenProperty; base.GenerateIdentity(); }
public virtual IdBlock Execute(ICommandContext commandContext) { IPropertyEntity property = commandContext.PropertyEntityManager.FindById <IPropertyEntity>("next.dbid"); long oldValue = long.Parse(property.Value); long newValue = oldValue + idBlockSize; property.Value = Convert.ToString(newValue); return(new IdBlock(oldValue, newValue - 1)); }
public virtual object Execute(ICommandContext commandContext) { /* * If execution related entity counting is on in config | Current property in database : Result * * A) true | not there : write new property with value 'true' * B) true | true : all good * C) true | false : the feature was disabled before, but it is enabled now. Old executions will have a local flag with false. * It is now enabled. This is fine, will be handled in logic. Update the property. * * D) false | not there: write new property with value 'false' * E) false | true : the feature was disabled before and enabled now. To guarantee data consistency, we need to remove the flag from all executions. * Update the property. * F) false | false : all good * * In case A and D (not there), the property needs to be written to the db * Only in case E something needs to be done explicitely, the others are okay. */ IPropertyEntityManager propertyEntityManager = commandContext.PropertyEntityManager; bool configProperty = commandContext.ProcessEngineConfiguration.PerformanceSettings.EnableExecutionRelationshipCounts; IPropertyEntity propertyEntity = propertyEntityManager.FindById <PropertyEntityImpl>(new KeyValuePair <string, object>("name", PROPERTY_EXECUTION_RELATED_ENTITY_COUNT)); if (propertyEntity == null) { // 'not there' case in the table above: easy, simply insert the value IPropertyEntity newPropertyEntity = propertyEntityManager.Create(); newPropertyEntity.Name = PROPERTY_EXECUTION_RELATED_ENTITY_COUNT; newPropertyEntity.Value = Convert.ToString(configProperty); propertyEntityManager.Insert(newPropertyEntity); } else { bool propertyValue = Convert.ToBoolean(propertyEntity.Value.ToString().ToLower()); if (!configProperty && propertyValue) { if (log.IsEnabled(LogLevel.Information)) { log.LogInformation("Configuration change: execution related entity counting feature was enabled before, but now disabled. " + "Updating all execution entities."); } commandContext.ProcessEngineConfiguration.ExecutionDataManager.UpdateAllExecutionRelatedEntityCountFlags(configProperty); } // Update property if (configProperty != propertyValue) { propertyEntity.Value = Convert.ToString(configProperty); propertyEntityManager.Update(propertyEntity); } } return(commandContext.GetResult()); }
/// <summary> /// Returns all classes from graph related with propertyEntity by PropertyRelationship. /// </summary> /// <param name="entity"></param> /// <returns></returns> public IEntitySet <IClassEntity> GetClasses(IPropertyEntity entity) { IEntitySet <IClassEntity> temp = new EntitySet <IClassEntity>(); foreach (PropertyRelationship pr in PropertyRelationships.GetItems()) { if (pr.Property.Identity == entity.Identity) { temp.Add(pr.Class); } } return(temp); }
protected void Print(IPropertyEntity propertyEntity) { SW.WriteLine("object property {0}", propertyEntity.Identity); SW.WriteLine("{"); //print parents foreach (IPropertyEntity parent in Graph.GetParents(propertyEntity).GetItems()) { SW.WriteLine("\tis_subproperty_of {0};", parent.Identity); } //print domain SW.Write("\tdomain "); bool firstEntrance = true; foreach (IClassEntity classEntity in Graph.GetClasses(propertyEntity).GetItems()) { if (firstEntrance) { firstEntrance = false; SW.Write("{0}", classEntity.Value); } else { SW.Write(", {0}", classEntity.Value); } } SW.WriteLine(";"); //print range if (propertyEntity.Range != null) { SW.WriteLine("\trange {0};", propertyEntity.Range.Name); } else { SW.WriteLine("\trange bool;"); } SW.WriteLine("}"); }
// public bool IsTrue = false; public ClassPropertyCondition(IClassEntity classEntity, IPropertyEntity propertyEntity) { ClassEntity = classEntity; PropertyEntity = propertyEntity; }
public void Add(IPropertyEntity propertyEntity) { Graph.Add(propertyEntity); }
// public ClassPropertyCondition ElseCondition; public ConditionalRule(IClassEntity classEntity, IPropertyEntity ifProperty, IPropertyEntity thenProperty) { IfCondition = new ClassPropertyCondition(classEntity, ifProperty); ThenCondition = new ClassPropertyCondition(classEntity, thenProperty); }
/// <summary> /// Returns all parent properties of property entity from graph. /// </summary> /// <param name="entity"></param> /// <returns>All parent properties.</returns> public IEntitySet <IPropertyEntity> GetParents(IPropertyEntity entity) { return(new EntitySet <IPropertyEntity>()); }
/// <summary> /// Adds IPropertyEntity to the graph. /// </summary> /// <param name="propertyEntity"></param> public void Add(IPropertyEntity propertyEntity) { Properties.Add(propertyEntity); }