Skip to content

Commit

Permalink
Some collections not visible in category view ukwa#353 (fix element i…
Browse files Browse the repository at this point in the history
…ds for Map data structure)
  • Loading branch information
min2ha committed Jun 21, 2022
1 parent 6eba803 commit 4c881b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,16 @@ public ModelAndView rootCategoriesPagev2(HttpServletRequest request) {
}

mapCollectionDTO = new HashMap<>();
Random random = new Random();

//all collections
for (Map.Entry<String, List<PivotField>> pivotEntry : pivotEntryList) {
Iterator iterator; //Iterator<PivotField>
int indx_deep = 0;

for (int y=0; y < pivotEntry.getValue().size();y++) {
if (pivotEntry.getValue().get(y).getPivot() != null) {
log.info("List [" + y + "] Pivot size = " + pivotEntry.getValue().get(y).getPivot().size());
log.debug("List [" + y + "] Pivot size = " + pivotEntry.getValue().get(y).getPivot().size());

indx_deep = 0;
charSet = new HashSet<>();
Expand Down Expand Up @@ -112,10 +114,10 @@ public ModelAndView rootCategoriesPagev2(HttpServletRequest request) {
// log.info("matcher : index = " + k++ +", group = " + m.group(2));
// log.info("matcher : index = " + k++ +", group = " + m.group(3));


mapCollectionDTO.put(
//add only collectionArea ID, title cannot be extracted from SOLR query
pivotEntry.getValue().get(y).getPivot().get(indx_deep).getValue().toString(),
//13+Id: all collection list must contain unique collections, so starting part remains the same i.e. 13
13 + pivotEntry.getValue().get(y).getPivot().get(indx_deep).getValue().toString(),
new CollectionDTO(

pivotEntry.getValue().get(y).getPivot().get(indx_deep).getValue().toString(),
Expand All @@ -131,17 +133,14 @@ public ModelAndView rootCategoriesPagev2(HttpServletRequest request) {
indx_deep++;
} else
iterator.next();
log.info("mapCollectionDTO size = "+mapCollectionDTO.size());
}
//add all collections that belong to category
// && TODO: sub-collections? - Need to concentrate on lists from ACT in JSON
}
}

//List<HashMap<String, HashMap<String, CollectionDTO>>>

//Final add map of

}

map3 = new HashMap<>();
Expand All @@ -152,7 +151,6 @@ public ModelAndView rootCategoriesPagev2(HttpServletRequest request) {
Map.Entry::getKey, Map.Entry::getValue, (a, b) -> a, LinkedHashMap::new)));

listOfMapsOfItemsOfCategories3.add(map3);


//collection areas
for (Map.Entry<String, List<PivotField>> pivotEntry : pivotEntryList) {
Expand Down Expand Up @@ -192,7 +190,8 @@ public ModelAndView rootCategoriesPagev2(HttpServletRequest request) {

mapCollectionDTO.put(
//add only collectionArea ID, title cannot be extracted from SOLR query
pivotEntry.getValue().get(y).getPivot().get(indx_deep).getValue().toString(),
//random + Id: collection list must contai unique collections, so starting part remains unique i.e. random
(random.nextInt(90)+10) + pivotEntry.getValue().get(y).getPivot().get(indx_deep).getValue().toString(),
new CollectionDTO(

pivotEntry.getValue().get(y).getPivot().get(indx_deep).getValue().toString(),
Expand Down Expand Up @@ -224,8 +223,6 @@ public ModelAndView rootCategoriesPagev2(HttpServletRequest request) {
.sorted(Comparator.comparing(collDTO -> collDTO.getValue().getName()))
.collect(Collectors.toMap(
Map.Entry::getKey, Map.Entry::getValue, (a, b) -> a, LinkedHashMap::new)));

log.info("count [" + pivotEntry.getValue().get(y).getValue().toString() + "]" + mapCollectionDTO.entrySet().stream().count());
//Final add map of
listOfMapsOfItemsOfCategories3.add(map3);
listOfAlphabetical.add(charSet);
Expand Down
10 changes: 5 additions & 5 deletions src/main/webapp/WEB-INF/jsp/speccoll.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -119,21 +119,21 @@
<li class="list-group-item col-lg-6 col-md-6 col-sm-12">

<div class="media">
<a href="collection/<c:out value="${collection.key}"/>" class="collection-link">
<img style="width:160px;height:auto;" alt="<c:out value="${collection.value.name}"/>" src="img/collections/collection_<c:out value="${collection.key}"/>.png"/>
<a href="collection/<c:out value="${fn:substring(collection.key, 2, 7)}"/>" class="collection-link">
<img style="width:160px;height:auto;" alt="<c:out value="${collection.value.name}"/>" src="img/collections/collection_<c:out value="${fn:substring(collection.key, 2, 7)}"/>.png"/>
</a>
<div class="ml-3 media-body">
<div class="row">
<div class="col-12 category-collection-search-result-ul">
<a href="collection/<c:out value="${collection.key}"/>" class="collection-link">
<a href="collection/<c:out value="${fn:substring(collection.key, 2, 7)}"/>" class="collection-link">
<h5><c:out value="${collection.value.name}"/></h5>
</a>
</div>
</div>

<div id="colmodule" class="collection-descr" >
<p id="collapseCollection-<c:out value="${collection.key}"/>" class="collapse text-justify text-muted small col-descr" data-content="tmp_data" aria-expanded="false"><c:out value="${collection.value.description}"/></p>
<a role="button" data-content="<spring:message code="categories.filter.results.showmore" />" class="collapsed showmoreless" data-toggle="collapse" href="#collapseCollection-<c:out value="${collection.key}"/>" aria-expanded="false" aria-controls="collapseCollection-<c:out value="${collection.key}"/>"></a>
<p id="collapseCollection-<c:out value="${fn:substring(collection.key, 2, 7)}"/>" class="collapse text-justify text-muted small col-descr" data-content="tmp_data" aria-expanded="false"><c:out value="${collection.value.description}"/></p>
<a role="button" data-content="<spring:message code="categories.filter.results.showmore" />" class="collapsed showmoreless" data-toggle="collapse" href="#collapseCollection-<c:out value="${fn:substring(collection.key, 2, 7)}"/>" aria-expanded="false" aria-controls="collapseCollection-<c:out value="${fn:substring(collection.key, 2, 7)}"/>"></a>
</div>

</div>
Expand Down

0 comments on commit 4c881b1

Please sign in to comment.