This is the codeAbility Sharing Platform! Learn more about the
codeAbility Sharing Platform
.
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
codeAbility Sharing Platform
Manage
Activity
Members
Labels
Plan
Issues
43
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
development
sharing
codeAbility Sharing Platform
Commits
27f08844
Commit
27f08844
authored
4 years ago
by
Daniel Rainer
Browse files
Options
Downloads
Patches
Plain Diff
Fix typo
parent
4101b85e
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!17
Initial Merge to Prepare Release 1.0.0
,
!1
Resolve "Metadaten konsolideren"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/at/ac/uibk/gitsearch/service/SearchService.java
+20
-20
20 additions, 20 deletions
...main/java/at/ac/uibk/gitsearch/service/SearchService.java
with
20 additions
and
20 deletions
src/main/java/at/ac/uibk/gitsearch/service/SearchService.java
+
20
−
20
View file @
27f08844
...
...
@@ -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 prog
r
ammingLanguagePrefix
* @return
* @throws IOException
*/
public
List
<
String
>
getProgrammingLanguageAutoComplete
(
String
progammingLanguagePrefix
)
throws
IOException
{
return
metaDataRepository
.
getProgrammingLanguageAutoComplete
(
progammingLanguagePrefix
);
public
List
<
String
>
getProgrammingLanguageAutoComplete
(
String
prog
r
ammingLanguagePrefix
)
throws
IOException
{
return
metaDataRepository
.
getProgrammingLanguageAutoComplete
(
prog
r
ammingLanguagePrefix
);
}
/**
...
...
@@ -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.
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment