use of org.talend.utils.json.JSONObject in project tdi-studio-se by Talend.
the class LoginHelper method getLocation.
private String getLocation(String url) throws JSONException {
JSONObject jsonObject = new JSONObject(url);
//$NON-NLS-1$
String location = "";
if (jsonObject.has("location")) {
//$NON-NLS-1$
location = jsonObject.getString("location");
}
return location;
}
use of org.talend.utils.json.JSONObject in project tdi-studio-se by Talend.
the class LoginProjectPage method getStorage.
private String getStorage(Project project) throws JSONException {
if (project == null) {
return "";
}
String storage = "";
if (project != null) {
String url = project.getEmfProject().getUrl();
if (url == null) {
return "";
}
JSONObject jsonObj = new JSONObject(url);
storage = jsonObj.getString("storage");
}
return storage;
}
use of org.talend.utils.json.JSONObject in project tdi-studio-se by Talend.
the class ColumnListController method reUsedColumnFunctionArrayCheck.
private static void reUsedColumnFunctionArrayCheck(Map<String, Object> newLine, IElement element, String[] codes) {
if (element instanceof INode && ((INode) element).getMetadataList().size() > 0 && ((INode) element).getComponent().getName().equals("tRowGenerator")) {
IMetadataTable table = ((INode) element).getMetadataList().get(0);
//$NON-NLS-1$
String lineName = (String) newLine.get("SCHEMA_COLUMN");
for (IMetadataColumn column : table.getListColumns()) {
if (lineName != null && lineName.equals(column.getLabel()) && "".equals(newLine.get("ARRAY"))) {
Map<String, String> columnFunction = column.getAdditionalField();
String functionInfo = columnFunction.get(FUNCTION_INFO);
if (functionInfo != null) {
try {
JSONObject functionInfoObj = new JSONObject(functionInfo);
String functionExpression = "";
String functionName = functionInfoObj.getString(Function.NAME);
if (!functionName.equals("...")) {
String className = functionInfoObj.getString(Function.PARAMETER_CLASS_NAME);
String parmValueApend = "";
functionExpression = className + '.' + functionName + "(";
JSONArray parametersArray = functionInfoObj.getJSONArray(Function.PARAMETERS);
if (parametersArray != null) {
for (int i = 0; i < parametersArray.length(); i++) {
JSONObject parameterObj = parametersArray.getJSONObject(i);
String paramValue = parameterObj.getString(Function.PARAMETER_VALUE);
parmValueApend = parmValueApend + paramValue.trim() + ',';
}
}
if (parmValueApend.endsWith(",")) {
parmValueApend = parmValueApend.substring(0, parmValueApend.lastIndexOf(","));
}
functionExpression = functionExpression + parmValueApend + ')';
newLine.put("ARRAY", functionExpression);
}
} catch (JSONException e) {
ExceptionHandler.process(e);
}
}
}
}
}
}
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