|
|
@ -136,19 +136,19 @@ public class FileController { |
|
|
|
|
|
|
|
public String getUrl(String tags) { |
|
|
|
logger.info("Search " + tags + " in files"); |
|
|
|
DbFile dbFile = fileRepository.getDbFilesByTag(tags); |
|
|
|
if (dbFile == null) |
|
|
|
UUID uuid = fileRepository.getUUIDFilesByTag(tags); |
|
|
|
if (uuid == null) |
|
|
|
throw new RuntimeException("Cannot find: " + tags); |
|
|
|
logger.info("Search {} end with success", tags); |
|
|
|
return endpoint+"/"+dbFile.getId(); |
|
|
|
return endpoint+"/"+uuid; |
|
|
|
} |
|
|
|
|
|
|
|
public String getUrlWithNameAndTag(String filename, String tag) { |
|
|
|
logger.info("Search {} with tag: {} in files", filename, tag); |
|
|
|
DbFile dbFile = fileRepository.getDbFileByFilenameAndTag(filename + ".%", tag); |
|
|
|
if (dbFile == null) |
|
|
|
UUID uuid = fileRepository.getUUIDByFilenameAndTag(filename + ".%", tag); |
|
|
|
if (uuid == null) |
|
|
|
throw new RuntimeException("Cannot find: " + filename); |
|
|
|
logger.info("Search {} with tag: {} end with success", filename, tag); |
|
|
|
return endpoint+"/"+dbFile.getId(); |
|
|
|
return endpoint+"/"+uuid; |
|
|
|
} |
|
|
|
} |
|
|
|