/** * This file is part of OCPsoft SocialPM: Agile Project Management Tools (SocialPM) * * Copyright (c)2011 Lincoln Baxter, III <lincoln@ocpsoft.com> (OCPsoft) * Copyright (c)2011 OCPsoft.com (http://ocpsoft.com) * * If you are developing and distributing open source applications under * the GNU General Public License (GPL), then you are free to re-distribute SocialPM * under the terms of the GPL, as follows: * * SocialPM is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SocialPM is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SocialPM. If not, see <http://www.gnu.org/licenses/>. * * For individuals or entities who wish to use SocialPM privately, or * internally, the following terms do not apply: * * For OEMs, ISVs, and VARs who wish to distribute SocialPM with their * products, or host their product online, OCPsoft provides flexible * OEM commercial licenses. * * Optionally, Customers may choose a Commercial License. For additional * details, contact an OCPsoft representative (sales@ocpsoft.com) */ package com.ocpsoft.socialpm.model.feed; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToOne; import org.jboss.errai.common.client.api.annotations.Portable; import com.ocpsoft.socialpm.model.user.Profile; @Portable @Entity @DiscriminatorValue("USER_EVENT") @NamedQueries({ @NamedQuery(name = "feedEvent.byUser", query = "from FeedEvent where user = :user order by createdOn desc") }) public class UserEvent extends FeedEvent { private static final long serialVersionUID = 7038341222060982180L; @OneToOne private Profile user; public UserEvent(final Profile user) { this.user = user; } public UserEvent() { } public Profile getUser() { return user; } public void setUser(final Profile user) { this.user = user; } @Override public String toString() { return "" + user; } @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = (prime * result) + ((user == null) ? 0 : user.hashCode()); return result; } @Override public boolean equals(final Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; UserEvent other = (UserEvent) obj; if (user == null) { if (other.user != null) return false; } else if (!user.equals(other.user)) return false; return true; } }