Searches for class based on class name. If nothing is found, the class is created and the new class Id is returned @param className Name of the class you wish to search / create @return The Identifier of the class owning the name submitted @throws Exception If the class cannot be created or found
(String className)
| 61 | * @throws Exception If the class cannot be created or found |
| 62 | */ |
| 63 | public static String findCreateClassId(String className) throws Exception |
| 64 | { |
| 65 | String classId = new String(); |
| 66 | ResultSet rs = Getter.getClassInfo(applicationRoot); |
| 67 | while(rs.next()) |
| 68 | { |
| 69 | if(rs.getString(2).compareTo(className) == 0) |
| 70 | { |
| 71 | classId = rs.getString(1); |
| 72 | break; |
| 73 | } |
| 74 | } |
| 75 | rs.close(); |
| 76 | if(classId.isEmpty()) |
| 77 | { |
| 78 | log.debug("Could not find class. Creating it"); |
| 79 | if(Setter.classCreate(applicationRoot, className, "2015")) |
| 80 | { |
| 81 | log.debug("Class Created. Getting ID"); |
| 82 | classId = findCreateClassId(className); |
| 83 | } |
| 84 | else |
| 85 | { |
| 86 | throw new Exception("Could not Create Class " + className); |
| 87 | } |
| 88 | } |
| 89 | return classId; |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * Searches for class based on class name. If nothing is found, the class is created and the new class Id is returned |
no test coverage detected