重构:SST的action方法应该怎样改1?

正在开发的系统中有个action方法比较难看,重构了一下,各位看客随便说说,怎样改更好。
---------------------修改前
/**
* 预警记录查询
* @return
* @throws ParseException
*/
public String selectEquipmentAlert() throws ParseException{
pageTrace = new PageTrace(this.recordPerPage);
    pageTrace.setPageIndex(this.pageIndex);
    this.equipmentAlertList = listEquipmentAlert(pageTrace);
return "selectEquipmentAlert";
}

/**
* @author pescado
* @param pageTrace
* @throws ParseException
*/
private List<EquipmentAlert> listEquipmentAlert(PageTrace pageTrace) throws ParseException {
List<EquipmentAlert> ealist = null;
    Integer[] aStatus = null;
    if(statusString!=null&&!statusString.equals("")){
    String[] aStatusString = statusString.split(",");
    aStatus = new Integer[aStatusString.length];
    for(int i = 0 ; i < aStatusString.length ; i++){
    aStatus[i] = Integer.parseInt(aStatusString[i]);
    }
    }
    ealist = this.equipmentAlertService.getEquipmentAlertList(alertId,startTime, name, aStatus, pageTrace);
    return ealist;
}
----------------------修改后
/**
* 根据表具ID、名称,预警时间等查询预警记录
* @return
* @throws ParseException
*/
public String selectEquipmentAlert() throws ParseException{
pageTrace = new PageTrace(this.recordPerPage);
    pageTrace.setPageIndex(this.pageIndex);
    Integer[] aStatus = alertStatusStr2IntArray(this.statusString);
    this.equipmentAlertList = this.equipmentAlertService.getEquipmentAlertList(alertId,startTime, name, aStatus, pageTrace);
return "selectEquipmentAlert";
}
/**
* 将逗号分隔的预警状态字符串转为int类型数组
* @param sStatus
* @return
* @throws ParseException
*/
private Integer[] alertStatusStr2IntArray(String sStatus) throws ParseException {
    Integer[] iStatus = null;
    if(sStatus!=null&&!sStatus.equals("")){
    String[] sStatuss = sStatus.split(",");
    iStatus = new Integer[sStatuss.length];
    for(int i = 0 ; i < sStatuss.length ; i++){
    iStatus[i] = Integer.parseInt(sStatuss[i]);
    }
    }
    return iStatus;
}

你可能感兴趣的:(重构:SST的action方法应该怎样改1?)