📄 section.java
字号:
package com.blue.web.common.model;
import java.util.Date;
import com.blue.web.common.util.SerializableMap;
import com.blue.web.common.util.SerializeData;
import com.blue.web.common.util.StringUtils;
/**
*
* @author Lucifer
*
* A Section is the base container for a item of catalogs / resources.
*/
public class Section implements Comparable {
private int indexId = 0; // Unique section identifier
private int parentId = 0;
private int sortOrder = 0; // Used to control sorting of item
private boolean isActive = true; // Is the item isActive?
private boolean isSearchable = false;
private String searchKey = null;
private Date dateCreated;
private Date lastUpdate;
private SerializableMap properties;
public Section() {
this.properties = new SerializableMap();
}
public Section(int sectionId) {
this.indexId = sectionId;
this.properties = new SerializableMap();
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public int getIndexId() {
return indexId;
}
public void setIndexId(int indexId) {
this.indexId = indexId;
}
public boolean isActive() {
return isActive;
}
public void setActive(boolean isActive) {
this.isActive = isActive;
}
public boolean isSearchable() {
return isSearchable;
}
public void setSearchable(boolean isSearchable) {
this.isSearchable = isSearchable;
}
public Date getLastUpdate() {
return lastUpdate;
}
public void setLastUpdate(Date lastUpdate) {
this.lastUpdate = lastUpdate;
}
public int getParentId() {
return parentId;
}
public void setParentId(int parentId) {
this.parentId = parentId;
}
public String getSearchKey() {
return searchKey;
}
public void setSearchKey(String searchKey) {
this.searchKey = searchKey;
}
public int getSortOrder() {
return sortOrder;
}
public void setSortOrder(int sortOrder) {
this.sortOrder = sortOrder;
}
public Object getProperty(String key) {
return this.properties.get(key);
}
public void setProperty(String key, String value) {
this.properties.put(key, value);
}
// Convert helpers
protected boolean getBoolean(String key, boolean defaultValue) {
String value = (String) this.properties.get(key);
if (value == null || value.trim().length() == 0)
return defaultValue;
return StringUtils.getBoolean(value, defaultValue);
}
protected void setBoolean(String key, boolean value) {
if (key != null && key.trim().length() > 0) {
this.properties.put(key, StringUtils.toString(value));
}
}
protected int getInt(String key, int defaultValue) {
String value = (String) this.properties.get(key);
if (value == null || value.trim().length() == 0)
return defaultValue;
return StringUtils.getInt(value, defaultValue);
}
protected void setInt(String key, int value) {
if (key != null && key.trim().length() > 0) {
this.properties.put(key, Integer.toString(value));
}
}
protected String getString(String key, String defaultValue) {
String value = (String) this.properties.get(key);
return value != null ? value : defaultValue;
}
protected void setString(String key, String value) {
if (key != null && key.trim().length() > 0 && value != null) {
this.properties.put(key, value);
}
}
// serialize / deserialize
public void serialize(SerializeData data) {
this.properties.serialize(data);
}
public SerializeData deserialize() {
return this.properties.deserialize();
}
// Comparable members
/**
* Compares this Section object to another object.
*/
public int compareTo(Object o) {
if (o == null)
return 1;
if (o instanceof Section) {
int thisOrder = this.sortOrder;
int anotherOrder = ((Section)o).sortOrder;
return (thisOrder < anotherOrder ? -1 : (thisOrder == anotherOrder ? 0 : 1));
}
return 1;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -