You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

197 lines
5.3 KiB
Java

3 years ago
package cokr.xit.foundation.component;
2 weeks ago
import cokr.xit.foundation.AbstractObject;
3 years ago
/** .<br />
* (4 ) .<br />
* .
* @author mjkhan
*/
2 weeks ago
public abstract class ServiceRequest extends AbstractObject {
private String
type,
by,
term,
orderBy;
private int pageNum;
private int fetchSize;
private boolean
fetchAll,
includeAll;
private String download;
3 years ago
/** . .
* @return
*/
public String getType() {
3 years ago
return ifEmpty(type, "");
}
/** . .
* @param type
* @return
*/
public <T extends ServiceRequest> T setType(String type) {
3 years ago
this.type = type;
return self();
}
/** .
* @return
*/
public String getBy() {
return ifEmpty(by, () -> null);
}
/** .
* @param by
* @return
*/
public <T extends ServiceRequest> T setBy(String by) {
this.by = by;
return self();
}
/** .
* @return
*/
public String getTerm() {
return ifEmpty(term, () -> null);
}
/** .
* @param term
* @return
*/
public <T extends ServiceRequest> T setTerm(String term) {
this.term = term;
return self();
}
/** .
* @return
*/
public String getOrderBy() {
return orderBy;
}
/** .
* @param orderBy
* @return
*/
public <T extends ServiceRequest> T setOrderBy(String orderBy) {
this.orderBy = orderBy;
return self();
}
/** .
* @return dataStart
*/
public int getPageNum() {
return Math.max(pageNum, 1);
// return isEmpty(download) ? pageNum : 0;
}
/** .
* @param pageNum
* @return
*/
public <T extends ServiceRequest> T setPageNum(int pageNum) {
this.pageNum = pageNum;
return self();
}
/** .
* @return fetchSize
*/
public int getFetchSize() {
return fetchSize;
}
/** .
* @param fetchSize
* @return
*/
public <T extends ServiceRequest> T setFetchSize(int fetchSize) {
this.fetchSize = fetchSize;
return self();
}
/** .
* @return fetchAll
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean fetchAll() {
return fetchAll;
}
/** .
* @param fetchAll
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public <T extends ServiceRequest> T setFetchAll(boolean fetchAll) {
this.fetchAll = fetchAll;
return self();
}
/** .
* @return includeAll
*/
public boolean isIncludeAll() {
return includeAll;
}
/** .
* @param includeAll
*/
public <T extends ServiceRequest> T setIncludeAll(boolean includeAll) {
this.includeAll = includeAll;
return self();
}
/** .
* @return download
* <ul><li> - "xls"</li>
* <li> </li>
* </ul>
*/
public String getDownload() {
return download;
}
/** .
* @param download
* <ul><li> - "xls"</li>
* <li> </li>
* </ul>
* @return
*/
public <T extends ServiceRequest> T setDownload(String download) {
this.download = download;
return self();
}
3 years ago
/** .<br />
* RuntimeException .
*/
public void validate() {}
/** .
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean isValid() {
try {
validate();
return true;
} catch (Exception e) {
return false;
}
}
3 years ago
}