|
|
@ -23,7 +23,7 @@ public class RequestHandlerReader extends AbstractComponent {
|
|
|
|
* @param requestHandlerMappings 요청 매핑
|
|
|
|
* @param requestHandlerMappings 요청 매핑
|
|
|
|
* @return {"name", "url", "parentID"} 정보 목록
|
|
|
|
* @return {"name", "url", "parentID"} 정보 목록
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public List<DataObject> read(RequestMappingHandlerMapping requestHandlerMappings) {
|
|
|
|
public Hierarchy<DataObject> asTree(RequestMappingHandlerMapping requestHandlerMappings) {
|
|
|
|
Map<RequestMappingInfo, HandlerMethod> handlers = requestHandlerMappings.getHandlerMethods();
|
|
|
|
Map<RequestMappingInfo, HandlerMethod> handlers = requestHandlerMappings.getHandlerMethods();
|
|
|
|
ArrayList<DataObject> nameURLs = new ArrayList<>();
|
|
|
|
ArrayList<DataObject> nameURLs = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
@ -50,7 +50,7 @@ public class RequestHandlerReader extends AbstractComponent {
|
|
|
|
nameURLs.add(menuItem(null, parentID));
|
|
|
|
nameURLs.add(menuItem(null, parentID));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Hierarchy<DataObject> tree = new HierarchyBuilder<DataObject>()
|
|
|
|
return new HierarchyBuilder<DataObject>()
|
|
|
|
.getID(row -> row.string("url"))
|
|
|
|
.getID(row -> row.string("url"))
|
|
|
|
.getParentID(row -> row.string("parentID"))
|
|
|
|
.getParentID(row -> row.string("parentID"))
|
|
|
|
.atTop(row -> "/".equals(row.string("parentID")))
|
|
|
|
.atTop(row -> "/".equals(row.string("parentID")))
|
|
|
@ -62,7 +62,14 @@ public class RequestHandlerReader extends AbstractComponent {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.setElements(nameURLs)
|
|
|
|
.setElements(nameURLs)
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**컨트롤러에 명시된 {@code @RequestMapping} 어노테이션을 읽어들여, {"name", "url", "parentID"} 정보를 추출하여 목록으로 반환한다.
|
|
|
|
|
|
|
|
* @param requestHandlerMappings 요청 매핑
|
|
|
|
|
|
|
|
* @return {"name", "url", "parentID"} 정보 목록
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public List<DataObject> read(RequestMappingHandlerMapping requestHandlerMappings) {
|
|
|
|
|
|
|
|
Hierarchy<DataObject> tree = asTree(requestHandlerMappings);
|
|
|
|
List<DataObject> top = tree.topElements();
|
|
|
|
List<DataObject> top = tree.topElements();
|
|
|
|
Collections.sort(top, (u0, u1) -> u0.string("url").compareTo(u1.string("url")));
|
|
|
|
Collections.sort(top, (u0, u1) -> u0.string("url").compareTo(u1.string("url")));
|
|
|
|
return top;
|
|
|
|
return top;
|
|
|
|