-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/shibui-2270' of bitbucket.org:unicon/shib-idp-u…
…i into feature/SHIBUI-2270-property-list
- Loading branch information
Showing
18 changed files
with
833 additions
and
676 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...ternet2/tier/shibboleth/admin/ui/controller/ShibPropertiesControllerExceptionHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| package edu.internet2.tier.shibboleth.admin.ui.controller; | ||
|
|
||
| import edu.internet2.tier.shibboleth.admin.ui.exception.EntityNotFoundException; | ||
| import edu.internet2.tier.shibboleth.admin.ui.exception.ObjectIdExistsException; | ||
| import org.springframework.http.HttpHeaders; | ||
| import org.springframework.http.HttpStatus; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.ControllerAdvice; | ||
| import org.springframework.web.bind.annotation.ExceptionHandler; | ||
| import org.springframework.web.context.request.WebRequest; | ||
| import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; | ||
|
|
||
| import java.io.IOException; | ||
|
|
||
| @ControllerAdvice(assignableTypes = {ShibPropertiesController.class}) | ||
| public class ShibPropertiesControllerExceptionHandler extends ResponseEntityExceptionHandler { | ||
| @ExceptionHandler({ EntityNotFoundException.class }) | ||
| public ResponseEntity<?> handleEntityNotFoundException(EntityNotFoundException e, WebRequest request) { | ||
| return ResponseEntity.status(HttpStatus.NOT_FOUND).body(new ErrorResponse(HttpStatus.NOT_FOUND, e.getMessage())); | ||
| } | ||
|
|
||
| @ExceptionHandler({ IOException.class }) | ||
| public ResponseEntity<?> handleIOException(EntityNotFoundException e, WebRequest request) { | ||
| return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error creating file"); | ||
| } | ||
|
|
||
| @ExceptionHandler({ ObjectIdExistsException.class }) | ||
| public ResponseEntity<?> handleObjectIdExistsException(ObjectIdExistsException e, WebRequest request) { | ||
| HttpHeaders headers = new HttpHeaders(); | ||
| headers.setLocation(EntityDescriptorController.getResourceUriFor(e.getMessage())); | ||
| return ResponseEntity.status(HttpStatus.CONFLICT).headers(headers).body(new ErrorResponse( | ||
| String.valueOf(HttpStatus.CONFLICT.value()), | ||
| String.format("The property set with id [%s] already exists.", e.getMessage()))); | ||
| } | ||
| } |
2 changes: 1 addition & 1 deletion
2
.../ui/domain/ShibConfigurationProperty.java → ...properties/ShibConfigurationProperty.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...n/java/edu/internet2/tier/shibboleth/admin/ui/domain/shib/properties/ShibPropertySet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| package edu.internet2.tier.shibboleth.admin.ui.domain.shib.properties; | ||
|
|
||
| import edu.internet2.tier.shibboleth.admin.util.EmptyStringToNullConverter; | ||
| import lombok.Getter; | ||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.Setter; | ||
| import lombok.ToString; | ||
| import org.hibernate.envers.Audited; | ||
|
|
||
| import javax.persistence.Column; | ||
| import javax.persistence.Convert; | ||
| import javax.persistence.Entity; | ||
| import javax.persistence.GeneratedValue; | ||
| import javax.persistence.Id; | ||
| import javax.persistence.OneToMany; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| @Entity(name = "shib_property_set") | ||
| @Audited | ||
| @Getter | ||
| @Setter | ||
| @ToString | ||
| @RequiredArgsConstructor | ||
| public class ShibPropertySet { | ||
| @Id | ||
| @GeneratedValue | ||
| private int resourceId; | ||
|
|
||
| @Column(unique = true, nullable = false) | ||
| @Convert(converter = EmptyStringToNullConverter.class) | ||
| private String name; | ||
|
|
||
| @OneToMany | ||
| private List<ShibPropertySetting> properties = new ArrayList<>(); | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
| if (o instanceof ShibPropertySet) { | ||
| ShibPropertySet that = (ShibPropertySet) o; | ||
| boolean result = this.name.equals(that.name) && this.resourceId == that.resourceId && this.properties.size() == that.properties.size(); | ||
| if (result == true) { | ||
| for (ShibPropertySetting thisSetting : this.properties) { | ||
| if ( !that.properties.contains(thisSetting) ) { | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
| return result; | ||
| } | ||
| return false; | ||
| } | ||
| } |
29 changes: 29 additions & 0 deletions
29
...va/edu/internet2/tier/shibboleth/admin/ui/domain/shib/properties/ShibPropertySetting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| package edu.internet2.tier.shibboleth.admin.ui.domain.shib.properties; | ||
|
|
||
| import lombok.Data; | ||
| import org.hibernate.envers.Audited; | ||
|
|
||
| import javax.persistence.Column; | ||
| import javax.persistence.Entity; | ||
| import javax.persistence.GeneratedValue; | ||
| import javax.persistence.Id; | ||
| import javax.persistence.ManyToOne; | ||
|
|
||
| @Entity(name = "shib_property_setting") | ||
| @Audited | ||
| @Data | ||
| public class ShibPropertySetting { | ||
| @Id | ||
| @GeneratedValue | ||
| private int resourceId; | ||
|
|
||
| @Column | ||
| private String configFile; | ||
|
|
||
| @Column | ||
| private String propertyName; | ||
|
|
||
| @Column | ||
| private String propertyValue; | ||
|
|
||
| } |
3 changes: 3 additions & 0 deletions
3
...c/main/java/edu/internet2/tier/shibboleth/admin/ui/exception/EntityNotFoundException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
.../src/main/java/edu/internet2/tier/shibboleth/admin/ui/repository/ProjectionIdAndName.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| package edu.internet2.tier.shibboleth.admin.ui.repository; | ||
|
|
||
| public interface ProjectionIdAndName{ | ||
| String getResourceId(); | ||
| String getName(); | ||
| } |
2 changes: 1 addition & 1 deletion
2
...n/java/edu/internet2/tier/shibboleth/admin/ui/repository/ShibConfigurationRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...ain/java/edu/internet2/tier/shibboleth/admin/ui/repository/ShibPropertySetRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package edu.internet2.tier.shibboleth.admin.ui.repository; | ||
|
|
||
| import edu.internet2.tier.shibboleth.admin.ui.domain.shib.properties.ShibPropertySet; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| /** | ||
| * Repository to manage {@link ShibPropertySet} instances. | ||
| */ | ||
| public interface ShibPropertySetRepository extends JpaRepository<ShibPropertySet, String> { | ||
| ShibPropertySet findByName(String name); | ||
|
|
||
| ShibPropertySet findByResourceId(Integer id); | ||
|
|
||
| List<ProjectionIdAndName> findAllBy(); | ||
| } |
10 changes: 10 additions & 0 deletions
10
...java/edu/internet2/tier/shibboleth/admin/ui/repository/ShibPropertySettingRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package edu.internet2.tier.shibboleth.admin.ui.repository; | ||
|
|
||
| import edu.internet2.tier.shibboleth.admin.ui.domain.shib.properties.ShibPropertySetting; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
|
|
||
| /** | ||
| * Repository to manage {@link ShibPropertySetting} instances. | ||
| */ | ||
| public interface ShibPropertySettingRepository extends JpaRepository<ShibPropertySetting, String> { | ||
| } |
22 changes: 18 additions & 4 deletions
22
...rc/main/java/edu/internet2/tier/shibboleth/admin/ui/service/ShibConfigurationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,30 @@ | ||
| package edu.internet2.tier.shibboleth.admin.ui.service; | ||
|
|
||
| import edu.internet2.tier.shibboleth.admin.ui.domain.ShibConfigurationProperty; | ||
| import edu.internet2.tier.shibboleth.admin.ui.domain.shib.properties.ShibConfigurationProperty; | ||
| import edu.internet2.tier.shibboleth.admin.ui.domain.shib.properties.ShibPropertySet; | ||
| import edu.internet2.tier.shibboleth.admin.ui.exception.EntityNotFoundException; | ||
| import edu.internet2.tier.shibboleth.admin.ui.exception.ObjectIdExistsException; | ||
| import edu.internet2.tier.shibboleth.admin.ui.repository.ProjectionIdAndName; | ||
|
|
||
| import java.util.Collection; | ||
| import java.util.List; | ||
|
|
||
| public interface ShibConfigurationService { | ||
| void addAll(Collection<ShibConfigurationProperty> newProperties); | ||
| void addAllConfigurationProperties(Collection<ShibConfigurationProperty> newProperties); | ||
|
|
||
| ShibPropertySet create(ShibPropertySet set) throws ObjectIdExistsException; | ||
|
|
||
| void delete(int resourceId) throws EntityNotFoundException; | ||
|
|
||
| List<ShibConfigurationProperty> getAllConfigurationProperties(); | ||
|
|
||
| List<ProjectionIdAndName> getAllPropertySets(); | ||
|
|
||
| List<String> getExistingPropertyNames(); | ||
|
|
||
| void save(ShibConfigurationProperty prop); | ||
| ShibPropertySet getSet(int resourceId) throws EntityNotFoundException; | ||
|
|
||
| ShibConfigurationProperty save(ShibConfigurationProperty prop); | ||
|
|
||
| List<ShibConfigurationProperty> getAll(); | ||
| ShibPropertySet update(ShibPropertySet setToUpdate) throws EntityNotFoundException; | ||
| } |
Oops, something went wrong.