final String resourceElement = "<drools:resource type=\"PKG\" source=\"{url}\" basicAuthentication='enabled' username='|' password=''/>";
final TreeItem packageItem = new TreeItem(packageConfigData.getName());
TreeItem leafItem = new TreeItem(new ClickableLabel("LATEST", new LeafClickHandler(packageConfigData.getName(), resourceElement.replace("{url}", PackageBuilderWidget.getDownloadLink(packageConfigData)))));
packageItem.addItem(leafItem);
ModuleServiceAsync moduleService = GWT.create(ModuleService.class);
moduleService.listSnapshots(packageConfigData.getName(), new AsyncCallback<SnapshotInfo[]>() {
public void onFailure(Throwable caught) {
ErrorPopup.showMessage("Error listing snapshots information!");
}
public void onSuccess(SnapshotInfo[] result) {
for (int j = 0; j < result.length; j++) {
final SnapshotInfo snapshotInfo = result[j];
ModuleServiceAsync moduleService = GWT.create(ModuleService.class);
moduleService.loadModule(snapshotInfo.getUuid(), new AsyncCallback<Module>() {
public void onFailure(Throwable caught) {
ErrorPopup.showMessage("Error listing snapshots information!");
}
public void onSuccess(Module result) {
TreeItem leafItem = new TreeItem(new ClickableLabel(snapshotInfo.getName(), new LeafClickHandler(packageConfigData.getName(), resourceElement.replace("{url}", PackageBuilderWidget.getDownloadLink(result)))));
packageItem.addItem(leafItem);
}
});
}