Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
alfa
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OZG-Cloud
app
alfa
Merge requests
!16
Ozg 3936 refactor user profile url provider
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Ozg 3936 refactor user profile url provider
OZG-3936-refactor-UserProfileUrlProvider
into
main
Overview
24
Commits
21
Pipelines
0
Changes
9
Merged
Felix Reichenbach
requested to merge
OZG-3936-refactor-UserProfileUrlProvider
into
main
2 months ago
Overview
24
Commits
21
Pipelines
0
Changes
9
Expand
0
0
Merge request reports
Viewing commit
f679f39a
Prev
Next
Show latest version
9 files
+
15
−
165
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
9
Search (e.g. *.vue) (Ctrl+P)
f679f39a
OZG-3936 remove UserProfileUrlProvider
· f679f39a
Felix Reichenbach
authored
2 months ago
alfa-service/src/main/java/de/ozgcloud/alfa/common/UserProfileUrlProvider.java deleted
100644 → 0
+
0
−
74
Options
/*
* Copyright (C) 2023 Das Land Schleswig-Holstein vertreten durch den
* Ministerpräsidenten des Landes Schleswig-Holstein
* Staatskanzlei
* Abteilung Digitalisierung und zentrales IT-Management der Landesregierung
*
* Lizenziert unter der EUPL, Version 1.2 oder - sobald
* diese von der Europäischen Kommission genehmigt wurden -
* Folgeversionen der EUPL ("Lizenz");
* Sie dürfen dieses Werk ausschließlich gemäß
* dieser Lizenz nutzen.
* Eine Kopie der Lizenz finden Sie hier:
*
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*
* Sofern nicht durch anwendbare Rechtsvorschriften
* gefordert oder in schriftlicher Form vereinbart, wird
* die unter der Lizenz verbreitete Software "so wie sie
* ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN -
* ausdrücklich oder stillschweigend - verbreitet.
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
package
de.ozgcloud.alfa.common
;
import
java.util.Objects
;
import
org.springframework.beans.BeansException
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.stereotype.Component
;
import
com.google.common.base.Preconditions
;
@Component
public
class
UserProfileUrlProvider
implements
ApplicationContextAware
{
// TODO auf javax.validation umstellen
private
static
final
String
ERROR_MESSAGE
=
"Key %s missing, please add it to the application.yml"
;
// TODO applicationContext darf nicht static abgelegt werden - es sollte möglich
// sein, dass eine andere Konfiguration in der jvm läuft.
private
static
ApplicationContext
applicationContext
;
static
final
String
URL_ROOT_KEY
=
"ozgcloud.user-manager.url"
;
static
final
String
USER_PROFILES_TEMPLATE_KEY
=
"ozgcloud.user-manager.profile-template"
;
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
UserProfileUrlProvider
.
setSpringContext
(
applicationContext
);
}
private
static
void
setSpringContext
(
ApplicationContext
context
)
{
applicationContext
=
context
;
}
public
static
boolean
isConfigured
()
{
return
Objects
.
nonNull
(
applicationContext
.
getEnvironment
().
getProperty
(
URL_ROOT_KEY
))
&&
Objects
.
nonNull
(
applicationContext
.
getEnvironment
().
getProperty
(
USER_PROFILES_TEMPLATE_KEY
));
}
public
static
String
getUrl
(
Object
val
)
{
// TODO Abhängingkeit zu com.google.common ausbauen
Preconditions
.
checkNotNull
(
applicationContext
,
"ApplicationContext not initialized"
);
// TODO parameter lieber injezieren und validation verwenden
var
rootUrl
=
applicationContext
.
getEnvironment
().
getProperty
(
URL_ROOT_KEY
);
Preconditions
.
checkNotNull
(
rootUrl
,
ERROR_MESSAGE
,
URL_ROOT_KEY
);
var
template
=
applicationContext
.
getEnvironment
().
getProperty
(
USER_PROFILES_TEMPLATE_KEY
);
Preconditions
.
checkNotNull
(
template
,
ERROR_MESSAGE
,
USER_PROFILES_TEMPLATE_KEY
);
// TODO UriComponent Builder verwenden
var
profilesUrl
=
rootUrl
+
template
;
return
String
.
format
(
profilesUrl
,
val
);
}
}
Loading