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

Skip to content
Snippets Groups Projects
Commit 27f08844 authored by Daniel Rainer's avatar Daniel Rainer
Browse files

Fix typo

parent 4101b85e
Branches
Tags
2 merge requests!17Initial Merge to Prepare Release 1.0.0,!1Resolve "Metadaten konsolideren"
......@@ -52,10 +52,10 @@ public class SearchService {
public SearchService() {
}
/**
* returns all keyword autocompletes for keyWord
*
*
* @param keyWordPrefix
* @return
* @throws IOException
......@@ -66,7 +66,7 @@ public class SearchService {
/**
* returns all creator autocompletes
*
*
* @param creatorPrefix
* @return
* @throws IOException
......@@ -77,7 +77,7 @@ public class SearchService {
/**
* returns all contributor autocompletes
*
*
* @param contributorPrefix
* @return
* @throws IOException
......@@ -88,13 +88,13 @@ public class SearchService {
/**
* returns all programmingLanguage autocompletes for keyWord
*
* @param progammingLanguagePrefix
*
* @param programmingLanguagePrefix
* @return
* @throws IOException
*/
public List<String> getProgrammingLanguageAutoComplete(String progammingLanguagePrefix) throws IOException {
return metaDataRepository.getProgrammingLanguageAutoComplete(progammingLanguagePrefix);
public List<String> getProgrammingLanguageAutoComplete(String programmingLanguagePrefix) throws IOException {
return metaDataRepository.getProgrammingLanguageAutoComplete(programmingLanguagePrefix);
}
/**
......@@ -118,11 +118,11 @@ public class SearchService {
log.warn("accessToken defined, but no gitlabAccess Issuer found?");
} else {
gitLabApi = new GitLabApi(gitLabAccessIssuer.get(), TokenType.OAUTH2_ACCESS, idToken);
gitLabApi = new GitLabApi(gitLabAccessIssuer.get(), TokenType.OAUTH2_ACCESS, idToken);
}
}
final GitLabApi gitLabApif = gitLabApi;
pageDetails.setSearchResult(pageDetails.getSearchResult().stream().filter(p->testAccess(p, gitLabApif)).collect(Collectors.toList()));
pageDetails.getSearchResult().stream().forEach(md -> fixImageURL(md, gitLabApif));
......@@ -138,10 +138,10 @@ public class SearchService {
Project gitProject = gitLabApi.getProjectApi().getProject(p.getProject().getProject_id());
final Permissions permissions = gitProject.getPermissions();
log.info("Permissions {}", permissions);
boolean access =
boolean access =
permissions.getProjectAccess()!=null &&
permissions.getProjectAccess().getAccessLevel().toValue() >= AccessLevel.GUEST.toValue() ||
permissions.getGroupAccess() !=null &&
permissions.getGroupAccess() !=null &&
permissions.getGroupAccess().getAccessLevel().toValue() >= AccessLevel.GUEST.toValue() ;
return access;
} catch (GitLabApiException e) {
......@@ -149,18 +149,18 @@ public class SearchService {
return false;
}
}
private void fixImageURL(SearchResultDTO metaData, GitLabApi gitLabApi) {
String image = metaData.getImage();
URI url = null;
try {
if(image != null) url = new URI(image);
if(url!=null && url.isAbsolute()) return;
final String baseUrl =
final String baseUrl =
ServletUriComponentsBuilder.fromCurrentContextPath().build().toUriString();
final boolean isJava = metaData.getProgrammingLanguage() != null && Arrays.stream(metaData.getProgrammingLanguage()).anyMatch(s -> s.startsWith("JAVA"))
final boolean isJava = metaData.getProgrammingLanguage() != null && Arrays.stream(metaData.getProgrammingLanguage()).anyMatch(s -> s.startsWith("JAVA"))
&& metaData.hashCode() % 2 == 0; // nur um ein wenig Abwechslung zu bekommen :-)
final boolean isLatexFormat = metaData.getFormat()!=null && Arrays.stream(metaData.getFormat()).anyMatch(s -> s.startsWith("latex"));
final boolean isPython = metaData.getProgrammingLanguage() != null && Arrays.stream(metaData.getProgrammingLanguage()).anyMatch(s -> s.startsWith("python"));
......@@ -178,9 +178,9 @@ public class SearchService {
}
metaData.setImage(baseUrl + "/content/img/gitLab.png");
if(true) return;
if(gitLabApi==null) return;
try {
Project gitProject = gitLabApi.getProjectApi().getProject(metaData.getProject().getProject_id());
final String httpUrlToRepo = gitProject.getHttpUrlToRepo();
......@@ -195,7 +195,7 @@ public class SearchService {
log.warn("Cannot parse image url {} for {}", metaData.getImage(), metaData.getGitURL());
}
}
/**
* temporary static test data.
*
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment