/** * Copyright (c) 2009--2014 Red Hat, Inc. * * This software is licensed to you under the GNU General Public License, * version 2 (GPLv2). There is NO WARRANTY for this software, express or * implied, including the implied warranties of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 * along with this software; if not, see * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. * * Red Hat trademarks are not licensed under GPLv2. No permission is * granted to use or replicate Red Hat trademarks that are incorporated * in this software or its documentation. */ package com.redhat.rhn.domain.server; import com.redhat.rhn.common.util.StringUtil; import com.redhat.rhn.domain.action.server.ServerAction; import com.redhat.rhn.domain.org.CustomDataKey; import com.redhat.rhn.domain.user.User; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import java.io.Serializable; import java.util.Date; /** * CustomDataValue * @version $Rev$ */ public class CustomDataValue implements Serializable { private static final long serialVersionUID = 1L; private Server server; private CustomDataKey key; private String value; private User creator; private User lastModifier; private Date created; private Date modified; /** * @return Returns the created. */ public Date getCreated() { return created; } /** * @param createdIn The created to set. */ public void setCreated(Date createdIn) { this.created = createdIn; } /** * @return Returns the creator. */ public User getCreator() { return creator; } /** * @param creatorIn The creator to set. */ public void setCreator(User creatorIn) { this.creator = creatorIn; } /** * @return Returns the key. */ public CustomDataKey getKey() { return key; } /** * @param keyIn The key to set. */ public void setKey(CustomDataKey keyIn) { this.key = keyIn; } /** * @return Returns the modified. */ public Date getModified() { return modified; } /** * @param modifiedIn The modified to set. */ public void setModified(Date modifiedIn) { this.modified = modifiedIn; } /** * @return Returns the lastModifier. */ public User getLastModifier() { return lastModifier; } /** * @param lastModifierIn The lastModifier to set. */ public void setLastModifier(User lastModifierIn) { this.lastModifier = lastModifierIn; } /** * @return Returns the server. */ public Server getServer() { return server; } /** * @param serverIn The server to set. */ public void setServer(Server serverIn) { this.server = serverIn; } /** * @return Returns the value. */ public String getValue() { return value; } /** * @param valueIn The value to set. */ public void setValue(String valueIn) { this.value = StringUtil.webToLinux(valueIn); } /** * {@inheritDoc} */ public boolean equals(final Object other) { if (other == null || !(other instanceof ServerAction)) { return false; } CustomDataValue castOther = (CustomDataValue) other; return new EqualsBuilder().append(key, castOther.getKey()) .append(server, castOther.getServer()).isEquals(); } /** * {@inheritDoc} */ public int hashCode() { return new HashCodeBuilder().append(key.getId()).append(server) .toHashCode(); } }