Пример #1
0
        public static void GenerateEjbProjectContent(Component project, MavenProjectStructure paths, JavaImportCollector imports)
        {
            List <string> importlist = null;

            foreach (var service in project.Services)
            {
                importlist = imports.GetFullImportObjectNamesForObject(project.Name, service.Interface.Namespace.Name, service.Interface.Name);
                JavaPrinter.PrintInterface(service.Interface, paths.mainJavaPath, importlist);
            }
            importlist = imports.GetFullImportObjectNamesForObject(project.Name, project.Namespace.Name, project.Name);
            JavaEePrinter.PrintEjb(project, paths.mainJavaPath, importlist);
        }
Пример #2
0
 public static void GenerateJavaInterfaces(Component project, MavenProjectStructure mstruc, JavaImportCollector imports)
 {
     foreach (var service in project.Services)
     {
         List <string> importlist = imports.GetFullImportObjectNamesForObject(project.Name, service.Interface.Namespace.Name, service.Interface.Name);
         JavaPrinter.PrintInterface(service.Interface, mstruc.mainJavaPath, importlist);
     }
 }
Пример #3
0
        public static void GenerateJpaProjectContent(Component project, MavenProjectStructure mstruc, JavaImportCollector imports)
        {
            Database db = null;

            foreach (var service in project.Services)
            {
                db = service.Interface as Database;
                if (db != null)
                {
                    break;
                }
            }

            List <String> classes = new List <string>();

            if (db != null)
            {
                foreach (var entity in db.Entities)
                {
                    List <string> importlist = imports.GetFullImportObjectNamesForObject(project.Name, entity.Namespace.Name, entity.Name);
                    classes.Add(entity.FullName);
                    JavaEePrinter.PrintJpaEntity(entity, mstruc.mainJavaPath, db.Entities.ToList(), importlist);
                }
                Directory.CreateDirectory(mstruc.METAINFPath);

                List <PersistenceXmlProperty> proplist = new List <PersistenceXmlProperty>();
                if (JpaConfigHandler.configOn)
                {
                    proplist.Add(new PersistenceXmlProperty(
                                     JpaConfigHandler.getValue(JpaConfigConstants.URL_PROP_NAME),
                                     JpaConfigHandler.getValue(JpaConfigConstants.URL_PROP_VALUE)));
                    proplist.Add(new PersistenceXmlProperty(
                                     JpaConfigHandler.getValue(JpaConfigConstants.USERNAME_PROP_NAME),
                                     JpaConfigHandler.getValue(JpaConfigConstants.USERNAME_PROP_VALUE)));
                    proplist.Add(new PersistenceXmlProperty(
                                     JpaConfigHandler.getValue(JpaConfigConstants.PASSWORD_PROP_NAME),
                                     JpaConfigHandler.getValue(JpaConfigConstants.PASSWORD_PROP_VALUE)));
                    proplist.Add(new PersistenceXmlProperty(
                                     JpaConfigHandler.getValue(JpaConfigConstants.DRIVER_PROP_NAME),
                                     JpaConfigHandler.getValue(JpaConfigConstants.DRIVER_PROP_VALUE)));
                    proplist.Add(new PersistenceXmlProperty(
                                     JpaConfigHandler.getValue(JpaConfigConstants.GENERATION_PROP_NAME),
                                     JpaConfigHandler.getValue(JpaConfigConstants.GENERATION_PROP_VALUE)));
                }

                //JavaEePrinter.PrintAllEnum(ns, mstruc.mainJavaPath);

                JavaEePrinter.PrintPersistenceXml
                (
                    JpaConfigHandler.getValue(JpaConfigConstants.PERSISTENCE_UNIT),
                    JpaConfigHandler.getValue(JpaConfigConstants.PERSISTENCE_UNIT_PROVIDER),
                    classes,
                    proplist,
                    mstruc.METAINFPath
                );
            }
        }
Пример #4
0
        public static void GenerateUsedObjects(Component project, MavenProjectStructure mstruc, JavaImportCollector imports)
        {
            var iobjList = imports.GetImportsForProject(project.Name);

            foreach (var iobj in iobjList)
            {
                foreach (var dec in project.Namespace.Declarations)
                {
                    if (dec.Name.Equals(iobj.importObjectName))
                    {
                        if (dec.Name.Contains("Exception"))
                        {
                            var ex = dec as Struct;
                            if (ex != null)
                            {
                                JavaPrinter.PrintException(ex, mstruc.mainJavaPath);
                            }
                        }
                        else if (dec.MMetaClass.Name.Equals("Enum"))
                        {
                            var en = dec as Symbols.Enum;
                            if (en != null)
                            {
                                JavaPrinter.PrintEnum(en, mstruc.mainJavaPath);
                            }
                        }
                        else
                        {
                            var st = dec as Struct;
                            if (st != null)
                            {
                                List <string> importlist = imports.GetFullImportObjectNamesForObject(project.Name, project.Namespace.Name, st.Name);
                                JavaEePrinter.PrintJpaEntity(st, mstruc.mainJavaPath, new List <Struct>(), importlist);
                            }
                        }
                    }
                }
            }
        }