1 package org.tigris.scarab.om; 2 3 48 49 import java.util.List ; 51 52 import org.apache.fulcrum.security.entity.Group; 54 import org.apache.torque.util.BasePeer; 55 import org.apache.torque.util.Criteria; 56 import org.apache.fulcrum.security.util.DataBackendException; 57 58 import org.tigris.scarab.om.Module; 60 61 70 public class ScarabModulePeer 71 extends org.tigris.scarab.om.BaseScarabModulePeer 72 { 73 80 81 85 public static List getAllModules() 86 throws Exception 87 { 88 return doSelect(new Criteria()); 89 } 90 91 101 public static boolean checkExists(Group group) 102 throws DataBackendException, Exception 103 { 104 Criteria criteria = new Criteria(); 105 criteria.addSelectColumn(MODULE_ID); 106 String name = ((Module)group).getRealName(); 107 criteria.add(MODULE_NAME, name); 108 criteria.add(PARENT_ID, ((Module)group).getParentId()); 109 List results = BasePeer.doSelect(criteria); 110 if(results.size() > 1) 111 { 112 throw new DataBackendException("Multiple groups named '" + 113 name + "' exist!"); } 115 return (results.size()==1); 116 } 117 118 } 119 120 | Popular Tags |