-
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.
Refactoring and simplifying code for AlgorithmFilter
- Loading branch information
Showing
20 changed files
with
268 additions
and
338 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
...nternet2/tier/shibboleth/admin/ui/controller/AlgorithmFilterUiDefinitionController.groovy
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,56 @@ | ||
| package edu.internet2.tier.shibboleth.admin.ui.controller | ||
|
|
||
| import com.fasterxml.jackson.databind.ObjectMapper | ||
| import edu.internet2.tier.shibboleth.admin.ui.jsonschema.JsonSchemaResourceLocation | ||
| import edu.internet2.tier.shibboleth.admin.ui.jsonschema.JsonSchemaResourceLocationRegistry | ||
| import edu.internet2.tier.shibboleth.admin.ui.service.JsonSchemaBuilderService | ||
| import groovy.util.logging.Slf4j | ||
| import io.swagger.v3.oas.annotations.tags.Tag | ||
| import io.swagger.v3.oas.annotations.tags.Tags | ||
| import org.springframework.beans.factory.annotation.Autowired | ||
| import org.springframework.http.ResponseEntity | ||
| import org.springframework.web.bind.annotation.GetMapping | ||
| import org.springframework.web.bind.annotation.RequestMapping | ||
| import org.springframework.web.bind.annotation.RestController | ||
|
|
||
| import javax.annotation.PostConstruct | ||
|
|
||
| import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR | ||
|
|
||
| /** | ||
| * Controller implementing REST resource responsible for exposing structure definition for algorithm format filter user | ||
| * interface in terms of JSON schema. | ||
| */ | ||
| @RestController | ||
| @RequestMapping('/api/ui/AlgorithmFilter') | ||
| @Slf4j | ||
| @Tags(value = [@Tag(name = "ui")]) | ||
| class AlgorithmFilterUiDefinitionController { | ||
|
|
||
| @Autowired | ||
| JsonSchemaResourceLocationRegistry jsonSchemaResourceLocationRegistry | ||
|
|
||
| JsonSchemaResourceLocation jsonSchemaLocation | ||
|
|
||
| @Autowired | ||
| ObjectMapper jacksonObjectMapper | ||
|
|
||
| @Autowired | ||
| JsonSchemaBuilderService jsonSchemaBuilderService | ||
|
|
||
| @GetMapping | ||
| ResponseEntity<?> getUiDefinitionJsonSchema() { | ||
| try { | ||
| def parsedJson = jacksonObjectMapper.readValue(this.jsonSchemaLocation.url, Map) | ||
| return ResponseEntity.ok(parsedJson) | ||
| } catch (Exception e) { | ||
| log.error(e.getMessage(), e) | ||
| return ResponseEntity.status(INTERNAL_SERVER_ERROR).body([jsonParseError : e.getMessage(), sourceUiSchemaDefinitionFile: this.jsonSchemaLocation.url]) | ||
| } | ||
| } | ||
|
|
||
| @PostConstruct | ||
| void init() { | ||
| // this.jsonSchemaLocation = algorithmFilterSchema(this.jsonSchemaResourceLocationRegistry) | ||
| } | ||
| } |
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
3 changes: 2 additions & 1 deletion
3
...dmin/ui/domain/filters/algorithm/MGF.java → .../tier/shibboleth/admin/ui/domain/MGF.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
3 changes: 2 additions & 1 deletion
3
...domain/filters/algorithm/OtherSource.java → ...ibboleth/admin/ui/domain/OtherSource.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
3 changes: 2 additions & 1 deletion
3
...dmin/ui/domain/filters/algorithm/PRF.java → .../tier/shibboleth/admin/ui/domain/PRF.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
39 changes: 39 additions & 0 deletions
39
...main/java/edu/internet2/tier/shibboleth/admin/ui/domain/filters/AbstractFilterTarget.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,39 @@ | ||
| package edu.internet2.tier.shibboleth.admin.ui.domain.filters; | ||
|
|
||
| import edu.internet2.tier.shibboleth.admin.ui.domain.AbstractAuditable; | ||
| import lombok.EqualsAndHashCode; | ||
|
|
||
| import javax.persistence.Column; | ||
| import javax.persistence.ElementCollection; | ||
| import javax.persistence.FetchType; | ||
| import javax.persistence.MappedSuperclass; | ||
| import javax.persistence.OrderColumn; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| @MappedSuperclass | ||
| @EqualsAndHashCode(callSuper = true) | ||
| public abstract class AbstractFilterTarget extends AbstractAuditable implements IFilterTarget { | ||
| @ElementCollection(fetch = FetchType.EAGER) | ||
| @OrderColumn | ||
| @Column(length = 760, name="target_value") | ||
| protected List<String> value; | ||
|
|
||
| @Override | ||
| public List<String> getValue() { | ||
| return value == null ? new ArrayList<>() : value; | ||
| } | ||
|
|
||
| @Override | ||
| public void setSingleValue(String value) { | ||
| List<String> values = new ArrayList<>(); | ||
| values.add(value); | ||
| this.value = values; | ||
| } | ||
|
|
||
| @Override | ||
| public void setValue(List<String> value) { | ||
| this.value = value; | ||
| } | ||
|
|
||
| } |
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
Oops, something went wrong.