use of org.talend.utils.json.JSONObject in project tdi-studio-se by Talend.
the class MyExtensionAction method setValuesForExension.
private void setValuesForExension(ComponentExtension componentExtension, String values, List<VersionRevision> versionRevisions) throws JSONException {
JSONObject jsObject = new JSONObject(values);
if (jsObject.has(ContentConstants.EXTENSION_VALUE_LABEL)) {
componentExtension.setLabel(jsObject.getString(ContentConstants.EXTENSION_VALUE_LABEL));
}
if (jsObject.has(ContentConstants.EXTENSION_VALUE_LASTVERSIONAVAILABLE)) {
componentExtension.setLastVersionAvailable(jsObject.getString(ContentConstants.EXTENSION_VALUE_LASTVERSIONAVAILABLE));
}
if (jsObject.has(ContentConstants.EXTENSION_VALUE_DESCRIPTION)) {
componentExtension.setDescription(jsObject.getString(ContentConstants.EXTENSION_VALUE_DESCRIPTION));
}
if (jsObject.has(ContentConstants.EXTENSION_VALUE_COMPATIBLES)) {
String compatibles = jsObject.getString(ContentConstants.EXTENSION_VALUE_COMPATIBLES);
String filter = null;
if (jsObject.has(ContentConstants.EXTENSION_VALUE_Filter)) {
filter = jsObject.getString(ContentConstants.EXTENSION_VALUE_Filter);
}
String revision = filterVersionRevisionsToString(compatibles, filter, versionRevisions);
componentExtension.setListVersionCompatibles(revision);
}
if (jsObject.has(ContentConstants.EXTENSION_VALUE_FILENAME)) {
componentExtension.setFilename(jsObject.getString(ContentConstants.EXTENSION_VALUE_FILENAME));
}
}
Aggregations