Revision 41664 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc/JDBCHelper.java

View differences:

JDBCHelper.java
1227 1227
		return false;
1228 1228
	}
1229 1229

  
1230
        protected List createGrantStatements(JDBCNewStoreParameters ndsp) {
1231
            return this.createGrantStatements(ndsp, ndsp.tableID());
1232
        }
1233
        
1234
        protected List createGrantStatements(JDBCNewStoreParameters ndsp, String table) {
1235
            String priviligeParamNames[] = new String[] {   
1236
                "SelectRole",
1237
                "InsertRole",
1238
                "UpdateRole",
1239
                "DeleteRole",
1240
                "TruncateRole",
1241
                "ReferenceRole",
1242
                "TriggerRole",
1243
                "AllRole"
1244
            };
1245
            String priviligeNames[] = new String[] {   
1246
                "SELECT",
1247
                "INSERT",
1248
                "UPDATE",
1249
                "DELETE",
1250
                "TRUNCATE",
1251
                "REFERENCE",
1252
                "TRIGGER",
1253
                "ALL"
1254
            };
1255
            List statements = new ArrayList();;
1256
            
1257
            for( int i=0; i<priviligeParamNames.length; i++ ) {
1258
                String paramName = priviligeParamNames[i];
1259
                String roles = StringUtils.defaultIfBlank(
1260
                        (String) ndsp.getDynValue(paramName), 
1261
                        null
1262
                );
1263
                if( roles!=null ) {
1264
                    statements.addAll(this.createGrantStatements(table, priviligeNames[i], roles));
1265
                }
1266
            }
1267
            return statements;
1268
        }
1269

  
1230 1270
        protected List createGrantStatements(String tableName, String privilege, String theRoles) {
1231
            if( !tableName.startsWith("\"") ) {
1232
                tableName = "\"" + tableName +"\"";
1233
            }
1234 1271
            List statements = new ArrayList();
1235 1272
            String[] roles = StringUtils.split(theRoles,",");
1236 1273
            for( int i=0; i<roles.length; i++) {
......
1239 1276
            }
1240 1277
            return statements;
1241 1278
        } 
1242
        
1279

  
1243 1280
}

Also available in: Unified diff