public override void Execute(ES.Environment env)
        {
            UML.Property attribute = (UML.Property)env.CurrentInputElement;
            TT.Table templTable = (TT.Table)env.CurrentOutputElement;
            bool isMultivalued = attribute.Upper > 1;

            TT.Column column = new TT.Column(attribute);
            templTable.ColumnsName.Add(column);
            column.ColumnName = attribute.Name;
            if(isMultivalued)
            {
                column.Type = "array";
            }
            else
            {
                column.Type = attribute.Type.QualifiedName.Replace("::", ".").Split('.')[1];
            }
            column.MoreColumn = ",";

            if (attribute.Visibility == [email protected] )
            {
                System.Console.WriteLine("nombre de la columna" + column.ColumnName);
                templTable.PrimaryKeys.Add(column.ColumnName);
            }
        }
Example #2
0
        public Expert(ES.Environment env)
            : base(env)
        {
            ES.Rule processDeserializedElementsRule = new ProcessDeserializedElementsRule();
            ES.Rule processClassRule = new ProcesClassRule();
            ES.Rule processAttributeRule = new ProcessAttributeRule();
            ES.Rule serializeClassRule = new SerializeClassRule();
            ES.Rule navigateClassRule = new NavigateClassRule();
            ES.Rule navigationPackageRule = new NavigatePackageRule();

            base.AddRule(processDeserializedElementsRule);
            base.AddRule(navigationPackageRule);
            base.AddRule(navigateClassRule);
            base.AddRule(processClassRule);
            base.AddRule(processAttributeRule);
            base.AddRule(serializeClassRule);

            //Precedencia

            base.AddPrecedence(new ES.Precedence(
                processClassRule, navigateClassRule, ES.PrecedenceKind.Precedence, ES.CouplingKind.Independent));

             base.AddPrecedence(new ES.Precedence(
                navigateClassRule, serializeClassRule, ES.PrecedenceKind.Precedence, ES.CouplingKind.Independent));
        }
 public override void Execute(ES.Environment env)
 {
     TT.Table tbl = (TT.Table)env.CurrentOutputElement;
     string filepath = Path.Combine(OutputPath, tbl.TableName + ".sql");
     if(env.VerboseLevel>1)
         Console.WriteLine("SerializeClassRule> writing file: " + filepath);
     StreamWriter writer = new StreamWriter(filepath);
     writer.Write(tbl.ToString());
     writer.Close();
 }
 public override void Execute(ES.Environment env)
 {
     foreach(object o in (IEnumerable)env.InputModel)
     {
         env.PushState();
         env.CurrentInputElement = o;
         System.Console.WriteLine("objeto en push " +o);
         env.Expert.Process();
         env.PopState();
     }
 }
 public override void Execute(ES.Environment env)
 {
     UML.Class cls = (UML.Class)env.CurrentInputElement;
     foreach(UML.Property attribute in cls.Attribute)
     {
         env.PushState();
         env.CurrentInputElement = attribute;
         env.Expert.Process();
         env.PopState();
     }
 }
Example #6
0
 public override void Execute(ES.Environment env)
 {
     UML.Class umlClass = (UML.Class)env.CurrentInputElement;
     TT.Table tbl = new TT.Table(umlClass);
     tbl.TableName = umlClass.Name;
     tbl.IsAbstract = umlClass.IsAbstract;
     tbl.IsSealed = umlClass.IsLeaf;
     UML.Package pkg = umlClass.Package;
     if(pkg!=null)
     {
         tbl.SchemaName = pkg.QualifiedName.Replace("::", ".");
     }
     env.PushState();
     env.CurrentOutputElement = tbl;
     env.Expert.Process();
     env.PopState();
 }
 public override void Execute(ES.Environment env)
 {
     UML.Package pkg = env.CurrentInputElement as UML.Package;
     foreach(UML.Type type in pkg.OwnedType)
     {
         type.Package = pkg;
         if(env.VerboseLevel>=2)
             Console.WriteLine("    - NavigatePackageRule: cie=" + ((UML.NamedElement)type).Name);
         env.PushState();
         env.CurrentInputElement = type;
         env.Expert.Process();
         env.PopState();
     }
     foreach(UML.Package nestedPkg in pkg.NestedPackage)
     {
         nestedPkg.NestingPackage = pkg;
         env.PushState();
         env.CurrentInputElement = nestedPkg;
         env.Expert.Process();
         env.PopState();
     }
 }
 public override bool IsActiveInState(ES.Environment env)
 {
     return env.CurrentInputElement==env.InputModel;
 }
 public override bool IsActiveInState(ES.Environment env)
 {
     UML.Package pkg = env.CurrentInputElement as UML.Package;
     return pkg!=null && ((UML.NamedElement)pkg).Name!="System";
 }