FieldTimeStamp.java 1.63 KB
Newer Older
Naung1 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
package com.csc.library.database;

import com.csc.library.utilities.CscCalendar;
public class FieldTimeStamp extends MyField {

		private String defaultValue=new CscCalendar().getTimestamp().toString();

	public FieldTimeStamp(String name) {
		super(name);
		this.setDefault(defaultValue);
		//    this.type = "Timestamp";
	}



	public FieldTimeStamp(String name, String description) {
		super(name, description);
		this.setDefault(defaultValue);
		//   this.type = "Timestamp";
	}

	public FieldTimeStamp(String name, int width, String description) {
		super(name, width, description);
		this.setDefault(defaultValue);
		//   this.type = "Timestamp";
	}

	public FieldTimeStamp(String name, int width, int decimal, String description) {
		super(name, width, decimal, description);
		this.setDefault(defaultValue);
		// this.type = "Timestamp";
	}

	public FieldTimeStamp(String name, Integer width, Integer decimal, String description) {
		this(name, width.intValue(), decimal.intValue(), description);

	}

	public String getCompareString() {
		//  	return this.getName()+"="+this.getValueString();
		return new GenCompareString().generate(this.getName(), this);
	}

	public String getValueString() {
		return new GenCompareString().generate(this);
	}

	public boolean set(CscCalendar d) {
		return this.set(d.getTimestamp());
	}

	public CscCalendar getcscCalendar() {
		CscCalendar d;
		d = new CscCalendar(this.getString());
		return d;
	}

	public String getFieldCreate() {
		return this.getName() + " TIMESTAMP";
	}
	public String getSaveString() {
		if(this.isEncrypt())
			return this.encryption();
		else	
			return  String.valueOf(this.getTimestamp());
	}	
}