in src/main/java/org/apache/sling/feature/extension/apiregions/api/config/ConfigurationApi.java [176:268]
public void fromJSONObject(final JsonObject jsonObj) throws IOException {
super.fromJSONObject(jsonObj);
try {
final String typeVal = this.getString(InternalConstants.KEY_REGION);
if ( typeVal != null ) {
this.setRegion(Region.valueOf(typeVal.toUpperCase()));
}
JsonValue val;
val = this.getAttributes().remove(InternalConstants.KEY_CONFIGURATIONS);
if ( val != null ) {
for(final Map.Entry<String, JsonValue> innerEntry : val.asJsonObject().entrySet()) {
final ConfigurationDescription cfg = new ConfigurationDescription();
cfg.fromJSONObject(innerEntry.getValue().asJsonObject());
this.getConfigurationDescriptions().put(innerEntry.getKey(), cfg);
}
}
val = this.getAttributes().remove(InternalConstants.KEY_FACTORIES);
if ( val != null ) {
for(final Map.Entry<String, JsonValue> innerEntry : val.asJsonObject().entrySet()) {
final FactoryConfigurationDescription cfg = new FactoryConfigurationDescription();
cfg.fromJSONObject(innerEntry.getValue().asJsonObject());
this.getFactoryConfigurationDescriptions().put(innerEntry.getKey(), cfg);
}
}
val = this.getAttributes().remove(InternalConstants.KEY_FWK_PROPERTIES);
if ( val != null ) {
for(final Map.Entry<String, JsonValue> innerEntry : val.asJsonObject().entrySet()) {
final FrameworkPropertyDescription cfg = new FrameworkPropertyDescription();
cfg.fromJSONObject(innerEntry.getValue().asJsonObject());
this.getFrameworkPropertyDescriptions().put(innerEntry.getKey(), cfg);
}
}
val = this.getAttributes().remove(InternalConstants.KEY_INTERNAL_CONFIGURATIONS);
if ( val != null ) {
for(final JsonValue innerVal : val.asJsonArray()) {
final ConfigurationDescription cfg = new ConfigurationDescription();
this.getConfigurationDescriptions().put(getString(innerVal), cfg);
}
}
val = this.getAttributes().remove(InternalConstants.KEY_INTERNAL_FACTORIES);
if ( val != null ) {
for(final JsonValue innerVal : val.asJsonArray()) {
final FactoryConfigurationDescription cfg = new FactoryConfigurationDescription();
this.getFactoryConfigurationDescriptions().put(getString(innerVal), cfg);
}
}
val = this.getAttributes().remove(InternalConstants.KEY_INTERNAL_FWK_PROPERTIES);
if ( val != null ) {
for(final JsonValue innerVal : val.asJsonArray()) {
this.getInternalFrameworkProperties().add(getString(innerVal));
}
}
val = this.getAttributes().remove(InternalConstants.KEY_REGION_CACHE);
if ( val != null ) {
for(final Map.Entry<String, JsonValue> innerEntry : val.asJsonObject().entrySet()) {
this.getFeatureToRegionCache().put(ArtifactId.parse(innerEntry.getKey()),
Region.valueOf(getString(innerEntry.getValue()).toUpperCase()));
}
}
final String modeVal = this.getString(InternalConstants.KEY_MODE);
if ( modeVal != null ) {
this.setMode(Mode.valueOf(modeVal.toUpperCase()));
}
val = this.getAttributes().remove(InternalConstants.KEY_CONFIGURATION_ADDITIONS);
if ( val != null ) {
for(final Map.Entry<String, JsonValue> innerEntry : val.asJsonObject().entrySet()) {
final ConfigurationDescriptionAddition cfg = new ConfigurationDescriptionAddition();
cfg.fromJSONObject(innerEntry.getValue().asJsonObject());
this.getConfigurationDescriptionAdditions().put(innerEntry.getKey(), cfg);
}
}
val = this.getAttributes().remove(InternalConstants.KEY_FACTORY_ADDITIONS);
if ( val != null ) {
for(final Map.Entry<String, JsonValue> innerEntry : val.asJsonObject().entrySet()) {
final FactoryConfigurationDescriptionAddition cfg = new FactoryConfigurationDescriptionAddition();
cfg.fromJSONObject(innerEntry.getValue().asJsonObject());
this.getFactoryConfigurationDescriptionAdditions().put(innerEntry.getKey(), cfg);
}
}
} catch (final JsonException | IllegalArgumentException e) {
throw new IOException(e);
}
}