This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • development/sharing/codeability-sharing-platform
1 result
Show changes
Commits on Source (42)
Showing
with 10284 additions and 26789 deletions
......@@ -15,6 +15,7 @@ npm-debug.log.*
/.awcache/*
/.cache-loader/*
/co
######################
# SASS
######################
......@@ -220,3 +221,4 @@ pwd/co/elastic/clients/elasticsearch-java/7.17.9/elasticsearch-java-7.17.9.pom
pwd/co/elastic/clients/elasticsearch-java/7.17.9/elasticsearch-java-7.17.9.jar.sha1
pwd/co/elastic/clients/elasticsearch-java/7.17.9/elasticsearch-java-7.17.9.pom.lastUpdated
pwd/co/elastic/clients/elasticsearch-java/7.17.9/elasticsearch-java-7.17.9.pom.sha1
src/main/resources/.h2.server.properties
......@@ -11,5 +11,9 @@
"name": "standard",
"envFile": "${workspaceRoot}/src/test/resources/config/.env"
},
"typescript.tsdk": "node_modules\\typescript\\lib"
"typescript.tsdk": "node_modules\\typescript\\lib",
"sonarlint.connectedMode.project": {
"connectionId": "QESonarQube",
"projectKey": "gitsearch"
}
}
This diff is collapsed.
{
"name": "gitsearch",
"version": "1.2.0-SNAPSHOT",
"version": "1.3.0-SNAPSHOT",
"private": true,
"description": "Description for gitsearch",
"license": "UNLICENSED",
......@@ -96,28 +96,30 @@
"@angular/platform-browser-dynamic": "13.1.3",
"@angular/router": "13.1.3",
"@fortawesome/angular-fontawesome": "^0.10.1",
"@fortawesome/fontawesome-common-types": "^6.1.1",
"@fortawesome/fontawesome-svg-core": "^6.1.1",
"@fortawesome/free-regular-svg-icons": "^6.1.1",
"@fortawesome/free-solid-svg-icons": "^6.1.1",
"@fortawesome/fontawesome-common-types": "^6.4.2",
"@fortawesome/fontawesome-svg-core": "^6.4.2",
"@fortawesome/free-regular-svg-icons": "^6.4.2",
"@fortawesome/free-solid-svg-icons": "^6.4.2",
"@ng-bootstrap/ng-bootstrap": "11.0.0",
"@ngqp/core": "^13.0.0",
"@ngx-translate/core": "14.0.0",
"@ngx-translate/http-loader": "7.0.0",
"ajv": "^8.10.0",
"ajv": "^8.12.0",
"angular-tag-cloud-module": "^13.0.0",
"bootstrap": "4.6.1",
"dayjs": "1.10.7",
"colorjs.io": "^0.4.5",
"dayjs": "1.11.9",
"jspdf": "^2.5.1",
"lodash": "^4.17.21",
"moment": "^2.29.1",
"moment": "^2.29.4",
"ngx-cookie-service": "^13.1.2",
"ngx-infinite-scroll": "10.0.1",
"ngx-markdown": "^13.0.0",
"ngx-webstorage": "9.0.0",
"rxjs": "7.5.2",
"npm-check-updates": "^16.10.17",
"rxjs": "7.8.1",
"swagger-ui-dist": "4.2.1",
"ts-color-class": "^0.10.1",
"tslib": "2.3.1",
"tslib": "2.6.1",
"zone.js": "0.11.4"
},
"devDependencies": {
......@@ -128,27 +130,28 @@
"@angular/cli": "13.1.2",
"@angular/compiler-cli": "13.1.3",
"@angular/service-worker": "13.1.3",
"@types/chai": "4.2.14",
"@types/chai": "4.3.5",
"@types/chai-string": "1.4.2",
"@types/jest": "27.4.0",
"@types/lodash": "^4.14.184",
"@types/jspdf": "^2.0.0",
"@types/lodash": "^4.14.196",
"@types/mocha": "8.2.0",
"@types/node": "16.11.21",
"@types/selenium-webdriver": "4.0.11",
"@types/selenium-webdriver": "4.1.15",
"@typescript-eslint/eslint-plugin": "5.10.0",
"@typescript-eslint/parser": "5.10.0",
"browser-sync": "^2.27.11",
"browser-sync": "^2.29.3",
"browser-sync-webpack-plugin": "2.3.0",
"chai": "4.2.0",
"chai": "4.3.7",
"chai-as-promised": "7.1.1",
"chai-string": "1.5.0",
"concurrently": "7.0.0",
"copy-webpack-plugin": "10.2.1",
"eslint": "8.5.0",
"eslint-config-prettier": "8.3.0",
"eslint": "8.46.0",
"eslint-config-prettier": "8.10.0",
"eslint-webpack-plugin": "3.1.1",
"folder-hash": "4.0.1",
"generator-jhipster": "^7.8.1",
"folder-hash": "4.0.4",
"generator-jhipster": "^7.9.3",
"husky": "^7.0.4",
"jest": "27.4.7",
"jest-date-mock": "1.0.8",
......@@ -157,19 +160,19 @@
"jest-sonar-reporter": "2.0.0",
"lint-staged": "12.2.2",
"merge-jsons-webpack-plugin": "2.0.1",
"mocha": "^10.0.0",
"mocha": "^10.2.0",
"prettier": "2.5.1",
"prettier-plugin-java": "1.6.1",
"prettier-plugin-packagejson": "2.2.15",
"prettier-plugin-packagejson": "2.4.5",
"protractor": "7.0.0",
"rimraf": "3.0.2",
"ts-jest": "27.1.3",
"ts-node": "9.1.1",
"typescript": "4.5.4",
"wait-on": "6.0.0",
"webdriver-manager": "12.1.8",
"webpack-bundle-analyzer": "4.5.0",
"webpack-merge": "5.8.0",
"webdriver-manager": "12.1.9",
"webpack-bundle-analyzer": "4.9.0",
"webpack-merge": "5.9.0",
"webpack-notifier": "1.15.0"
},
"engines": {
......
......@@ -8,12 +8,12 @@
<description>
Rules for the PMD linter
</description>
<exclude-pattern>.*/target/generated-sources/.*</exclude-pattern> <!-- generated by mvn -->
<exclude-pattern>.*/src/test/.*.java</exclude-pattern><!-- generated by mvn -->
<exclude-pattern>.*/.*MapperImpl.java</exclude-pattern><!-- generated by mvn -->
<exclude-pattern>.*/.*_.java</exclude-pattern><!-- generated by mvn for JPA -->
<rule ref="category/java/bestpractices.xml">
<exclude name="GuardLogStatement"/>
......@@ -63,4 +63,3 @@
<rule ref="category/java/security.xml"></rule>
</ruleset>
......@@ -7,7 +7,7 @@
<groupId>at.ac.uibk.gitsearch</groupId>
<artifactId>gitsearch</artifactId>
<version>1.3.0-SNAPSHOT</version>
<version>1.4.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Gitsearch</name>
<description>Sharing Plattform WebApp</description>
......
......@@ -25,8 +25,7 @@ services:
soft: -1
hard: -1
networks:
backend:
ipv4_address: 172.22.2.24
- backend
# kibana:
# depends_on:
# - sharing_elasticsearch
......
......@@ -348,9 +348,6 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
static HttpHeaders getTokenRequestHeaders(ClientRegistration clientRegistration) {
HttpHeaders headers = new HttpHeaders();
headers.addAll(getDefaultTokenRequestHeaders());
// if (ClientAuthenticationMethod.BASIC.equals(clientRegistration.getClientAuthenticationMethod())) {
// headers.setBasicAuth(clientRegistration.getClientId(), clientRegistration.getClientSecret());
// }
return headers;
}
......@@ -383,12 +380,6 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
formParameters.add(OAuth2ParameterNames.CLIENT_ID, clientRegistration.getClientId());
// if (!ClientAuthenticationMethod.BASIC.equals(clientRegistration.getClientAuthenticationMethod())) {
// formParameters.add(OAuth2ParameterNames.CLIENT_ID, clientRegistration.getClientId());
// }
// if (ClientAuthenticationMethod.POST.equals(clientRegistration.getClientAuthenticationMethod())) {
// formParameters.add(OAuth2ParameterNames.CLIENT_SECRET, clientRegistration.getClientSecret());
// }
if (codeVerifier != null) {
formParameters.add(PkceParameterNames.CODE_VERIFIER, codeVerifier);
}
......
......@@ -6,7 +6,7 @@ package at.ac.uibk.gitsearch.config;
* This file is part of the JHipster project, see https://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
......@@ -53,9 +53,6 @@ public class SwaggerConfig implements OpenApiCustomiser, Ordered {
.termsOfService(null)
.license(new License().name("License: Open Source, details still to be considered"))
);
// for (JHipsterProperties.ApiDocs.Server server : properties.getServers()) {
// openAPI.addServersItem(new Server().url(server.getUrl()).description(server.getDescription()));
// }
}
/**
......
package at.ac.uibk.gitsearch.domain;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@SuppressWarnings("PMD")
@Entity
public class ReviewComment implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(nullable = true)
private Boolean descriptionIsClear;
@Column(nullable = true)
private Boolean requirementsAreClear;
@Column(nullable = true)
private String descriptionComment;
@Column(nullable = true)
private Boolean informationRequiredComplete;
@Column(nullable = true)
private Boolean allMaterialsAvailable;
@Column(nullable = true)
private String informationRequiredComment;
@Column(nullable = true)
private Boolean isStructured;
@Column(nullable = true)
private Boolean subExercisesAreClear;
@Column(nullable = true)
private String structuredComment;
@Column(nullable = true)
private Boolean solutionIsCorrect;
@Column(nullable = true)
private String solutionComment;
@Column(nullable = true)
private Boolean metadataIsComplete;
@Column(nullable = true)
private Boolean metadataIsCorrect;
@Column(nullable = true)
private String metadataComment;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Boolean getDescriptionIsClear() {
return descriptionIsClear;
}
public void setDescriptionIsClear(Boolean descriptionIsClear) {
this.descriptionIsClear = descriptionIsClear;
}
public Boolean getRequirementsAreClear() {
return requirementsAreClear;
}
public void setRequirementsAreClear(Boolean requirementsAreClear) {
this.requirementsAreClear = requirementsAreClear;
}
public String getDescriptionComment() {
return descriptionComment;
}
public void setDescriptionComment(String descriptionComment) {
this.descriptionComment = descriptionComment;
}
public Boolean getInformationRequiredComplete() {
return informationRequiredComplete;
}
public void setInformationRequiredComplete(Boolean informationRequiredComplete) {
this.informationRequiredComplete = informationRequiredComplete;
}
public Boolean getAllMaterialsAvailable() {
return allMaterialsAvailable;
}
public void setAllMaterialsAvailable(Boolean allMaterialsAvailable) {
this.allMaterialsAvailable = allMaterialsAvailable;
}
public String getInformationRequiredComment() {
return informationRequiredComment;
}
public void setInformationRequiredComment(String informationRequiredComment) {
this.informationRequiredComment = informationRequiredComment;
}
public Boolean getIsStructured() {
return isStructured;
}
public void setIsStructured(Boolean isStructured) {
this.isStructured = isStructured;
}
public Boolean getSubExercisesAreClear() {
return subExercisesAreClear;
}
public void setSubExercisesAreClear(Boolean subExercisesAreClear) {
this.subExercisesAreClear = subExercisesAreClear;
}
public String getStructuredComment() {
return structuredComment;
}
public void setStructuredComment(String structuredComment) {
this.structuredComment = structuredComment;
}
public Boolean getSolutionIsCorrect() {
return solutionIsCorrect;
}
public void setSolutionIsCorrect(Boolean solutionIsCorrect) {
this.solutionIsCorrect = solutionIsCorrect;
}
public String getSolutionComment() {
return solutionComment;
}
public void setSolutionComment(String solutionComment) {
this.solutionComment = solutionComment;
}
public Boolean getMetadataIsComplete() {
return metadataIsComplete;
}
public void setMetadataIsComplete(Boolean metadataIsComplete) {
this.metadataIsComplete = metadataIsComplete;
}
public Boolean getMetadataIsCorrect() {
return metadataIsCorrect;
}
public void setMetadataIsCorrect(Boolean metadataIsCorrect) {
this.metadataIsCorrect = metadataIsCorrect;
}
public String getMetadataComment() {
return metadataComment;
}
public void setMetadataComment(String metadataComment) {
this.metadataComment = metadataComment;
}
@Override
@SuppressWarnings("PMD")
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((descriptionIsClear == null) ? 0 : descriptionIsClear.hashCode());
result = prime * result + ((requirementsAreClear == null) ? 0 : requirementsAreClear.hashCode());
result = prime * result + ((descriptionComment == null) ? 0 : descriptionComment.hashCode());
result = prime * result + ((informationRequiredComplete == null) ? 0 : informationRequiredComplete.hashCode());
result = prime * result + ((allMaterialsAvailable == null) ? 0 : allMaterialsAvailable.hashCode());
result = prime * result + ((informationRequiredComment == null) ? 0 : informationRequiredComment.hashCode());
result = prime * result + ((isStructured == null) ? 0 : isStructured.hashCode());
result = prime * result + ((subExercisesAreClear == null) ? 0 : subExercisesAreClear.hashCode());
result = prime * result + ((structuredComment == null) ? 0 : structuredComment.hashCode());
result = prime * result + ((solutionIsCorrect == null) ? 0 : solutionIsCorrect.hashCode());
result = prime * result + ((solutionComment == null) ? 0 : solutionComment.hashCode());
result = prime * result + ((metadataIsComplete == null) ? 0 : metadataIsComplete.hashCode());
result = prime * result + ((metadataIsCorrect == null) ? 0 : metadataIsCorrect.hashCode());
result = prime * result + ((metadataComment == null) ? 0 : metadataComment.hashCode());
return result;
}
@Override
@SuppressWarnings("PMD")
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
ReviewComment other = (ReviewComment) obj;
if (id == null) {
if (other.id != null) return false;
} else if (!id.equals(other.id)) return false;
if (descriptionIsClear == null) {
if (other.descriptionIsClear != null) return false;
} else if (!descriptionIsClear.equals(other.descriptionIsClear)) return false;
if (requirementsAreClear == null) {
if (other.requirementsAreClear != null) return false;
} else if (!requirementsAreClear.equals(other.requirementsAreClear)) return false;
if (descriptionComment == null) {
if (other.descriptionComment != null) return false;
} else if (!descriptionComment.equals(other.descriptionComment)) return false;
if (informationRequiredComplete == null) {
if (other.informationRequiredComplete != null) return false;
} else if (!informationRequiredComplete.equals(other.informationRequiredComplete)) return false;
if (allMaterialsAvailable == null) {
if (other.allMaterialsAvailable != null) return false;
} else if (!allMaterialsAvailable.equals(other.allMaterialsAvailable)) return false;
if (informationRequiredComment == null) {
if (other.informationRequiredComment != null) return false;
} else if (!informationRequiredComment.equals(other.informationRequiredComment)) return false;
if (isStructured == null) {
if (other.isStructured != null) return false;
} else if (!isStructured.equals(other.isStructured)) return false;
if (subExercisesAreClear == null) {
if (other.subExercisesAreClear != null) return false;
} else if (!subExercisesAreClear.equals(other.subExercisesAreClear)) return false;
if (structuredComment == null) {
if (other.structuredComment != null) return false;
} else if (!structuredComment.equals(other.structuredComment)) return false;
if (solutionIsCorrect == null) {
if (other.solutionIsCorrect != null) return false;
} else if (!solutionIsCorrect.equals(other.solutionIsCorrect)) return false;
if (solutionComment == null) {
if (other.solutionComment != null) return false;
} else if (!solutionComment.equals(other.solutionComment)) return false;
if (metadataIsComplete == null) {
if (other.metadataIsComplete != null) return false;
} else if (!metadataIsComplete.equals(other.metadataIsComplete)) return false;
if (metadataIsCorrect == null) {
if (other.metadataIsCorrect != null) return false;
} else if (!metadataIsCorrect.equals(other.metadataIsCorrect)) return false;
if (metadataComment == null) {
if (other.metadataComment != null) return false;
} else if (!metadataComment.equals(other.metadataComment)) return false;
return true;
}
}
......@@ -6,16 +6,21 @@ import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
......@@ -35,8 +40,9 @@ public class ReviewRating implements Serializable {
@Column(name = "id")
private Long id;
@Column(name = "comment")
private String comment;
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "comment_id", referencedColumnName = "id")
private ReviewComment comment;
@Enumerated(EnumType.STRING)
@Column(name = "status")
......@@ -69,16 +75,11 @@ public class ReviewRating implements Serializable {
this.id = id;
}
public String getComment() {
public ReviewComment getComment() {
return this.comment;
}
public ReviewRating comment(String comment) {
this.setComment(comment);
return this;
}
public void setComment(String comment) {
public void setComment(ReviewComment comment) {
this.comment = comment;
}
......
......@@ -3,6 +3,7 @@ package at.ac.uibk.gitsearch.es.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.Objects;
import org.apache.commons.lang3.StringUtils;
@JsonIgnoreProperties(ignoreUnknown = true)
@SuppressWarnings("PMD")
......@@ -104,7 +105,9 @@ public class ArtemisExerciseInfo extends ExerciseInfo {
}
exerciseInfo.setCreator(this.getCreator());
exerciseInfo.setDescription(this.getDescription());
if (this.getDifficulty() != null) {
if (StringUtils.isEmpty(this.getDifficulty())) {
exerciseInfo.setDifficulty(null);
} else {
exerciseInfo.setDifficulty(this.getDifficulty());
}
if (this.getEducationalAlignment() != null) {
......
package at.ac.uibk.gitsearch.es.model;
import at.ac.uibk.gitsearch.service.dto.MetadataUserDTO;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.annotation.JsonEnumDefaultValue;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
......@@ -187,8 +191,9 @@ public class ExerciseInfo {
return "en";
case "german":
return "de";
default: // should never happen
return entry;
}
return entry;
})
.collect(Collectors.toList());
} else {
......
......@@ -2,12 +2,9 @@ package at.ac.uibk.gitsearch.repository;
import at.ac.uibk.gitsearch.domain.ReviewHistoryEntry;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
/**
* Spring Data SQL repository for the ReviewHistoryEntry entity.
*/
@SuppressWarnings("unused")
@Repository
public interface ReviewHistoryEntryRepository
extends JpaRepository<ReviewHistoryEntry, Long>, JpaSpecificationExecutor<ReviewHistoryEntry> {}
......@@ -33,16 +33,16 @@ public interface ReviewRatingJPARepository extends JpaRepository<ReviewRating, L
@Query("SELECT rr FROM ReviewRating rr WHERE rr.review.id=:reviewId")
List<ReviewRating> findByReview(@Param("reviewId") Long reviewId);
@Query("SELECT rr.status as status, count(*) as statusCount from ReviewRating rr WHERE rr.user = :user group by status")
List<StatusAndCount> countReviewsForUserByStatus(@Param("user") User user);
@Query(
"SELECT rr.status as status, count(*) as statusCount from Review r LEFT JOIN ReviewRating rr ON rr.review=r.id WHERE r.requestedBy = :userId GROUP BY status"
"SELECT rr.status as status, count(*) as statusCount FROM Review r LEFT JOIN ReviewRating rr ON rr.review = r WHERE r.requestedBy = :userId GROUP BY status"
)
List<StatusAndCount> countReviewsForRequestingUserByStatus(@Param("userId") Long userId);
List<StatusAndCount> countReviewsForUserByStatus(@Param("userId") long userIdl);
@Query("SELECT rr.status as status, count(*) as statusCount FROM ReviewRating rr WHERE rr.user = :user GROUP BY status")
List<StatusAndCount> countReviewsTasksForUserByStatus(@Param("user") User user);
@Query("SELECT count(*) as statusCount from Review r LEFT JOIN ReviewRating rr ON rr.review=r.id WHERE r.requestedBy = :userId")
Integer countReviewsRequestedByUser(@Param("userId") Long userId);
Integer countreviewsRequestedByReviewer(@Param("userId") Long userId);
@Query(
"SELECT count(*) as statusCount from Review r JOIN Statistics s ON r.resourceid = s.exerciseID WHERE r.requestedBy = :userId AND s.badgeRewarded=true "
......
package at.ac.uibk.gitsearch.repository.search;
import at.ac.uibk.gitsearch.domain.Likes;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
/**
* Spring Data Elasticsearch repository for the {@link Likes} entity.
*/
public interface LikesSearchRepository extends ElasticsearchRepository<Likes, Long> {}
package at.ac.uibk.gitsearch.repository.search;
import static org.elasticsearch.index.query.QueryBuilders.queryStringQuery;
import at.ac.uibk.gitsearch.domain.SavedSearches;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.core.SearchHit;
import org.springframework.data.elasticsearch.core.query.NativeSearchQuery;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
/**
* Spring Data Elasticsearch repository for the {@link SavedSearches} entity.
*/
public interface SavedSearchesSearchRepository
extends ElasticsearchRepository<SavedSearches, Long>, SavedSearchesSearchRepositoryInternal {}
interface SavedSearchesSearchRepositoryInternal {
Page<SavedSearches> search(String query, Pageable pageable);
}
class SavedSearchesSearchRepositoryInternalImpl implements SavedSearchesSearchRepositoryInternal {
private final ElasticsearchRestTemplate elasticsearchTemplate;
SavedSearchesSearchRepositoryInternalImpl(ElasticsearchRestTemplate elasticsearchTemplate) {
this.elasticsearchTemplate = elasticsearchTemplate;
}
@Override
public Page<SavedSearches> search(String query, Pageable pageable) {
NativeSearchQuery nativeSearchQuery = new NativeSearchQuery(queryStringQuery(query));
nativeSearchQuery.setPageable(pageable);
List<SavedSearches> hits = elasticsearchTemplate
.search(nativeSearchQuery, SavedSearches.class)
.map(SearchHit::getContent)
.stream()
.collect(Collectors.toList());
return new PageImpl<>(hits, pageable, hits.size());
}
}
package at.ac.uibk.gitsearch.repository.search;
import at.ac.uibk.gitsearch.domain.Statistics;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
/**
* Spring Data Elasticsearch repository for the {@link Statistics} entity.
*/
public interface StatisticsSearchRepository extends ElasticsearchRepository<Statistics, Long> {}
package at.ac.uibk.gitsearch.repository.search;
import static org.elasticsearch.index.query.QueryBuilders.queryStringQuery;
import at.ac.uibk.gitsearch.domain.User;
import java.util.stream.Stream;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.core.SearchHit;
import org.springframework.data.elasticsearch.core.query.NativeSearchQuery;
import org.apache.commons.lang3.NotImplementedException;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
/**
......@@ -21,15 +17,8 @@ interface UserSearchRepositoryInternal {
class UserSearchRepositoryInternalImpl implements UserSearchRepositoryInternal {
private final ElasticsearchRestTemplate elasticsearchTemplate;
UserSearchRepositoryInternalImpl(ElasticsearchRestTemplate elasticsearchTemplate) {
this.elasticsearchTemplate = elasticsearchTemplate;
}
@Override
public Stream<User> search(String query) {
NativeSearchQuery nativeSearchQuery = new NativeSearchQuery(queryStringQuery(query));
return elasticsearchTemplate.search(nativeSearchQuery, User.class).map(SearchHit::getContent).stream();
throw new NotImplementedException("this function is temporarily disabled :-)");
}
}
package at.ac.uibk.gitsearch.repository.search;
import at.ac.uibk.gitsearch.domain.WatchListEntry;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
/**
* Spring Data Elasticsearch repository for the {@link WatchListEntry} entity.
*/
public interface WatchListEntrySearchRepository extends ElasticsearchRepository<WatchListEntry, Long> {}