Merge branch 'develop' into test-data-improvements

This commit is contained in:
Nico Athanassiadis 2025-03-03 08:00:52 +01:00
commit 88d811c465
7 changed files with 10 additions and 57 deletions
core
pom.xml
src/main/java/se/su/dsv/scipro/match
pom.xml
view/src/main/java/se/su/dsv/scipro
war/src/main/java/se/su/dsv/scipro/war

@ -23,36 +23,14 @@
<dependency> <dependency>
<groupId>org.glassfish.jersey.core</groupId> <groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId> <artifactId>jersey-client</artifactId>
<exclusions>
<exclusion>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.glassfish.jersey.media</groupId> <groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-jaxb</artifactId> <artifactId>jersey-media-jaxb</artifactId>
<exclusions>
<exclusion>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.glassfish.jersey.media</groupId> <groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId> <artifactId>jersey-media-json-jackson</artifactId>
<exclusions>
<exclusion>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>

@ -176,18 +176,16 @@ public class ApplicationPeriod extends DomainObject {
return Collections.unmodifiableSet(answerSet); return Collections.unmodifiableSet(answerSet);
} }
public void setProjectTypes(Iterable<ProjectType> projectTypes) { public void setProjectTypes(Set<ProjectType> projectTypes) {
this.projectTypes.clear(); this.projectTypes.removeIf(appt -> !projectTypes.contains(appt.getProjectType()));
for (ProjectType pt : projectTypes) { for (ProjectType pt : projectTypes) {
this.projectTypes.add(new ApplicationPeriodProjectType(this, pt)); if (this.projectTypes.stream().noneMatch(appt -> appt.getProjectType().equals(pt))) {
addProjectType(pt);
}
} }
} }
public void addProjectType(ProjectType projectType) { public void addProjectType(ProjectType projectType) {
this.projectTypes.add(new ApplicationPeriodProjectType(this, projectType)); this.projectTypes.add(new ApplicationPeriodProjectType(this, projectType));
} }
public void removeProjectType(ProjectType projectType) {
this.projectTypes.removeIf(next -> next.getProjectType().equals(projectType));
}
} }

@ -296,13 +296,6 @@
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
</dependency> </dependency>
<!-- Additional dependencies -->
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<!-- Test stuff --> <!-- Test stuff -->
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>

@ -123,13 +123,7 @@ public class AdminApplicationPeriodsPanel extends Panel {
item.add( item.add(
new DisplayMultiplesPanel<>( new DisplayMultiplesPanel<>(
s, s,
new ListAdapterModel<>( new ListAdapterModel<>(iModel.map(ApplicationPeriod::getProjectTypes))
LambdaModel.of(
iModel,
ApplicationPeriod::getProjectTypes,
ApplicationPeriod::setProjectTypes
)
)
) { ) {
@Override @Override
public Component getComponent(String componentId, IModel<ProjectType> t) { public Component getComponent(String componentId, IModel<ProjectType> t) {

@ -22,12 +22,7 @@ public class AddTargetLinkPanel extends Panel {
public AddTargetLinkPanel(String id, final IModel<ApplicationPeriod> model) { public AddTargetLinkPanel(String id, final IModel<ApplicationPeriod> model) {
super(id, model); super(id, model);
add( add(
new ListView<>( new ListView<>("list", new ListAdapterModel<>(model.map(ApplicationPeriod::getProjectTypes))) {
"list",
new ListAdapterModel<>(
LambdaModel.of(model, ApplicationPeriod::getProjectTypes, ApplicationPeriod::setProjectTypes)
)
) {
@Override @Override
protected void populateItem(ListItem<ProjectType> item) { protected void populateItem(ListItem<ProjectType> item) {
item.add(new Label("pc", item.getModelObject().getName())); item.add(new Label("pc", item.getModelObject().getName()));

@ -76,13 +76,7 @@ public class ProjectPartnerPage extends AbstractIdeaProjectPage implements MenuH
} }
); );
final IModel<? extends List<ProjectType>> matchableTypes = getMatchableTypes( final IModel<? extends List<ProjectType>> matchableTypes = getMatchableTypes(
new ListAdapterModel<>( new ListAdapterModel<>(applicationPeriod.map(ApplicationPeriod::getProjectTypes))
LambdaModel.of(
applicationPeriod,
ApplicationPeriod::getProjectTypes,
ApplicationPeriod::setProjectTypes
)
)
); );
panelContainer.add( panelContainer.add(
new ListView<>("ads", matchableTypes) { new ListView<>("ads", matchableTypes) {

@ -4,6 +4,7 @@ import jakarta.inject.Inject;
import jakarta.inject.Provider; import jakarta.inject.Provider;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.io.Serializable;
import java.security.Principal; import java.security.Principal;
import java.util.Collections; import java.util.Collections;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@ -81,7 +82,7 @@ public class CurrentUserFromSpringSecurity implements AuthenticationContext {
return authentication.getName(); return authentication.getName();
} }
private static final class WicketControlledPrincipal implements Principal { private static final class WicketControlledPrincipal implements Principal, Serializable {
private final String username; private final String username;