| | |
| | | /** |
| | | * 查询文件 |
| | | */ |
| | | public List<MetaFileEntity> selectFiles(String subPath, List<String> extList) { |
| | | public List<MetaFileEntity> selectFiles(String subPath) { |
| | | String root = pathHelper.getConfig().getTempPath() + File.separator + subPath; |
| | | |
| | | File file = new File(root); |
| | |
| | | for (File f : files) { |
| | | String fileName = FileHelper.getFileName(f.getPath()); |
| | | String extName = FileHelper.getExtension(fileName); |
| | | if (null != extList && !extList.contains(extName)) { |
| | | if (!isExtValid(extName)) { |
| | | continue; |
| | | } |
| | | |
| | |
| | | * 查询映射 |
| | | */ |
| | | public List<MetaFileEntity> selectMappers(UserEntity ue, String path, DirEntity dir, VerEntity ver, String epsgCode) { |
| | | List<MetaFileEntity> metas = selectFiles(path, StaticData.ALL_EXTENSION); |
| | | List<MetaFileEntity> metas = selectFiles(path); |
| | | if (null == metas || metas.isEmpty()) { |
| | | return null; |
| | | } |
| | |
| | | File file = new File(path); |
| | | if (!file.isDirectory()) { |
| | | String extName = FileHelper.getExtension(file); |
| | | if (StaticData.ALL_EXTENSION.contains(extName)) { |
| | | if (isExtValid(extName)) { |
| | | list.add(file); |
| | | } |
| | | return; |
| | |
| | | getFilesByPath(list, f.getPath()); |
| | | } else { |
| | | String extName = FileHelper.getExtension(f); |
| | | if (StaticData.ALL_EXTENSION.contains(extName)) { |
| | | if (isExtValid(extName)) { |
| | | list.add(f); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 扩展是否有效 |
| | | */ |
| | | private boolean isExtValid(String extName) { |
| | | return StaticData.ALL_EXTENSION.contains(extName) && !StaticData.MAPPER_EXCLUDE_EXT.contains(extName); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | String fileName = FileHelper.getFileName(f.getPath()); |
| | | String extName = FileHelper.getExtension(fileName); |
| | | if (!StaticData.ALL_EXTENSION.contains(extName) || fileName.startsWith("~")) { |
| | | if (!isExtValid(extName) || fileName.startsWith("~")) { |
| | | continue; |
| | | } |
| | | |