コード例 #1
0
 internal ProjectPropertyTextType(ProjectGroupCodesProvider provider, string propKey) : base()
 {
     this.provider = provider;
     this.propKey  = propKey;
 }
コード例 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void loadDB() throws Exception
        public override void loadDB()
        {
            if (DBLoaded)
            {
                return;
            }
            if (syncToEventDispatch && !SwingUtilities.EventDispatchThread)
            {
                this.o_retException = null;
                SwingUtilities.invokeAndWait(new RunnableAnonymousInnerClass(this));
                if (this.o_retException != null)
                {
                    throw this.o_retException;
                }
                return;
            }
            if (this.o_properties != null && !string.ReferenceEquals(this.o_properties.PreviousVersion, null))
            {
                if (this.o_properties.isOlderVersionFrom(this.o_properties.PreviousVersion, "4.0.1"))
                {
                    Console.WriteLine("Deleting indexes prior to 4.0.1 from version " + this.o_properties.PreviousVersion);
                    try
                    {
                        Console.WriteLine("deleting: " + new File(installDir + "project/" + this.o_projectFolderName + "/indexBase"));
                        deleteDirectory(new File(installDir + "project/" + this.o_projectFolderName + "/indexBase"));
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine(exception.ToString());
                        Console.Write(exception.StackTrace);
                    }
                }
                if (this.o_properties.isOlderVersionFrom(this.o_properties.PreviousVersion, "4.2.7"))
                {
                    Properties properties = new Properties();
                    properties.setProperty("user", "SA");
                    properties.setProperty("password", "");
                    properties.setProperty("shutdown", "true");
                    initDriver(HSQL_DBMS);
                    Connection connection = DriverManager.getConnection("jdbc:hsqldb:" + installDir + "project/" + this.o_projectFolderName + "/projectDB", properties);
                    if (!connection.AutoCommit)
                    {
                        connection.commit();
                    }
                    Statement statement = connection.createStatement();
                    try
                    {
                        Console.WriteLine("Renaming the Condition Table to CNDON...");
                        statement.execute("DROP TABLE IF EXISTS CNDON");
                        statement.execute("ALTER TABLE CONDITION RENAME TO CNDON");
                        Console.WriteLine("OK!");
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine(exception.ToString());
                        Console.Write(exception.StackTrace);
                        Console.WriteLine("TABLE WITH NAME CONDITION NOT FOUND!");
                    }
                    statement.close();
                    connection.close();
                }
                if (this.o_properties.isOlderVersionFrom(this.o_properties.PreviousVersion, "4.6.0"))
                {
                    Properties properties = new Properties();
                    properties.setProperty("user", "SA");
                    properties.setProperty("password", "");
                    properties.setProperty("shutdown", "true");
                    initDriver(HSQL_DBMS);
                    Connection connection = DriverManager.getConnection("jdbc:hsqldb:" + installDir + "project/" + this.o_projectFolderName + "/projectDB", properties);
                    if (!connection.AutoCommit)
                    {
                        connection.commit();
                    }
                    Statement statement = connection.createStatement();
                    try
                    {
                        Console.WriteLine("Updating data integrity...");
                        statement.execute("ALTER TABLE BOQITEM ALTER COLUMN DESCRIPTION LONGVARCHAR");
                        statement.execute("ALTER TABLE BOQITEM ALTER COLUMN NOTES LONGVARCHAR");
                        statement.execute("ALTER TABLE EQUIPMENT ALTER COLUMN DESCRIPTION LONGVARCHAR");
                        statement.execute("ALTER TABLE EQUIPMENT ALTER COLUMN NOTES LONGVARCHAR");
                        statement.execute("ALTER TABLE ASSEMBLY ALTER COLUMN DESCRIPTION LONGVARCHAR");
                        statement.execute("ALTER TABLE ASSEMBLY ALTER COLUMN NOTES LONGVARCHAR");
                        statement.execute("ALTER TABLE MATERIAL ALTER COLUMN DESCRIPTION LONGVARCHAR");
                        statement.execute("ALTER TABLE MATERIAL ALTER COLUMN NOTES LONGVARCHAR");
                        statement.execute("ALTER TABLE SUBCONTRACTOR ALTER COLUMN DESCRIPTION LONGVARCHAR");
                        statement.execute("ALTER TABLE SUBCONTRACTOR ALTER COLUMN NOTES LONGVARCHAR");
                        statement.execute("ALTER TABLE QUOTEITEM ALTER COLUMN TITLE LONGVARCHAR");
                        Console.WriteLine("OK!");
                    }
                    catch (Exception)
                    {
                    }
                    statement.close();
                    connection.close();
                }
            }
            closeSession();
            this.o_configuration = new Configuration();
            this.o_configuration.configure(configXML);
            ISet <object> set = this.o_configuration.Properties.Keys;

            string[] arrayOfString = (string[])set.toArray(new string[set.Count]);
            foreach (string str in arrayOfString)
            {
                if (str.IndexOf("search.default", StringComparison.Ordinal) != -1)
                {
                    this.o_configuration.Properties.remove(str);
                }
            }
            this.o_configuration.setProperty("hibernate.connection.isolation", "1");
            this.o_configuration.setProperty("hibernate.cache.jdbc.batch_size", "50");
            this.o_configuration.setProperty("hibernate.cache.use_second_level_cache", "false");
            this.o_configuration.setProperty("hibernate.cache.use_query_cache", "false");
            this.o_configuration.setProperty("hibernate.cache.provider_class", "org.hibernate.cache.NoCacheProvider");
            this.o_configuration.setProperty("hibernate.search.indexing_strategy", "manual");
            this.o_configuration.setProperty("hibernate.search.autoregister_listeners", "false");
            this.o_configuration.setProperty("hibernate.temp.use_jdbc_metadata_defaults", "false");
            this.o_configuration.registerTypeOverride(new CostOSString256Type(), new string[] { "costos_string" });
            this.o_configuration.registerTypeOverride(new CostOSTextType());
            this.o_configuration.registerTypeOverride(new UnitAliasType(ProjectGroupCodesProvider, "unit_alias"));
            for (sbyte b = 1; b <= 9; b++)
            {
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)10, b, "eps_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-1, b, "wbs1_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-2, b, "wbs2_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-3, b, "location_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-4, b, "paramitem_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)10, b, "eps_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-1, b, "wbs1_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-2, b, "wbs2_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-3, b, "location_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-4, b, "paramitem_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-1, b, "wbs1_level" + b + "_item_code", (short)5));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-2, b, "wbs2_level" + b + "_item_code", (short)5));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-1, b, "wbs1_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-2, b, "wbs2_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-1, b, "wbs1_level" + b + "_qty", (short)6));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)-2, b, "wbs2_level" + b + "_qty", (short)6));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)1, b, "groupcode1_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)2, b, "groupcode2_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)3, b, "groupcode3_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)4, b, "groupcode4_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)5, b, "groupcode5_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)6, b, "groupcode6_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)7, b, "groupcode7_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)8, b, "groupcode8_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)9, b, "groupcode9_level" + b + "_code", (short)2));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)1, b, "groupcode1_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)2, b, "groupcode2_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)3, b, "groupcode3_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)4, b, "groupcode4_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)5, b, "groupcode5_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)6, b, "groupcode6_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)7, b, "groupcode7_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)8, b, "groupcode8_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)9, b, "groupcode9_level" + b + "_title", (short)0));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)1, b, "groupcode1_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)2, b, "groupcode2_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)3, b, "groupcode3_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)4, b, "groupcode4_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)5, b, "groupcode5_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)6, b, "groupcode6_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)7, b, "groupcode7_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)8, b, "groupcode8_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)9, b, "groupcode9_level" + b + "_description", (short)1));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)1, b, "groupcode1_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)2, b, "groupcode2_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)3, b, "groupcode3_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)4, b, "groupcode4_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)5, b, "groupcode5_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)6, b, "groupcode6_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)7, b, "groupcode7_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)8, b, "groupcode8_level" + b + "_unit", (short)4));
                this.o_configuration.registerTypeOverride(new GroupCodeType(ProjectGroupCodesProvider, (short)9, b, "groupcode9_level" + b + "_unit", (short)4));
            }
            this.o_configuration.setListener("post-update", null);
            this.o_configuration.setListener("post-insert", null);
            this.o_configuration.setListener("post-delete", null);
            this.o_configuration.setProperty("hibernate.connection.url", "jdbc:hsqldb:" + installDir + "project/" + this.o_projectFolderName + "/projectDB;hsqldb.write_delay=false");
            this.o_sessionFactory = this.o_configuration.buildSessionFactory();
            Session session = currentSession();

            if (ProjectSchemaUpdateUtil.checkRequiresProjectIdUpdates(this))
            {
                ProjectSchemaUpdateUtil.processProjectIdUpdates(this);
            }
            closeSession();
            ProjectDBUtil projectDBUtil;

            (projectDBUtil = ProjectDBUtil.currentProjectDBUtil()).CurrentProjectDBUtil = this;
            File file = new File(installDir + "project" + File.separator + this.o_projectFolderName + File.separator + "projectDB.details");

            if (!file.exists())
            {
                this.b_isDBLoaded = true;
                if (this.o_properties == null)
                {
                    this.o_properties = new ProjectDBProperties(this, true);
                }
                else
                {
                    this.o_properties.reloadProperties();
                }
                if (!string.ReferenceEquals(this.o_properties.PreviousVersion, null))
                {
                    updateNewerDatabase();
                }
                ProjectGroupCodesProvider.initializeProjectCaches();
            }
            ProjectDBUtil.CurrentProjectDBUtil = projectDBUtil;
        }
コード例 #3
0
 public ProjectPropertyType(ProjectGroupCodesProvider provider, string key, string propKey) : this(new ProjectPropertyTextType(provider, propKey), new string[] { key })
 {
 }
コード例 #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void loadDB() throws Exception
        public override void loadDB()
        {
            if (DBLoaded)
            {
                return;
            }
            if (syncToEventDispatch && !SwingUtilities.EventDispatchThread)
            {
                this.o_retException = null;
                loadDB();
                SwingUtilities.invokeAndWait(new RunnableAnonymousInnerClass(this));
                if (this.o_retException != null)
                {
                    throw this.o_retException;
                }
                return;
            }
            closeSession();
            this.dbmsType = this.o_urlTable.Dbms.Value;
            if (this.requiresAlters)
            {
                this.o_configuration = ProjectSessionFactoryBuilder.Instance.createConfigurationFromUrl(configXML, this.o_urlTable, ProjectGroupCodesProvider, this.requiresAlters, this.o_urlTable.TablePrefix);
                long l = DateTimeHelper.CurrentUnixTimeMillis();
                Console.WriteLine("  BUILDING SESSION FACTORY...");
                this.o_sessionFactory = this.o_configuration.buildSessionFactory();
                Console.WriteLine("DONE IN: " + ((DateTimeHelper.CurrentUnixTimeMillis() - l) / 1000L));
            }
            else
            {
                if (ProjectSessionFactory.GroupCodesProvider == null)
                {
                    ProjectSessionFactory.UpGroupCodesProvider = s_providerFactory.createSharedFactory();
                }
                this.sharedGroupCodesProvider = (ProjectGroupCodesProvider)ProjectSessionFactory.GroupCodesProvider;
                long l = DateTimeHelper.CurrentUnixTimeMillis();
                Console.WriteLine("  GETTING SESSION FACTORY...");
                this.o_configuration  = ProjectSessionFactory.getConfiguration(this.dbmsType);
                this.o_sessionFactory = ProjectSessionFactory.getSessionFactory(this.dbmsType);
                Console.WriteLine("DONE IN: " + ((DateTimeHelper.CurrentUnixTimeMillis() - l) / 1000L));
            }
            currentSession();
            closeSession();
            this.b_isDBLoaded = true;
            ProjectDBUtil projectDBUtil;

            (projectDBUtil = ProjectDBUtil.currentProjectDBUtil()).CurrentProjectDBUtil = this;
            if (this.o_properties == null)
            {
                this.o_properties = new ProjectDBProperties(this, true);
            }
            else
            {
                this.o_properties.reloadProperties();
            }
            if (!string.ReferenceEquals(this.o_properties.PreviousVersion, null) && this.requiresAlters && !(s_providerFactory is nomitech.ces.utils.DummyProjectGroupCodesProviderFactory))
            {
                updateNewerDatabase();
            }
            if (this.sharedGroupCodesProvider == null)
            {
                ProjectGroupCodesProvider.initializeProjectCaches();
            }
            else
            {
                ((WBSCache)Wbs1Cache).initCache();
                ((WBS2Cache)Wbs2Cache).initCache();
                try
                {
                    ((ParamItemCache)ParamItemCache).initializeCache();
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception.ToString());
                    Console.Write(exception.StackTrace);
                }
            }
            ProjectVariableCache.initCache();
            ProjectDBUtil.CurrentProjectDBUtil = projectDBUtil;
        }