-
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.
Fixing output JSON for the UI so type values are correct
- Loading branch information
Showing
3 changed files
with
105 additions
and
0 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
43 changes: 43 additions & 0 deletions
43
...tier/shibboleth/admin/ui/domain/shib/properties/ShibPropertySettingJacksonSerializer.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,43 @@ | ||
| package edu.internet2.tier.shibboleth.admin.ui.domain.shib.properties; | ||
|
|
||
| import com.fasterxml.jackson.core.JsonGenerator; | ||
| import com.fasterxml.jackson.databind.SerializerProvider; | ||
| import com.fasterxml.jackson.databind.ser.std.StdSerializer; | ||
|
|
||
| import java.io.IOException; | ||
|
|
||
| public class ShibPropertySettingJacksonSerializer extends StdSerializer<ShibPropertySetting> { | ||
| public ShibPropertySettingJacksonSerializer() { | ||
| this(null); | ||
| } | ||
|
|
||
| public ShibPropertySettingJacksonSerializer(Class<ShibPropertySetting> t) { | ||
| super(t); | ||
| } | ||
|
|
||
| @Override | ||
| public void serialize(ShibPropertySetting sps, JsonGenerator generator, SerializerProvider provider) throws IOException { | ||
| generator.writeStartObject(); | ||
| generator.writeNumberField("resourceId", sps.getResourceId()); | ||
| generator.writeStringField("configFile", sps.getConfigFile()); | ||
| generator.writeStringField("propertyName", sps.getPropertyName()); | ||
| if (sps.getCategory() != null) { | ||
| generator.writeStringField("category", sps.getCategory()); | ||
| } | ||
| generator.writeStringField("displayType", sps.getDisplayType()); | ||
|
|
||
| switch (sps.getDisplayType()) { | ||
| case "boolean": | ||
| generator.writeBooleanField("propertyValue", Boolean.valueOf(sps.getPropertyValue())); | ||
| break; | ||
| case "number": | ||
| generator.writeNumberField("propertyValue", Long.parseLong(sps.getPropertyValue())); | ||
| break; | ||
| default: | ||
| generator.writeStringField("propertyValue", sps.getPropertyValue()); | ||
| } | ||
|
|
||
| generator.writeEndObject(); | ||
| } | ||
|
|
||
| } |
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