Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
Anderson Bestteti Santos committed Feb 5, 2019
2 parents 62f2630 + 7479f14 commit ac991a1
Show file tree
Hide file tree
Showing 4 changed files with 455 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,9 @@ checkFKColumns(index);]]>
<![CDATA[]]>
</script>
</scr>
<scr id="756DE154-799A-42CB-7E46-A162B768E6B6" name="TJRS - Tables with wrong tablespace usage" object="Table" engine="Oracle Nashorn" type="Error" var="table" library="TJRS lib" method="validateTableTablespaceUsage" purpose="validation" >
<script>
<![CDATA[]]>
</script>
</scr>
</custom__validation_scripts>
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ var errType;
/*============================================================================*/
function versaoBiblioteca() {
var versao = "Versão: 1.0.24.01.2019";
var versao = "Versão: 1.0.05.02.2019";
var titulo = "TJRS - Biblioteca de scripts";
javax.swing.JOptionPane
Expand Down Expand Up @@ -688,39 +688,43 @@ function validateTableTablespaceUsage(table) {
var result = true;
var model table.getDesignPart();
// Get the expected amount of rows
// Gets the reference to the model
model = table.getDesignPart();
// Retrieve from physical model the table storage
tableStorage = model.getStorageDesign().getStorageObject(table.getObjectID());
// Gets the tablespace assigned to the table
tableTablespace = tableStorage.getTableSpace();
// Gets the expected amount of rows
tableVolumetry = table.getExpectedVolumes();
if (tableVolumetry != null) {
//ruleMessage = "Invalid tablespace definition. Using "
//
//if (tableVolumetry >= START_RANGE_SMALL && tableVolumetry <= END_RANGE_SMALL) {
// tableSpaceName = model.getStorageDesign().getTableSpaceSet().getByName(TABLE_TABLESPACE_SMALL).getName();
// if (!tableSpaceName.equals(TABLE_TABLESPACE_SMALL)) {
// result = false;
// ruleMessage += tableSpaceName;
// ruleMessage += " instead of " + TABLE_TABLESPACE_SMALL;
// errType = "Error";
// }
//} else if (tableVolumetry >= START_RANGE_MEDIUM && tableVolumetry <= END_RANGE_MEDIUM) {
// tableSpace = model.getStorageDesign().getTableSpaceSet().getByName(TABLE_TABLESPACE_MEDIUM);
// if (!tableSpaceName.equals(TABLE_TABLESPACE_MEDIUM)) {
// result = false;
// ruleMessage += tableSpaceName;
// ruleMessage += " instead of " + TABLE_TABLESPACE_MEDIUM;
// errType = "Error";
// }
//} else if (tableVolumetry >= START_RANGE_LARGE) {
// tableSpace = model.getStorageDesign().getTableSpaceSet().getByName(TABLE_TABLESPACE_LARGE);
// if (!tableSpaceName.equals(START_RANGE_LARGE)) {
// result = false;
// ruleMessage += tableSpaceName;
// ruleMessage += " instead of " + START_RANGE_LARGE;
// errType = "Error";
// }
//}
// Validate tablespace being used by the table based on its volumetry
if (tableVolumetry != null) {
ruleMessage = "Invalid tablespace definition. Using "
if (tableVolumetry >= START_RANGE_SMALL && tableVolumetry <= END_RANGE_SMALL) {
if (!tableTablespace.getName().equals(TABLE_TABLESPACE_SMALL)) {
result = false;
ruleMessage += tableTablespace;
ruleMessage += " instead of " + TABLE_TABLESPACE_SMALL;
errType = "Error";
}
} else if (tableVolumetry >= START_RANGE_MEDIUM && tableVolumetry <= END_RANGE_MEDIUM) {
if (!tableTablespace.getName().equals(TABLE_TABLESPACE_MEDIUM)) {
result = false;
ruleMessage += tableTablespace;
ruleMessage += " instead of " + TABLE_TABLESPACE_MEDIUM;
errType = "Error";
}
} else if (tableVolumetry >= START_RANGE_LARGE) {
if (!tableTablespace.getName().equals(START_RANGE_LARGE)) {
result = false;
ruleMessage += tableTablespace;
ruleMessage += " instead of " + START_RANGE_LARGE;
errType = "Error";
}
}
}
return result;
Expand Down
Loading

0 comments on commit ac991a1

Please sign in to comment.