TeamInventory.java
package com.capitalone.dashboard.model;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.List;
@Document(collection="teamInventory")
public class TeamInventory extends BaseModel {
private ObjectId collectorId;
private ObjectId collectorItemId;
@Indexed
private String teamId;
private String name;
private String lob;
private List<TeamMember> teamMembers;
private long timestamp;
@Transient
private Collector collector;
public Collector getCollector() {
return collector;
}
public void setCollector(Collector collector) {
this.collector = collector;
}
public TeamInventory(String teamId, String name) {
this.teamId = (teamId != null ? teamId.trim() : "");
this.name = (name != null ? name.trim() : "");
}
public ObjectId getCollectorId() {
return collectorId;
}
public void setCollectorId(ObjectId collectorId) {
this.collectorId = collectorId;
}
public String getTeamId() {
return teamId;
}
public void setTeamId(String teamId) {
this.teamId = teamId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<TeamMember> getTeamMembers() {
return teamMembers;
}
public void setTeamMembers(List<TeamMember> teamMembers) {
this.teamMembers = teamMembers;
}
public String getLob() {
return lob;
}
public void setLob(String lob) {
this.lob = lob;
}
public ObjectId getCollectorItemId() {
return collectorItemId;
}
public void setCollectorItemId(ObjectId collectorItemId) {
this.collectorItemId = collectorItemId;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((teamId == null) ? 0 : teamId.hashCode());
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TeamInventory other = (TeamInventory) obj;
if (teamId == null) {
if (other.teamId != null)
return false;
} else if (!teamId.equals(other.teamId))
return false;
return true;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Team [teamId=" + teamId + ", name=" + name + "]";
}
}