account.java

来自「Struts+Spring开发」· Java 代码 · 共 180 行

JAVA
180
字号
package org.ssi.biz.bo;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.ssi.dto.AccountDTO;

public class Account {

	/* Private Fields */

	private String userID;

	private String email;

	private String firstName;

	private String lastName;

	private String status;

	private String address1;

	private String address2;

	private String city;

	private String state;

	private String zip;

	private String country;

	private String phone;

	public String getAddress1() {
		return address1;
	}

	public void setAddress1(String address1) {
		this.address1 = address1;
	}

	public String getAddress2() {
		return address2;
	}

	public void setAddress2(String address2) {
		this.address2 = address2;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getUserID() {
		return userID;
	}

	public void setUserID(String userID) {
		this.userID = userID;
	}

	public String getZip() {
		return zip;
	}

	public void setZip(String zip) {
		this.zip = zip;
	}
	
	public void createUserID(){
		SimpleDateFormat d=new SimpleDateFormat("yyyyMMdd");
		this.userID="p_"+d.format(new Date())+"_"+Math.round((Math.random()*1000));
	}

	public void importDTO(AccountDTO accountDTO) {
		this.userID = accountDTO.getUserID();
		this.email = accountDTO.getEmail();
		this.firstName = accountDTO.getFirstName();
		this.lastName = accountDTO.getLastName();
		this.status = accountDTO.getStatus();
		this.address1 = accountDTO.getAddress1();
		this.address2 = accountDTO.getAddress2();
		this.city = accountDTO.getCity();
		this.state = accountDTO.getState();
		this.zip = accountDTO.getZip();
		this.country = accountDTO.getCountry();
		this.phone = accountDTO.getPhone();
	}

	public AccountDTO exportDTO() {
		AccountDTO accountDTO = new AccountDTO();
		accountDTO.setUserID(this.userID);
		accountDTO.setEmail(this.email);
		accountDTO.setFirstName(this.firstName);
		accountDTO.setLastName(this.lastName);
		accountDTO.setState(this.state);
		accountDTO.setStatus(this.status);
		accountDTO.setAddress1(this.address1);
		accountDTO.setAddress2(this.address2);
		accountDTO.setCity(this.city);
		accountDTO.setZip(this.zip);
		accountDTO.setCountry(this.country);
		accountDTO.setPhone(this.phone);
		return accountDTO;
	}

	public String toString() {
		return "Account:" + "userID--" + this.userID + ";" + "email--"
				+ this.email + ";" + "firstName--" + this.firstName + ";"
				+ "lastName--" + this.lastName + ";" + "status--" + this.status
				+ ";" + "address1--" + this.address1 + ";" + "address2--"
				+ this.address2 + ";" + "city--" + this.city + ";" + "state--"
				+ this.state + ";" + "zip--" + this.zip + ";" + "country--"
				+ this.country + ";" + "phone--" + this.phone + ";";
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?