use of org.talend.designer.components.exchange.model.Category in project tdi-studio-se by Talend.
the class ExchangeWebService method searchCategoryExtensionJSONArray.
/**
*
* DOC hcyi Comment method "searchCategoryExtensionJSONArray".
*
* @param typeExtension
* @return
*/
public static List<Category> searchCategoryExtensionJSONArray(String typeExtension) {
List<Category> fCategorys = new ArrayList<Category>();
JSONObject tokenMessage = new JSONObject();
try {
tokenMessage.put("typeExtension", typeExtension);
JSONObject token = new us.monoid.json.JSONObject();
token.put("extension", tokenMessage);
String u = exchangeWSServer + "listCategoryExtension.php?data=" + token;
JSONObject resultObj = readJsonFromUrl(u);
if (resultObj != null) {
JSONObject p = (JSONObject) resultObj.get("listCategory");
JSONArray resultArry = p.getJSONArray("category");
if (resultArry != null) {
for (int i = 0; i < resultArry.length(); i++) {
JSONObject extensionObj = resultArry.getJSONObject(i);
if (extensionObj != null) {
Category fCategory = ExchangeFactory.eINSTANCE.createCategory();
fCategory.setCategoryId(extensionObj.getString("id_category"));
fCategory.setCategoryName(extensionObj.getString("name"));
fCategorys.add(fCategory);
}
}
}
}
} catch (JSONException e) {
//
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return fCategorys;
}
use of org.talend.designer.components.exchange.model.Category in project tdi-studio-se by Talend.
the class ImportCompatibleEcoComponentsComposite method initCategoryCombo.
public void initCategoryCombo() {
if (categoryCombo.getItemCount() > 0) {
return;
}
Iterator<Category> cListIterator = fCategorys.iterator();
while (cListIterator.hasNext()) {
Category category = cListIterator.next();
// now hide the Category : Component ,Hadoop Configuration
if ("Component".equals(category.getCategoryName()) || "Hadoop Configuration".equals(category.getCategoryName())) {
cListIterator.remove();
continue;
}
categoryCombo.add(category.getCategoryName());
}
categoryCombo.select(0);
categoryCombo.pack();
}
Aggregations