📄 customertrackingtype.java
字号:
import java.util.*;
import org.jlf.log.*;
import org.jlf.dataMap.*;
/**
* This class holds the different types of CustomerTrackedRecording
* relationships in the system. One instance of this class
* corresponds to one row in the CUSTOMER_TRACKING_TYPE table.
*/
public class CustomerTrackingType extends CachedObject {
// --------------------------------------------------------------
// Section 1: DataMappedObject descriptors
// --------------------------------------------------------------
// Constants for attributes
public static final String ID_ATTRIBUTE = "TRACKING_TYPE_ID";
public static final String DESCRIPTION_ATTRIBUTE = "DESCRIPTION";
/**
* Sets up a table of attribute descriptors for the
* object.
*/
protected Hashtable basicGetAttributeDescriptors() {
// Always call the superclass!
Hashtable descriptors = super.basicGetAttributeDescriptors();
DataAttributeDescriptor descriptor;
// Then add recording-specific attributes
descriptor = new DataAttributeDescriptor(ID_ATTRIBUTE,
LongAttribute.class, true);
descriptor.setIsKeyField(true);
descriptors.put(ID_ATTRIBUTE, descriptor);
descriptor = new DataAttributeDescriptor(DESCRIPTION_ATTRIBUTE,
StringAttribute.class, false);
descriptor.setMaximumLength(50);
descriptors.put(DESCRIPTION_ATTRIBUTE, descriptor);
return descriptors;
}
/**
* Default constructor must be public for the data mapping
* framework! However, when creating a new object, look to use
* a paramterized constructor.
*/
public CustomerTrackingType() {}
// --------------------------------------------------------------
// Section 2: Java Bean methods
// --------------------------------------------------------------
/**
* Retrieves the database id of the object.
*/
public long getCustomerTrackingTypeId() {
return getLongAttribute(ID_ATTRIBUTE);
}
/**
* Retrieves the description of the type.
*/
public String getDescription() {
return getStringAttribute(DESCRIPTION_ATTRIBUTE);
}
// --------------------------------------------------------------
// Section 3: Convenience accessors for types
// --------------------------------------------------------------
public static final long CUSTOMER_PURCHASE_ID = 1;
/**
* This is a convenience accessor for tracking customer
* purchases of recordings.
*/
public static final CustomerTrackingType CUSTOMER_PURCHASE =
CustomerTrackingType.findById(CUSTOMER_PURCHASE_ID);
public static final long CUSTOMER_INTEREST_ID = 2;
/**
* This is a convenience accessor for tracking customer
* interests of recordings.
*/
public static final CustomerTrackingType CUSTOMER_INTEREST =
CustomerTrackingType.findById(CUSTOMER_INTEREST_ID);
/**
* Tries to find a CustomerTrackingType by its primary key, its id.
* Returns the CustomerTrackingType if found in the database, null if not.
*/
public static CustomerTrackingType findById(long id) {
CustomerTrackingType customerTrackingType = new CustomerTrackingType();
customerTrackingType.setAttributeValue(ID_ATTRIBUTE, new Long(id));
return (CustomerTrackingType) customerTrackingType.findByPrimaryKey();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -