public boolean isModuleWithWildcard(Module module) { PathEntry rulesRootPath = module.getRulesRootPath(); if (rulesRootPath != null) { String path = rulesRootPath.getPath(); return path.contains("*") || path.contains("?"); } return false; }
public boolean isModuleWithWildcard(Module module) { PathEntry rulesRootPath = module.getRulesRootPath(); if (rulesRootPath != null) { String path = rulesRootPath.getPath(); return path.contains("*") || path.contains("?"); } return false; }
public String getSources() { ProjectDescriptor currentProject = studio.getCurrentProjectDescriptor(); List<PathEntry> sourceList = currentProject.getClasspath(); if (sourceList != null) { StringBuilder sb = new StringBuilder(); for (PathEntry source : sourceList) { sb.append(source.getPath()).append(StringTool.NEW_LINE); } sources = sb.toString(); } return sources; }
public String getSources() { ProjectDescriptor currentProject = studio.getCurrentProjectDescriptor(); List<PathEntry> sourceList = currentProject.getClasspath(); if (sourceList != null) { StringBuilder sb = new StringBuilder(); for (PathEntry source : sourceList) { sb.append(source.getPath()).append(StringTool.NEW_LINE); } sources = sb.toString(); } return sources; }
@Override public String getUrlForModule(Module module) { // TODO Add "internal-workbook" parameter instead of playing with "sheet" XmlRulesModule xmlRulesModule = (XmlRulesModule) module; String moduleURI = new File(xmlRulesModule.getRulesRootPath().getPath()).toURI().toString(); if (xmlRulesModule.getInternalModulePath().equals(TYPES_WORKBOOK)) { moduleURI += "?sheet=" + TYPES_SHEET; } return moduleURI; }
private boolean isModuleWithWildcard(Module module) { if (module.getRulesRootPath() != null) { String path = module.getRulesRootPath().getPath(); return path.contains("*") || path.contains("?"); } return false; }
private boolean isModuleWithWildcard(Module module) { if (module.getRulesRootPath() != null) { String path = module.getRulesRootPath().getPath(); return path.contains("*") || path.contains("?"); } return false; }
public boolean isUploadedModuleChanged() { ProjectFile lastUploadedFile = getLastUploadedFile(); if (lastUploadedFile == null) { return false; } Module module = getCurrentModule(); if (module != null) { String moduleFullPath = module.getRulesRootPath().getPath().replace('\\', '/'); String lastUploadedFilePath = lastUploadedFile.getName().replace('\\', '/'); String moduleFileName = moduleFullPath.substring(moduleFullPath.lastIndexOf('/') + 1); String lastUploadedFileName = lastUploadedFilePath.substring(lastUploadedFilePath.lastIndexOf('/') + 1); return !lastUploadedFileName.equals(moduleFileName); } return false; }
private Collection<String> getRulesXmlFiles(ZipSource source, Charset charset, RootFolderExtractor extractor) { ProjectDescriptor projectDescriptor = getProjectDescriptor(source, charset, extractor); if (projectDescriptor != null) { Set<String> files = new HashSet<>(); for (Module module : projectDescriptor.getModules()) { String path = module.getRulesRootPath().getPath(); if (!path.contains("*") && !path.contains("?")) { // Modules with wildcard aren't supported for now files.add(path); } } return files; } return null; }
public List<Module> getModulesMatchingPathPattern(Module module) { if (module == null || !projectDescriptorManager.isModuleWithWildcard(module)) { return Collections.emptyList(); } try { return projectDescriptorManager.getAllModulesMatchingPathPattern(studio.getCurrentProjectDescriptor(), module, module.getRulesRootPath().getPath()); } catch (IOException e) { if (log.isErrorEnabled()){ log.error(e.getMessage(), e); } return Collections.emptyList(); } }
public String getModulePath(Module module) { PathEntry modulePath = module == null ? null : module.getRulesRootPath(); if (modulePath == null) return null; String moduleFullPath = modulePath.getPath(); ProjectDescriptor project = module.getProject(); if (project == null || project.getProjectFolder() == null) { return moduleFullPath; } String projectFullPath = project.getProjectFolder().getAbsolutePath(); if (moduleFullPath.contains(projectFullPath)) { return moduleFullPath.replace(projectFullPath, "").substring(1); } return moduleFullPath; }
public String getModulePath(Module module) { PathEntry modulePath = module == null ? null : module.getRulesRootPath(); if (modulePath == null) return null; String moduleFullPath = modulePath.getPath(); ProjectDescriptor project = module.getProject(); if (project == null || project.getProjectFolder() == null) { return moduleFullPath; } String projectFullPath = project.getProjectFolder().getAbsolutePath(); if (moduleFullPath.contains(projectFullPath)) { return moduleFullPath.replace(projectFullPath, "").substring(1); } return moduleFullPath; }
@Override public IOpenSourceCodeModule getSourceCode(Module module) { XmlRulesModule m = ((XmlRulesModule) module); File sourceFile = new File(m.getRulesRootPath().getPath()); URL url = URLSourceCodeModule.toUrl(sourceFile); return new XmlRulesModuleSourceCodeModule(url, m); }
public static String extractFileNameFromModule(Module module) { if (module.getRulesRootPath() == null) { return module.getName(); } String path = module.getRulesRootPath().getPath(); return FileUtils.getBaseName(path); } }
public XlsWorkbookSourceCodeModule getCurrentModuleWorkbook() { PathEntry rulesRootPath = studio.getCurrentModule().getRulesRootPath(); WorkbookSyntaxNode[] workbookNodes = getWorkbookNodes(); if (workbookNodes == null) { return null; } for (WorkbookSyntaxNode workbookSyntaxNode : workbookNodes) { XlsWorkbookSourceCodeModule module = workbookSyntaxNode.getWorkbookSourceCodeModule(); if (rulesRootPath != null && module.getSourceFile().getName().equals(FileUtils.getName(rulesRootPath.getPath()))) { return module; } } return null; }
public static String extractFileNameFromModule(Module module) { if (module.getRulesRootPath() == null) { return module.getName(); } String path = module.getRulesRootPath().getPath(); return FileUtils.getBaseName(path); } }
private IOpenSourceCodeModule getSourceCode(Module module) { File sourceFile = new File(getModule().getRulesRootPath().getPath()); URL url = URLSourceCodeModule.toUrl(sourceFile); return new ModuleFileSourceCodeModule(url, getModule().getName()); }
private IOpenSourceCodeModule getSourceCode(Module module) { File sourceFile = new File(getModule().getRulesRootPath().getPath()); URL url = URLSourceCodeModule.toUrl(sourceFile); return new ModuleFileSourceCodeModule(url, getModule().getName()); }
private void validateModule(Module module) throws ValidationException { if (module == null) { throw new ValidationException("Project module isn't defined."); } if (StringUtils.isEmpty(module.getName()) && !isModuleWithWildcard(module)) { throw new ValidationException("Module name isn't defined."); } if (module.getRulesRootPath() == null || StringUtils.isEmpty(module.getRulesRootPath().getPath())) { throw new ValidationException("Module rules root aren't defined."); } }
private void validateModule(Module module) throws ValidationException { if (module == null) { throw new ValidationException("Project module isn't defined."); } if (StringUtils.isEmpty(module.getName()) && !isModuleWithWildcard(module)) { throw new ValidationException("Module name isn't defined."); } if (module.getRulesRootPath() == null || StringUtils.isEmpty(module.getRulesRootPath().getPath())) { throw new ValidationException("Module rules root aren't defined."); } }