Package com.casamind.adware.server.domain

Source Code of com.casamind.adware.server.domain.Company

package com.casamind.adware.server.domain;

import java.util.Date;

import com.casamind.adware.shared.model.CompanyDTO;
import com.casamind.adware.shared.model.CompanySummaryDTO;

public class Company extends UserAccount {
  private String street;
  private String city;
  private String mobile;
  private String fax;
  private String website;

  public Company() {
  }

  public Company(int accessLevel, String login, String service, String firstname, String lastname, String phone, String email, Date lastLoginOn, boolean isReceiveNewsLetter, boolean isReceiveNotifications, String street, String city, String mobile, String fax, String website, String gdataLogin, String gdataPassword) {
    super(accessLevel, login, service, firstname, lastname, phone, email, lastLoginOn, isReceiveNewsLetter, isReceiveNotifications, gdataLogin, gdataPassword);
    this.street = street;
    this.city = city;
    this.mobile = mobile;
    this.fax = fax;
    this.website = website;
  }

  public String getStreet() {
    return street;
  }

  public void setStreet(String street) {
    this.street = street;
  }

  public String getCity() {
    return city;
  }

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

  public String getMobile() {
    return mobile;
  }

  public void setMobile(String mobile) {
    this.mobile = mobile;
  }

  public String getFax() {
    return fax;
  }

  public void setFax(String fax) {
    this.fax = fax;
  }

  public String getWebsite() {
    return website;
  }

  public void setWebsite(String website) {
    this.website = website;
  }

  public String getBillingAddress() {
    return this.street + ", " + this.city;
  }

  public static Company toEntity(Company entity, CompanyDTO dto) {
    if (dto == null) {
      return null;
    }
    if (entity == null) {
      entity = new Company();
    }
    entity.setAccessLevel(dto.getAccessLevel());
    entity.setLogin(dto.getLogin());
    entity.setService(dto.getService());
    entity.setUniqueId(dto.getLogin() + "-" + dto.getService());
    entity.setCity(dto.getCity());
    entity.setEmail(dto.getEmail());
    entity.setFax(dto.getFax());
    entity.setMobile(dto.getMobile());
    entity.setLastname(dto.getLastname());
    entity.setFirstname(dto.getFirstname());
    entity.setPhone(dto.getPhone());
    entity.setStreet(dto.getStreet());
    entity.setWebsite(dto.getWebsite());
    entity.setReceiveNewsLetter(dto.isReceiveNewsLetter());
    entity.setReceiveNotifications(dto.isReceiveNotifications());
    entity.setBudget(dto.getBudget());
    return entity;
  }

  public static CompanyDTO toDTO(Company entity) {
    if (entity == null) {
      return null;
    }
    return new CompanyDTO(entity.getId(), entity.getUUID(), entity.getAccessLevel(), entity.getLogin(), entity.getService(), entity.getFirstname(), entity.getLastname(), entity.getPhone(), entity.getEmail(), entity.getLastLoginOn(), entity.isReceiveNewsLetter(), entity.isReceiveNotifications(), entity.getBudget(), entity.getStreet(), entity.getCity(), entity.getMobile(), entity.getFax(), entity.getWebsite());
  }

  public static CompanySummaryDTO toSummaryDTO(Company entity) {
    if (entity == null) {
      return null;
    }
    return new CompanySummaryDTO(entity.getId(), entity.getLastname());
  }
}
TOP

Related Classes of com.casamind.adware.server.domain.Company

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.