package net.sourceforge.fenixedu.dataTransferObject.person; import java.io.Serializable; import net.sourceforge.fenixedu.domain.DomainReference; import net.sourceforge.fenixedu.domain.MacAddress; import net.sourceforge.fenixedu.domain.Person; import pt.iscte.ci.metadata.ISCTE; @ISCTE(author = "Paulo Zenida") public class MacAddressRegistryBean implements Serializable { private static final long serialVersionUID = 1L; private DomainReference macAddress; private DomainReference person; private String address; private boolean isActive = true; public MacAddressRegistryBean(final Person person) { setPerson(person); } public MacAddressRegistryBean(final MacAddress macAddress) { this(macAddress.getPerson()); setMacAddress(macAddress); setAddress(macAddress.getAddress()); setIsActive(macAddress.getIsActive()); } public MacAddress getMacAddress() { return macAddress == null ? null : macAddress.getObject(); } public void setMacAddress(final MacAddress macAddress) { this.macAddress = macAddress == null ? null : new DomainReference(macAddress); } public Person getPerson() { return person == null ? null : person.getObject(); } public void setPerson(final Person person) { this.person = (person == null ? null : new DomainReference(person)); } /** * @return the address */ public String getAddress() { return address; } /** * @param address * the address to set */ public void setAddress(String address) { if (address != null) { address = address.trim(); } this.address = (address != null && address.contains("-")) ? address.trim().replace("-", ":") : address; } /** * @return the isActive */ public Boolean getIsActive() { return isActive; } /** * @param isActive * the isActive to set */ public void setIsActive(Boolean isActive) { this.isActive = isActive; } }