Esempio n. 1
0
 public bool uploadTemplate(Template newTemplate)
 {
     try
     {
         bool myBool = TemplateAccessor.UploadTemplate(newTemplate);
         return(myBool);
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 2
0
        public List <Template> retriveAllTemplate()
        {
            List <Template> TemplateList;

            try
            {
                TemplateList = TemplateAccessor.RetrieveAllTemplate();
                return(TemplateList);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 3
0
        public Template retriveTemplate(int TemplateId)
        {
            Template myTemplate = new Template();

            try
            {
                myTemplate = TemplateAccessor.RetrieveTemplateById(TemplateId);
                return(myTemplate);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 4
0
 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);
             }
         }
     }
 }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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);
        }