87 lines
2.7 KiB
Java
87 lines
2.7 KiB
Java
package WEB-INF.classes.wenrgise.common.vo;
|
|
|
|
import java.io.Serializable;
|
|
import java.sql.Timestamp;
|
|
import java.util.ArrayList;
|
|
import wenrgise.common.bean.BaseHeaderBean;
|
|
import wenrgise.common.exception.EnrgiseApplicationException;
|
|
import wenrgise.common.vo.BaseVO;
|
|
|
|
public class BaseHeaderVO extends BaseVO implements Serializable {
|
|
private ArrayList oHeaderVOTable = new ArrayList();
|
|
|
|
private long positionRequested = 0L;
|
|
|
|
private long currentSlot = 0L;
|
|
|
|
private long totalCount = 0L;
|
|
|
|
private long maxHeaderSize = 0L;
|
|
|
|
private Timestamp oWhenPicked = null;
|
|
|
|
public ArrayList getOHeaderVOTable() {
|
|
return this.oHeaderVOTable;
|
|
}
|
|
|
|
public long getHeaderStartPosition() throws EnrgiseApplicationException {
|
|
int iSlot = getSlot();
|
|
return (iSlot - 1) * this.maxHeaderSize + 1L;
|
|
}
|
|
|
|
public long getHeaderLastPosition() throws EnrgiseApplicationException {
|
|
int iSlot = getSlot();
|
|
return (iSlot * this.maxHeaderSize < this.totalCount) ? (iSlot * this.maxHeaderSize) : this.totalCount;
|
|
}
|
|
|
|
public int getSlot() throws EnrgiseApplicationException {
|
|
if (this.positionRequested < 0L || this.positionRequested > this.totalCount)
|
|
throw new EnrgiseApplicationException("wenrgise.common.navigation", "E");
|
|
return ((int)(this.positionRequested % this.maxHeaderSize) != 0) ? (int)((int)this.positionRequested / this.maxHeaderSize + 1L) : (int)(this.positionRequested / this.maxHeaderSize);
|
|
}
|
|
|
|
public void setOHeaderVOTable(ArrayList newOHeaderVOTable) {
|
|
this.oHeaderVOTable = newOHeaderVOTable;
|
|
}
|
|
|
|
public BaseHeaderBean getHeaderRecord(int iPosition) throws EnrgiseApplicationException {
|
|
if (this.oHeaderVOTable == null)
|
|
throw new EnrgiseApplicationException("wenrgise.common.norecordfound", "M");
|
|
if (this.oHeaderVOTable.size() == 0 || this.oHeaderVOTable.size() < iPosition)
|
|
throw new EnrgiseApplicationException("wenrgise.common.norecordfound", "M");
|
|
return this.oHeaderVOTable.get(iPosition - 1);
|
|
}
|
|
|
|
public long getPositionRequested() {
|
|
return this.positionRequested;
|
|
}
|
|
|
|
public void setPositionRequested(long newPositionRequested) {
|
|
this.positionRequested = newPositionRequested;
|
|
}
|
|
|
|
public long getCurrentSlot() {
|
|
return this.currentSlot;
|
|
}
|
|
|
|
public void setCurrentSlot(long newCurrentSlot) {
|
|
this.currentSlot = newCurrentSlot;
|
|
}
|
|
|
|
public long getTotalCount() {
|
|
return this.totalCount;
|
|
}
|
|
|
|
public void setTotalCount(long newTotalCount) {
|
|
this.totalCount = newTotalCount;
|
|
}
|
|
|
|
public long getMaxHeaderSize() {
|
|
return this.maxHeaderSize;
|
|
}
|
|
|
|
public void setMaxHeaderSize(long newMaxHeaderSize) {
|
|
this.maxHeaderSize = newMaxHeaderSize;
|
|
}
|
|
}
|