public PrivilegeManagerImpl(String appName) { this.appName = appName; this.tableName = appName + "_privilege"; TableNewer newer = new TableNewer(); newer.setTableName(tableName); newer.setColumnNames( new String[] { "id", "pid", "name", "description", "isleaf", "display", "decisionPolicyCombAlg", "queryPolicyCombAlg", "type", "constantName", "url", "target", "orderNum" }); newer.setIdColumnNames(new String[] {"id"}); newer.setUniqueColumnNames(new String[] {"name"}); newer.setMappingClass(Privilege.class.getName()); newer.put("id", new JavaBeanColumnAdapter("id", "int")); newer.put("pid", new JavaBeanColumnAdapter("pid", "int")); newer.put("name", new JavaBeanColumnAdapter("name", "java.lang.String")); newer.put("description", new JavaBeanColumnAdapter("description", "java.lang.String")); newer.put("isleaf", new JavaBeanColumnAdapter("isLeaf", "boolean")); newer.put("display", new JavaBeanColumnAdapter("display", "boolean")); newer.put("decisionPolicyCombAlg", new JavaBeanColumnAdapter("decisionPolicyCombAlg", "int")); newer.put("queryPolicyCombAlg", new JavaBeanColumnAdapter("queryPolicyCombAlg", "int")); newer.put("type", new JavaBeanColumnAdapter("type", "int")); newer.put("constantName", new JavaBeanColumnAdapter("constantName", "java.lang.String")); newer.put("url", new JavaBeanColumnAdapter("url", "java.lang.String")); newer.put("target", new JavaBeanColumnAdapter("target", "java.lang.String")); newer.put("orderNum", new JavaBeanColumnAdapter("orderNum", "int")); newer.setId(DBPower.getTableId(null, newer.getTableName())); table = newer.getTable(); selector = new TableSelectorImpl(); selector.setObjectNewer(new JavaBeanObjectNewer(newer.getMappingClass())); saver = new TableSaverImpl(); updator = new TableUpdatorImpl(); deletor = new TableDeletorImpl(); selector.setTable(table); saver.setTable(table); updator.setTable(table); deletor.setTable(table); }
public Collection getAllNonRolePrivilegesFromDb() { FieldWhereElement emt = new FieldWhereElement(); emt.setColumn(table.getColumns()[8]); emt.setCompartor(SingleValueComparator.EQUAL); emt.setValue(new Integer(Privilege.NON_ROLE_PRIVILEGE)); SelectCondition cdtn = new SelectCondition(); cdtn.setWhereElement(emt); return selector.select(cdtn, null); }