@Test public void testInit() throws Exception { String resource = "MoTechDataEntry"; FormDefinitionServiceImpl fds = new FormDefinitionServiceImpl(); Set resources = new HashSet(); resources.add(resource); fds.setOxdFormDefResources(resources); fds.init(); Assert.assertEquals(1, fds.getStudies().size()); Assert.assertEquals(9, fds.getStudyForms(0).size()); }
public void init() throws Exception { for (String resource : getOxdFormDefResources()) { int index = resource.lastIndexOf("/"); String studyName = resource.substring(index + 1); List<File> fileList = getFileList(resource); if (fileList == null || fileList.isEmpty()) throw new FileNotFoundException(" No files in the directory " + resource); List<Integer> formIdList = new ArrayList<Integer>(); for (File fileName : fileList) { String formDefinition = getFileContent(fileName.getAbsolutePath()); Integer extractedFormId = extractFormId(formDefinition); formMap.put(extractedFormId, formDefinition); formIdList.add(extractedFormId); } studyForms.put(studyName, formIdList); studies.add(studyName); } }
FormDefinitionServiceImpl implements FormDefinitionService,
        StudyDefinitionService, UserDefinitionService { public void init() throws Exception { for (String resource : getOxdFormDefResources()) { int index = resource.lastIndexOf("/"); String studyName = resource.substring(index + 1); List<File> fileList = getFileList(resource); if (fileList == null || fileList.isEmpty()) throw new FileNotFoundException(" No files in the directory " + resource); List<Integer> formIdList = new ArrayList<Integer>(); for (File fileName : fileList) { String formDefinition = getFileContent(fileName.getAbsolutePath()); Integer extractedFormId = extractFormId(formDefinition); formMap.put(extractedFormId, formDefinition); formIdList.add(extractedFormId); } studyForms.put(studyName, formIdList); studies.add(studyName); } } }
FormDefinitionServiceImpl implements FormDefinitionService,
        StudyDefinitionService, UserDefinitionService { public void init() throws Exception { for (String resource : getOxdFormDefResources()) { int index = resource.lastIndexOf("/"); String studyName = resource.substring(index + 1); List<File> fileList = getFileList(resource); if (fileList == null || fileList.isEmpty()) throw new FileNotFoundException(" No files in the directory " + resource); List<Integer> formIdList = new ArrayList<Integer>(); for (File fileName : fileList) { String formDefinition = getFileContent(fileName.getAbsolutePath()); Integer extractedFormId = extractFormId(formDefinition); formMap.put(extractedFormId, formDefinition); formIdList.add(extractedFormId); } studyForms.put(studyName, formIdList); studies.add(studyName); } } FormDefinitionServiceImpl(); }
FormDefinitionServiceImpl implements FormDefinitionService,
        StudyDefinitionService, UserDefinitionService { public void init() throws Exception { for (String resource : getOxdFormDefResources()) { int index = resource.lastIndexOf("/"); String studyName = resource.substring(index + 1); List<File> fileList = getFileList(resource); if (fileList == null || fileList.isEmpty()) throw new FileNotFoundException(" No files in the directory " + resource); List<Integer> formIdList = new ArrayList<Integer>(); for (File fileName : fileList) { String formDefinition = getFileContent(fileName.getAbsolutePath()); Integer extractedFormId = extractFormId(formDefinition); formMap.put(extractedFormId, formDefinition); formIdList.add(extractedFormId); } studyForms.put(studyName, formIdList); studies.add(studyName); } } FormDefinitionServiceImpl(); void init(); List<File> getFileList(String directorySource); Map<Integer, String> getXForms(); Set<String> getOxdFormDefResources(); void setOxdFormDefResources(Set<String> oxdFormDefResources); void addOxdFormDefResources(String oxdFormDefResource); List<Object[]> getStudies(); void setPasswordEncoder(PasswordEncoder encoder); List<Object[]> getUsers(); void setUsers(List<String[]> users); String getStudyName(int id); List<String> getStudyForms(int studyId); }
FormDefinitionServiceImpl implements FormDefinitionService,
        StudyDefinitionService, UserDefinitionService { public void init() throws Exception { for (String resource : getOxdFormDefResources()) { int index = resource.lastIndexOf("/"); String studyName = resource.substring(index + 1); List<File> fileList = getFileList(resource); if (fileList == null || fileList.isEmpty()) throw new FileNotFoundException(" No files in the directory " + resource); List<Integer> formIdList = new ArrayList<Integer>(); for (File fileName : fileList) { String formDefinition = getFileContent(fileName.getAbsolutePath()); Integer extractedFormId = extractFormId(formDefinition); formMap.put(extractedFormId, formDefinition); formIdList.add(extractedFormId); } studyForms.put(studyName, formIdList); studies.add(studyName); } } FormDefinitionServiceImpl(); void init(); List<File> getFileList(String directorySource); Map<Integer, String> getXForms(); Set<String> getOxdFormDefResources(); void setOxdFormDefResources(Set<String> oxdFormDefResources); void addOxdFormDefResources(String oxdFormDefResource); List<Object[]> getStudies(); void setPasswordEncoder(PasswordEncoder encoder); List<Object[]> getUsers(); void setUsers(List<String[]> users); String getStudyName(int id); List<String> getStudyForms(int studyId);  }