framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java
DatabaseUtil
has 63 methods (exceeds 20 allowed). Consider refactoring. Open
Open
public class DatabaseUtil {
private static final Debug.OfbizLogger module = Debug.getOfbizLogger(java.lang.invoke.MethodHandles.lookup().lookupClass());
// SCIPIO
private static final List<String> POSTGRES_FIELDTYPENAMES = UtilMisc.unmodifiableArrayList("postgres", "postnew");
Method checkDb
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public void checkDb(Map<String, ModelEntity> modelEntities, List<String> colWrongSize, List<String> messages, boolean checkPks, boolean checkFks, boolean checkFkIdx, boolean addMissing) {
Method createPrimaryKeyFetcher
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private AbstractCountingCallable createPrimaryKeyFetcher(final DatabaseMetaData dbData, final String lookupSchemaName, final boolean needsUpperCase, final Map<String, Map<String, ColumnCheckInfo>> colInfo, final Collection<String> messages, final String curTable) {
Avoid deeply nested control flow statements. Open
Open
if (fieldDefs.length > 0) {
List<ModelIndex.Field> indexFields = new ArrayList<>();
for(String fieldDef : fieldDefs) {
String colName = fieldDef;
Avoid deeply nested control flow statements. Open
Open
if (addMissing) {
// add the column
String errMsg = addColumn(entity, field);
if (UtilValidate.isNotEmpty(errMsg)) {
Avoid deeply nested control flow statements. Open
Open
if (messages != null) messages.add(message);
Method createForeignKeys
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public int createForeignKeys(ModelEntity entity, Map<String, ModelEntity> modelEntities, int constraintNameClipLength, String fkStyle, boolean useFkInitiallyDeferred, List<String> messages) {
Method makeFkConstraintClause
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public String makeFkConstraintClause(ModelEntity entity, ModelRelation modelRelation, ModelEntity relModelEntity, int constraintNameClipLength, String fkStyle, boolean useFkInitiallyDeferred) {
Avoid deeply nested control flow statements. Open
Open
for (ColumnCheckInfo ccInfo: colMap.values()) {
// -list all columns that do not have a corresponding field
if (fieldColNames.containsKey(ccInfo.columnName)) {
ModelField field = null;
Method createForeignKey
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public String createForeignKey(ModelEntity entity, ModelRelation modelRelation, ModelEntity relModelEntity, int constraintNameClipLength, String fkStyle, boolean useFkInitiallyDeferred) {
Avoid deeply nested control flow statements. Open
Open
if (colMap.size() != entity.getFieldsSize()) {
String message = "Entity [" + entity.getEntityName() + "] has " + entity.getFieldsSize() + " fields but table [" + tableName + "] has " + colMap.size() + " columns.";
Debug.logWarning(message, module);
if (messages != null) messages.add(message);
}
Avoid deeply nested control flow statements. Open
Open
if (!modelIndex.isAutoIndex()) {
ModelIndex dbIndex = readModelIndexFromDb(entity, modelIndex);
if (dbIndex == null) {
// Not be supported on all DBs
//Debug.logWarning("Could not read entity [" + entityName + "] index [" + modelIndex.getName() +
Consider simplifying this complex logical expression. Open
Open
if (tableType != null && !"TABLE".equalsIgnoreCase(tableType) && !"VIEW".equalsIgnoreCase(tableType)
&& !"ALIAS".equalsIgnoreCase(tableType) && !"SYNONYM".equalsIgnoreCase(tableType) && !"BASE TABLE".equalsIgnoreCase(tableType)) {
continue;
}
Method checkPrimaryKeyInfo
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public int checkPrimaryKeyInfo(ResultSet rsPks, String lookupSchemaName, boolean needsUpperCase, Map<String, Map<String, ColumnCheckInfo>> colInfo, Collection<String> messages) throws SQLException {
Method getConnection
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private Connection getConnection(String driverName, String connectionUrl, Properties props, String userName, String password) throws SQLException {
Avoid too many return
statements within this method. Open
Open
return null;
Avoid too many return
statements within this method. Open
Open
return errMsg;
Avoid too many return
statements within this method. Open
Open
return null;
Avoid too many return
statements within this method. Open
Open
return null;
Avoid too many return
statements within this method. Open
Open
return errMsg;
Avoid too many return
statements within this method. Open
Open
return errMsg;
Avoid too many return
statements within this method. Open
Open
return null;
Avoid too many return
statements within this method. Open
Open
return dbIndex;
Avoid too many return
statements within this method. Open
Open
return message;
Avoid too many return
statements within this method. Open
Open
return null;
Avoid too many return
statements within this method. Open
Open
return null;
Avoid too many return
statements within this method. Open
Open
return errMsg;
Avoid too many return
statements within this method. Open
Open
return message;