@Handler(id="updateCenterProcess",
input={
@HandlerInput(name="action", type=String.class, required=true ),
@HandlerInput(name="selectedRows", type=java.util.List.class, required=true )})
public static void updateCenterProcess(HandlerContext handlerCtx) {
Image image = getUpdateCenterImage();
boolean install = false;
String action= (String)handlerCtx.getInputValue("action");
if (action.equals("install")) {
install=true;
}
List obj = (List) handlerCtx.getInputValue("selectedRows");
if (obj == null){
//no row selected
return;
}
List<Map> selectedRows = (List) obj;
//do not use Fmri list to pass to installPackages, use String array to avoid UPDATECENTER2-2187
String[] fmris = new String[selectedRows.size()];
int i=0;
try {
for (Map oneRow : selectedRows) {
fmris[i++]=((Fmri)oneRow.get("fmri")).toString();
}
if (install){
image.installPackages(fmris);
//updateCountInSession(image); No need to update the update count since the count will not change. Only installing new component is allowed.
}else{
image.uninstallPackages(fmris);
}
GuiUtil.setSessionValue("restartRequired", Boolean.TRUE);
}catch(Exception ex){
GuiUtil.handleException(handlerCtx, ex);
ex.printStackTrace();