refactoring

This commit is contained in:
2022-05-07 19:17:40 +03:00
parent cbfe2c50a7
commit 07eb599f12
11 changed files with 31 additions and 40 deletions

View File

@@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import ru.di9.mirror.core.Utils;
import ru.di9.mirror.core.domain.ItemRecord2;
import ru.di9.mirror.core.domain.ItemRecord;
import ru.di9.mirror.core.handler.IndexOfHandler;
import java.util.ArrayList;
@@ -28,7 +28,7 @@ public class IndexOfMavenController {
@ModelAttribute("model") ModelMap model) {
String path = correctingHttpPath(httpPath);
List<ItemRecord2> walker = indexOfHandler.walker(path);
List<ItemRecord> walker = indexOfHandler.walker(path);
List<ModelLink> links = new ArrayList<>();
StringBuilder sb = new StringBuilder("/maven");
@@ -46,13 +46,13 @@ public class IndexOfMavenController {
sb.setLength(resetLength);
sb.append("/");
resetLength = sb.length();
for (ItemRecord2 itemRecord2 : walker) {
for (ItemRecord itemRecord : walker) {
if (Utils.isNotEmptyString(path)) {
sb.append(path).append("/");
}
sb.append(itemRecord2.name());
sb.append(itemRecord.name());
links.add(new ModelLink(itemRecord2.name() + (itemRecord2.isDir() ? "/" : ""), sb.toString()));
links.add(new ModelLink(itemRecord.name() + (itemRecord.isDir() ? "/" : ""), sb.toString()));
sb.setLength(resetLength);
}