@@ -86,7 +86,7 @@ var errType;
8686/*============================================================================*/
8787
8888function versaoBiblioteca() {
89- var versao = "Versão: 1.0.24.01 .2019";
89+ var versao = "Versão: 1.0.05.02 .2019";
9090 var titulo = "TJRS - Biblioteca de scripts";
9191
9292 javax.swing.JOptionPane
@@ -688,39 +688,43 @@ function validateTableTablespaceUsage(table) {
688688
689689 var result = true;
690690
691- var model table.getDesignPart();
692-
693- // Get the expected amount of rows
691+ // Gets the reference to the model
692+ model = table.getDesignPart();
693+
694+ // Retrieve from physical model the table storage
695+ tableStorage = model.getStorageDesign().getStorageObject(table.getObjectID());
696+
697+ // Gets the tablespace assigned to the table
698+ tableTablespace = tableStorage.getTableSpace();
699+
700+ // Gets the expected amount of rows
694701 tableVolumetry = table.getExpectedVolumes();
695- if (tableVolumetry != null) {
696702
697- //ruleMessage = "Invalid tablespace definition. Using "
698- //
699- //if (tableVolumetry >= START_RANGE_SMALL && tableVolumetry <= END_RANGE_SMALL) {
700- // tableSpaceName = model.getStorageDesign().getTableSpaceSet().getByName(TABLE_TABLESPACE_SMALL).getName();
701- // if (!tableSpaceName.equals(TABLE_TABLESPACE_SMALL)) {
702- // result = false;
703- // ruleMessage += tableSpaceName;
704- // ruleMessage += " instead of " + TABLE_TABLESPACE_SMALL;
705- // errType = "Error";
706- // }
707- //} else if (tableVolumetry >= START_RANGE_MEDIUM && tableVolumetry <= END_RANGE_MEDIUM) {
708- // tableSpace = model.getStorageDesign().getTableSpaceSet().getByName(TABLE_TABLESPACE_MEDIUM);
709- // if (!tableSpaceName.equals(TABLE_TABLESPACE_MEDIUM)) {
710- // result = false;
711- // ruleMessage += tableSpaceName;
712- // ruleMessage += " instead of " + TABLE_TABLESPACE_MEDIUM;
713- // errType = "Error";
714- // }
715- //} else if (tableVolumetry >= START_RANGE_LARGE) {
716- // tableSpace = model.getStorageDesign().getTableSpaceSet().getByName(TABLE_TABLESPACE_LARGE);
717- // if (!tableSpaceName.equals(START_RANGE_LARGE)) {
718- // result = false;
719- // ruleMessage += tableSpaceName;
720- // ruleMessage += " instead of " + START_RANGE_LARGE;
721- // errType = "Error";
722- // }
723- //}
703+ // Validate tablespace being used by the table based on its volumetry
704+ if (tableVolumetry != null) {
705+ ruleMessage = "Invalid tablespace definition. Using "
706+ if (tableVolumetry >= START_RANGE_SMALL && tableVolumetry <= END_RANGE_SMALL) {
707+ if (!tableTablespace.getName().equals(TABLE_TABLESPACE_SMALL)) {
708+ result = false;
709+ ruleMessage += tableTablespace;
710+ ruleMessage += " instead of " + TABLE_TABLESPACE_SMALL;
711+ errType = "Error";
712+ }
713+ } else if (tableVolumetry >= START_RANGE_MEDIUM && tableVolumetry <= END_RANGE_MEDIUM) {
714+ if (!tableTablespace.getName().equals(TABLE_TABLESPACE_MEDIUM)) {
715+ result = false;
716+ ruleMessage += tableTablespace;
717+ ruleMessage += " instead of " + TABLE_TABLESPACE_MEDIUM;
718+ errType = "Error";
719+ }
720+ } else if (tableVolumetry >= START_RANGE_LARGE) {
721+ if (!tableTablespace.getName().equals(START_RANGE_LARGE)) {
722+ result = false;
723+ ruleMessage += tableTablespace;
724+ ruleMessage += " instead of " + START_RANGE_LARGE;
725+ errType = "Error";
726+ }
727+ }
724728 }
725729
726730 return result;
0 commit comments