mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2026-11-08 03:47:36 +00:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
002c78d09b | ||
|
|
171c8b380c | ||
|
|
04651f3b8e | ||
|
|
180428fbb7 | ||
|
|
1d3015a7e4 |
No files matched your search
@@ -22,12 +22,6 @@ public class LacertaSearchStubImpl implements LacertaSearch {
|
|||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 検索
|
|
||||||
* @param query 検索クエリ
|
|
||||||
* @param limit 最大取得件数
|
|
||||||
* @return 検索結果
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<ListItem> autoSearch(String query, int limit) {
|
public ArrayList<ListItem> autoSearch(String query, int limit) {
|
||||||
logger.debug("SearchStub", "autoSearch");
|
logger.debug("SearchStub", "autoSearch");
|
||||||
@@ -35,13 +29,6 @@ public class LacertaSearchStubImpl implements LacertaSearch {
|
|||||||
return library.getLibraryPage(limit).getListItems();
|
return library.getLibraryPage(limit).getListItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 検索
|
|
||||||
* @param query 検索クエリ
|
|
||||||
* @param limit 最大取得件数
|
|
||||||
* @param offset オフセット
|
|
||||||
* @return 検索結果
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<ListItem> autoSearch(String query, int limit, int offset) {
|
public ArrayList<ListItem> autoSearch(String query, int limit, int offset) {
|
||||||
logger.debug("SearchStub", "autoSearch");
|
logger.debug("SearchStub", "autoSearch");
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package one.nem.lacerta.model;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PublicPath {
|
||||||
|
/*
|
||||||
|
* ユーザーが扱うパス(内部パスの代替)
|
||||||
|
* (時間がないのでInjectされることは考慮しない)
|
||||||
|
*
|
||||||
|
* TODO-rca:
|
||||||
|
* - こわれたパスを検知する
|
||||||
|
* - バリデーション
|
||||||
|
*/
|
||||||
|
|
||||||
|
List<String> path = new ArrayList<String>();
|
||||||
|
|
||||||
|
public PublicPath() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public PublicPath(List<String> path) {
|
||||||
|
this.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void add(String path) {
|
||||||
|
this.path.add(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resolveInternal(String path) {
|
||||||
|
if (path.equals("..")) {
|
||||||
|
this.path.remove(this.path.size() - 1);
|
||||||
|
} else {
|
||||||
|
add(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public PublicPath resolve(String path) {
|
||||||
|
resolveInternal(path);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PublicPath resolve(List<String> path) {
|
||||||
|
for (String p : path) {
|
||||||
|
resolveInternal(p);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PublicPath resolve(PublicPath path) {
|
||||||
|
for (String p : path.getPath()) {
|
||||||
|
resolveInternal(p);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PublicPath parent() {
|
||||||
|
this.path.remove(this.path.size() - 1);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getPath() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStringPath() {
|
||||||
|
return String.join("/", path);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user