public void PropertyKey() { Assert.AreEqual("prop1", CategoryUtil.GetPropertyKey("/a/b/prop1")); }
private void DoRegister(string configKey, PropertyDefinition definition) { definition.FullKey = configKey; definition.Key = CategoryUtil.GetPropertyKey(configKey); _dao.Save(definition); }
public PropertyDefinition(string fullKey) { FullKey = fullKey; Key = CategoryUtil.GetPropertyKey(fullKey); Visible = true; }
private void DoRegister(string configKey, string query, WhereClauseRegisterCondition condition) { if (condition != null && condition.Environment != null && condition.Environment != ApplicationConfiguration.Profile) { //we don´t need to register this property here. return; } if (condition == null) { //if no condition is passed, we just need to update the base definition data var definition = new PropertyDefinition { FullKey = configKey, Key = CategoryUtil.GetPropertyKey(configKey), StringValue = query, DataType = typeof(string).Name, Renderer = "whereclause", Alias = "", Contextualized = true }; _dao.Save(definition); return; } var savedDefinition = _dao.FindSingleByQuery <PropertyDefinition>(PropertyDefinition.ByKey, configKey); Condition storedCondition = null; if (condition.Alias != null) { //this means that we actually have a condition rather then just a simple utility class WhereClauseRegisterCondition storedCondition = _dao.FindSingleByQuery <WhereClauseCondition>(Condition.ByAlias, condition.Alias); if (storedCondition != null) { condition.Id = storedCondition.Id; } storedCondition = _dao.Save(condition.RealCondition); } var profile = new UserProfile(); if (condition.UserProfile != null) { profile = UserProfileManager.FindByName(condition.UserProfile); if (condition.UserProfile != null && profile == null) { Log.Warn(String.Format("unable to register definition as profile {0} does not exist", condition.UserProfile)); return; } } var storedValue = _dao.FindSingleByQuery <PropertyValue>( PropertyValue.ByDefinitionConditionModuleProfile, savedDefinition.FullKey, storedCondition, condition.Module, profile.Id); if (storedValue == null) { var newValue = new PropertyValue { Condition = storedCondition, Definition = savedDefinition, SystemStringValue = query, Module = condition.Module, UserProfile = profile.Id }; _dao.Save(newValue); } else { storedValue.SystemStringValue = query; _dao.Save(storedValue); } }