/*******************************************************************************
* Copyright (c) 2012-2015 Codenvy, S.A.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.api.user.server.dao;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* @author Eugene Voevodin
*/
public class Profile {
private String id;
private String userId;
private Map<String, String> attributes;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Profile withId(String id) {
this.id = id;
return this;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public Profile withUserId(String userId) {
this.userId = userId;
return this;
}
public Map<String, String> getAttributes() {
if (attributes == null) {
attributes = new HashMap<>();
}
return attributes;
}
public void setAttributes(Map<String, String> attributes) {
this.attributes = attributes;
}
public Profile withAttributes(Map<String, String> attributes) {
this.attributes = attributes;
return this;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Profile)) {
return false;
}
final Profile other = (Profile)obj;
return Objects.equals(id, other.id) &&
Objects.equals(userId, other.userId) &&
Objects.equals(getAttributes(), other.getAttributes());
}
@Override
public int hashCode() {
int hash = 7;
hash = 31 * hash + Objects.hashCode(id);
hash = 31 * hash + Objects.hashCode(userId);
hash = 31 * hash + Objects.hashCode(attributes);
return hash;
}
}