@Test public void testGetSequenceName() throws IOException { System.out.println("testGetSequenceName"); EngineConfiguration engineConf = EngineConfiguration.createFromProperties("test-config-oracle11.properties"); ModelBuilder instance = new ModelBuilder(null, engineConf, new Oracle11ModelBuilderConfig(), new LocalisedMessages("messages", null)); Field pkField = new Field(true, false, false, false, false, false, false, null, "CUS_ID", "NUMBER(10)", "ID field", "id", "java.lang.Long"); Field nameField = new Field(false, false, false, false, false, false, false, null, "CUS_NAME", "VARCHAR2", "Name field", "name", "java.lang.String"); Table table = new Table("TST_CUSTOMER", "Test comment", "Customer", Arrays.asList(pkField, nameField)); engineConf.setSequenceNameConvention(EngineConfiguration.SEQUENCE_NAME_CONVENTION.PREFIXED_TABLE_NAME); assertEquals("SEQ_TST_CUSTOMER", instance.getSequenceName(table)); engineConf.setSequenceNameConvention(EngineConfiguration.SEQUENCE_NAME_CONVENTION.PREFIXED_FIELD_NAME); assertEquals("SEQ_CUS_ID", instance.getSequenceName(table)); engineConf.setSequenceNameConvention(EngineConfiguration.SEQUENCE_NAME_CONVENTION.SUFFIXED_TABLE_NAME); assertEquals("TST_CUSTOMER_SEQ", instance.getSequenceName(table)); engineConf.setSequenceNameConvention(EngineConfiguration.SEQUENCE_NAME_CONVENTION.SUFFIXED_FIELD_NAME); assertEquals("CUS_ID_SEQ", instance.getSequenceName(table)); engineConf.setSequenceNameConvention(EngineConfiguration.SEQUENCE_NAME_CONVENTION.PREFIXED_TABLE_NAME_WITH_FIELD_NAME); assertEquals("SEQ_TST_CUSTOMER_CUS_ID", instance.getSequenceName(table)); engineConf.setSequenceNameConvention(EngineConfiguration.SEQUENCE_NAME_CONVENTION.SUFFIXED_TABLE_NAME_WITH_FIELD_NAME); assertEquals("TST_CUSTOMER_CUS_ID_SEQ", instance.getSequenceName(table)); }
protected String getSequenceName(Table table) { List<Field> pkFields = table.getPkFields(); String sequenceName = null; if (pkFields.size() == 1) { Field pkField = table.getPkField(); if (pkField.isInteger()) { switch (engineConf.getSequenceNameConvention()) { case PREFIXED_TABLE_NAME: sequenceName = "SEQ_" + table.getDbName(); break; case PREFIXED_FIELD_NAME: sequenceName = "SEQ_" + pkField.getDbName(); break; case SUFFIXED_TABLE_NAME: sequenceName = table.getDbName() + "_SEQ"; break; case SUFFIXED_FIELD_NAME: sequenceName = pkField.getDbName() + "_SEQ"; break; case PREFIXED_TABLE_NAME_WITH_FIELD_NAME: sequenceName = String.format("SEQ_%s_%s", table.getDbName(), pkField.getDbName()); break; case SUFFIXED_TABLE_NAME_WITH_FIELD_NAME: sequenceName = String.format("%s_%s_SEQ", table.getDbName(), pkField.getDbName()); break; } } } return sequenceName; }
ModelBuilder { protected String getSequenceName(Table table) { List<Field> pkFields = table.getPkFields(); String sequenceName = null; if (pkFields.size() == 1) { Field pkField = table.getPkField(); if (pkField.isInteger()) { switch (engineConf.getSequenceNameConvention()) { case PREFIXED_TABLE_NAME: sequenceName = "SEQ_" + table.getDbName(); break; case PREFIXED_FIELD_NAME: sequenceName = "SEQ_" + pkField.getDbName(); break; case SUFFIXED_TABLE_NAME: sequenceName = table.getDbName() + "_SEQ"; break; case SUFFIXED_FIELD_NAME: sequenceName = pkField.getDbName() + "_SEQ"; break; case PREFIXED_TABLE_NAME_WITH_FIELD_NAME: sequenceName = String.format("SEQ_%s_%s", table.getDbName(), pkField.getDbName()); break; case SUFFIXED_TABLE_NAME_WITH_FIELD_NAME: sequenceName = String.format("%s_%s_SEQ", table.getDbName(), pkField.getDbName()); break; } } } return sequenceName; } }
ModelBuilder { protected String getSequenceName(Table table) { List<Field> pkFields = table.getPkFields(); String sequenceName = null; if (pkFields.size() == 1) { Field pkField = table.getPkField(); if (pkField.isInteger()) { switch (engineConf.getSequenceNameConvention()) { case PREFIXED_TABLE_NAME: sequenceName = "SEQ_" + table.getDbName(); break; case PREFIXED_FIELD_NAME: sequenceName = "SEQ_" + pkField.getDbName(); break; case SUFFIXED_TABLE_NAME: sequenceName = table.getDbName() + "_SEQ"; break; case SUFFIXED_FIELD_NAME: sequenceName = pkField.getDbName() + "_SEQ"; break; case PREFIXED_TABLE_NAME_WITH_FIELD_NAME: sequenceName = String.format("SEQ_%s_%s", table.getDbName(), pkField.getDbName()); break; case SUFFIXED_TABLE_NAME_WITH_FIELD_NAME: sequenceName = String.format("%s_%s_SEQ", table.getDbName(), pkField.getDbName()); break; } } } return sequenceName; } ModelBuilder(Connection con,
            EngineConfiguration engineConf,
            IModelBuilderConfig config,
            LocalisedMessages messages); }
ModelBuilder { protected String getSequenceName(Table table) { List<Field> pkFields = table.getPkFields(); String sequenceName = null; if (pkFields.size() == 1) { Field pkField = table.getPkField(); if (pkField.isInteger()) { switch (engineConf.getSequenceNameConvention()) { case PREFIXED_TABLE_NAME: sequenceName = "SEQ_" + table.getDbName(); break; case PREFIXED_FIELD_NAME: sequenceName = "SEQ_" + pkField.getDbName(); break; case SUFFIXED_TABLE_NAME: sequenceName = table.getDbName() + "_SEQ"; break; case SUFFIXED_FIELD_NAME: sequenceName = pkField.getDbName() + "_SEQ"; break; case PREFIXED_TABLE_NAME_WITH_FIELD_NAME: sequenceName = String.format("SEQ_%s_%s", table.getDbName(), pkField.getDbName()); break; case SUFFIXED_TABLE_NAME_WITH_FIELD_NAME: sequenceName = String.format("%s_%s_SEQ", table.getDbName(), pkField.getDbName()); break; } } } return sequenceName; } ModelBuilder(Connection con,
            EngineConfiguration engineConf,
            IModelBuilderConfig config,
            LocalisedMessages messages); final void build(); List<Table> getTableList(); List<Index> getIndexListForTable(Table table); }
ModelBuilder { protected String getSequenceName(Table table) { List<Field> pkFields = table.getPkFields(); String sequenceName = null; if (pkFields.size() == 1) { Field pkField = table.getPkField(); if (pkField.isInteger()) { switch (engineConf.getSequenceNameConvention()) { case PREFIXED_TABLE_NAME: sequenceName = "SEQ_" + table.getDbName(); break; case PREFIXED_FIELD_NAME: sequenceName = "SEQ_" + pkField.getDbName(); break; case SUFFIXED_TABLE_NAME: sequenceName = table.getDbName() + "_SEQ"; break; case SUFFIXED_FIELD_NAME: sequenceName = pkField.getDbName() + "_SEQ"; break; case PREFIXED_TABLE_NAME_WITH_FIELD_NAME: sequenceName = String.format("SEQ_%s_%s", table.getDbName(), pkField.getDbName()); break; case SUFFIXED_TABLE_NAME_WITH_FIELD_NAME: sequenceName = String.format("%s_%s_SEQ", table.getDbName(), pkField.getDbName()); break; } } } return sequenceName; } ModelBuilder(Connection con,
            EngineConfiguration engineConf,
            IModelBuilderConfig config,
            LocalisedMessages messages); final void build(); List<Table> getTableList(); List<Index> getIndexListForTable(Table table);  }