def checkForTableID(moduleID): #string = "@PersistenceCapable(detachable = \"true\", table = \"foo_account\")" flag = True task_dict = {} table_dict = {} for f in fileHandler.getAllFilesMatching('*.java'): contents = fileHandler.readFile(f) # Initial work on checking task/config names # try: # method = javaHandler.readMethod(contents, "public String getDisplayLabel()") # print method # except: # False try: method = javaHandler.readMethod(contents, "public TaskConfigIf getTaskConfigImplementation") if (method[0].split()[2] in task_dict.keys()): log.critical("Task config re-used: " + method[0].split()[2] + " in files: " + f + " & " + task_dict[method[0].split()[2]]) flag = False else: task_dict[method[0].split()[2]] = f except: False for line in contents: if(("@PersistenceCapable" in line) and ("table" in line)): inBrackets = gstring.getTargetBetweenBrackets(line) attributes = inBrackets.split(",") tableAttribute = [s for s in attributes if "table" in s] a = re.findall('"([^"]*)"', tableAttribute[0])[0] if (a in table_dict.keys()): log.critical("\tTable already used: " + a + " (files: " + table_dict.get(str(a)) + " & " + f) flag = False else: table_dict[str(a)] = f if(not a.startswith((moduleID + "_"))): log.critical("\tThe table ID in class " + f + " is not prefixed the moduleID and an underscore: " + moduleID + "_") if (flag == False): log.critical("Table checking failed") exit(1) '''
def getClassesRequiringEnhancement(): javas = fileHandler.getAllFilesMatching("*.java") #Go through and get all the files that REQUIRE enhancement requiresEnhancement = [] for f in javas: if(hasAnnotations(f)): className = gstring.getClassNameFromDir(f) requiresEnhancement.append(className) return requiresEnhancement
def getClassesListedForEnhancement(): files = fileHandler.getAllFilesMatching("jdo.files") #Go through and get all of the files that are LISTED for enhancement newList = [] for f in files: if("src" in f): newList.append(f) files = newList listOfClasses = [] for f in files: fileContents = fileHandler.readFile(f) classes = getJDOClassesInFile(fileContents) for c in classes: listOfClasses.append(c) return listOfClasses