public bool uploadTemplate(Template newTemplate) { try { bool myBool = TemplateAccessor.UploadTemplate(newTemplate); return(myBool); } catch (Exception) { throw; } }
public List <Template> retriveAllTemplate() { List <Template> TemplateList; try { TemplateList = TemplateAccessor.RetrieveAllTemplate(); return(TemplateList); } catch (Exception) { throw; } }
public Template retriveTemplate(int TemplateId) { Template myTemplate = new Template(); try { myTemplate = TemplateAccessor.RetrieveTemplateById(TemplateId); return(myTemplate); } catch (Exception) { throw; } }
private void ResolveConfigPathByTemplate(Optional <TemplateAccessor> templateAccessor) { if (templateAccessor.IsPresent()) { TemplateAccessor accessor = templateAccessor.Get(); if (accessor.HasConfigPath()) { TemplateDescription templateDescription = accessor.TemplateDescription; if (templateDescription.IsOverridedConfigPath()) { accessor.ConfigPath = templateDescription.OverrideConfigPath(accessor.ConfigPath); } } } }
public object Decode(ProtocolBuffer protocolBuffer) { object obj2; long id = (long)this.longCodec.Decode(protocolBuffer); TemplateDescription templateInfo = this.templateRegistry.GetTemplateInfo(id); string configPath = (string)this.stringCodec.Decode(protocolBuffer); try { obj2 = new TemplateAccessor(templateInfo, configPath); } catch (Exception exception) { throw new Exception("templateType = " + templateInfo, exception); } return(obj2); }
public static bool Update(EntityInternal entity, Component component, INamingConvention nameConvertor = null) { INamingConvention convention = ComponentInstanceDataUpdater.nameConvertor; if (!entity.TemplateAccessor.IsPresent()) { return(false); } TemplateAccessor accessor = entity.TemplateAccessor.Get(); if (!accessor.HasConfigPath()) { return(false); } if (nameConvertor != null) { convention = nameConvertor; } Type componentType = component.GetType(); if (!accessor.TemplateDescription.IsComponentDescriptionPresent(componentType)) { return(false); } ComponentDescription componentDescription = accessor.TemplateDescription.GetComponentDescription(componentType); if (!componentDescription.IsInfoPresent(typeof(ConfigComponentInfo))) { return(false); } string keyName = componentDescription.GetInfo <ConfigComponentInfo>().KeyName; if (!accessor.YamlNode.HasValue(keyName)) { return(false); } UpdateComponentData(component, accessor.YamlNode.GetChildNode(keyName), convention); return(true); }