Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

us enrichissement profile #560

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 92 additions & 4 deletions src/main/java/fr/ippon/tatami/domain/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.validation.groups.Default;
import java.io.Serializable;
import java.util.Date;

/**
* A user.
Expand Down Expand Up @@ -60,6 +58,34 @@ public class User implements Serializable {
@Column(name = "phoneNumber")
private String phoneNumber;

@Size(min = 0, max = 250)
@Column(name = "viadeo")
private String viadeo;

@Size(min = 0, max = 250)
@Column(name = "linkedIn")
private String linkedIn;

@Size(min = 0, max = 250)
@Column(name = "skype")
private String skype;

@Size(min = 0, max = 250)
@Column(name = "twitter")
private String twitter;

@Size(min = 0, max = 250)
@Column(name = "googlePlus")
private String googlePlus;

@Size(min = 0, max = 250)
@Column(name = "facebook")
private String facebook;

@Column(name = "hireDate")
@Temporal(TemporalType.DATE)
private Date hireDate;

@Column(name = "openIdUrl")
@JsonIgnore
private String openIdUrl;
Expand Down Expand Up @@ -233,6 +259,61 @@ public void setDailyDigestSubscription(Boolean dailyDigestSubscription) {
this.dailyDigestSubscription = dailyDigestSubscription;
}

public String getViadeo() {
return viadeo;
}

public void setViadeo(String viadeo) {
this.viadeo = viadeo;
}

public String getLinkedIn() {
return linkedIn;
}

public void setLinkedIn(String linkedIn) {
this.linkedIn = linkedIn;
}

public String getSkype() {
return skype;
}

public void setSkype(String skype) {
this.skype = skype;
}

public String getTwitter() {
return twitter;
}

public void setTwitter(String twitter) {
this.twitter = twitter;
}

public String getGooglePlus() {
return googlePlus;
}

public void setGooglePlus(String googlePlus) {
this.googlePlus = googlePlus;
}

public String getFacebook() {
return facebook;
}

public void setFacebook(String facebook) {
this.facebook = facebook;
}

public Date getHireDate() {
return hireDate;
}

public void setHireDate(Date hireDate) {
this.hireDate = hireDate;
}

@Override
public boolean equals(Object o) {
Expand Down Expand Up @@ -262,6 +343,13 @@ public String toString() {
", lastName='" + lastName + '\'' +
", jobTitle='" + jobTitle + '\'' +
", phoneNumber='" + phoneNumber + '\'' +
", skype='" + skype + '\'' +
", viadeo='" + viadeo + '\'' +
", facebook='" + facebook + '\'' +
", linkedIn='" + linkedIn + '\'' +
", googlePlus='" + googlePlus + '\'' +
", twitter='" + twitter + '\'' +
", hireDate='" + hireDate + '\'' +
", openIdUrl='" + openIdUrl + '\'' +
", preferencesMentionEmail=" + preferencesMentionEmail +
", rssUid=" + rssUid +
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/fr/ippon/tatami/service/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,13 @@ private UserDTO getUserDTOFromUser(User user) {
friend.setLastName(user.getLastName());
friend.setJobTitle(user.getJobTitle());
friend.setPhoneNumber(user.getPhoneNumber());
friend.setTwitter(user.getTwitter());
friend.setFacebook(user.getFacebook());
friend.setGooglePlus(user.getGooglePlus());
friend.setViadeo(user.getViadeo());
friend.setLinkedIn(user.getLinkedIn());
friend.setSkype(user.getSkype());
friend.setHireDate(user.getHireDate());
friend.setAttachmentsSize(user.getAttachmentsSize());
friend.setStatusCount(user.getStatusCount());
friend.setFriendsCount(user.getFriendsCount());
Expand Down
78 changes: 78 additions & 0 deletions src/main/java/fr/ippon/tatami/service/dto/UserDTO.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package fr.ippon.tatami.service.dto;

import java.io.Serializable;
import java.util.Date;

/**
* DTO to present a "complete" status to the presentation layer.
Expand All @@ -21,6 +22,20 @@ public class UserDTO implements Serializable {

private String phoneNumber;

private String viadeo;

private String linkedIn;

private String skype;

private String twitter;

private String googlePlus;

private String facebook;

private Date hireDate;

private long attachmentsSize;

private long statusCount;
Expand Down Expand Up @@ -139,6 +154,62 @@ public void setYou(boolean you) {
isYou = you;
}

public String getViadeo() {
return viadeo;
}

public void setViadeo(String viadeo) {
this.viadeo = viadeo;
}

public String getLinkedIn() {
return linkedIn;
}

public void setLinkedIn(String linkedIn) {
this.linkedIn = linkedIn;
}

public String getSkype() {
return skype;
}

public void setSkype(String skype) {
this.skype = skype;
}

public String getTwitter() {
return twitter;
}

public void setTwitter(String twitter) {
this.twitter = twitter;
}

public String getGooglePlus() {
return googlePlus;
}

public void setGooglePlus(String googlePlus) {
this.googlePlus = googlePlus;
}

public String getFacebook() {
return facebook;
}

public void setFacebook(String facebook) {
this.facebook = facebook;
}

public Date getHireDate() {
return hireDate;
}

public void setHireDate(Date hireDate) {
this.hireDate = hireDate;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand All @@ -165,6 +236,13 @@ public String toString() {
", lastName=" + lastName + '\'' +
", jobTitle='" + jobTitle + '\'' +
", phoneNumber='" + phoneNumber + '\'' +
", skype='" + skype + '\'' +
", viadeo='" + viadeo + '\'' +
", facebook='" + facebook + '\'' +
", linkedIn='" + linkedIn + '\'' +
", googlePlus='" + googlePlus + '\'' +
", twitter='" + twitter + '\'' +
", hireDate='" + hireDate + '\'' +
", attachmentsSize=" + attachmentsSize +
", statusCount=" + statusCount +
", friendsCount=" + friendsCount +
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/fr/ippon/tatami/web/rest/AccountController.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ public User updateUserProfile(@RequestBody User updatedUser, HttpServletResponse
currentUser.setLastName(updatedUser.getLastName().replace("<", " "));
currentUser.setJobTitle(StringEscapeUtils.escapeHtml(updatedUser.getJobTitle().replace("<", " ")));
currentUser.setPhoneNumber(updatedUser.getPhoneNumber().replace("<", " "));
currentUser.setTwitter(updatedUser.getTwitter().replace("<", " "));
currentUser.setFacebook(updatedUser.getFacebook().replace("<", " "));
currentUser.setGooglePlus(updatedUser.getGooglePlus().replace("<", " "));
currentUser.setViadeo(updatedUser.getViadeo().replace("<", " "));
currentUser.setLinkedIn(updatedUser.getLinkedIn().replace("<", " "));
currentUser.setSkype(updatedUser.getSkype().replace("<", " "));
currentUser.setHireDate(updatedUser.getHireDate());
try {
userService.updateUser(currentUser);
} catch (ConstraintViolationException cve) {
Expand Down
8 changes: 8 additions & 0 deletions src/main/webapp/WEB-INF/messages/messages_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ tatami.user.firstName=Prénom
tatami.user.lastName=Nom
tatami.user.jobTitle=Fonction
tatami.user.phoneNumber=Numéro de téléphone
tatami.user.socialNetworks=Réseaux sociaux
tatami.user.facebook=Url du profil Facebook
tatami.user.linkedIn=Url du profil LinkedIn
tatami.user.viadeo=Url du profil Viadeo
tatami.user.skype=Url du profil Skype
tatami.user.twitter=Url du profil Twitter
tatami.user.googlePlus=Url du profil Google+
tatami.user.hireDate=Date d'embauche
tatami.user.follow=Suivre
tatami.user.followed=Abonné
tatami.user.follows.you=vous suit
Expand Down
77 changes: 77 additions & 0 deletions src/main/webapp/WEB-INF/pages/includes/templates-admin.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@
</div>
</div>

<div class="control-group">
<label class="control-label" for="hireDate">
<fmt:message key="tatami.user.hireDate"/>
</label>

<div class="controls">
<input name="hireDate" type="date" size="10" maxlength="10" class="input-xlarge col-span-12" value="<@= new Date(user.hireDate).toISOString().substring(0,10) @>"/>
</div>
</div>

<div class="control-group">
<label class="control-label" for="phoneNumber">
<fmt:message key="tatami.user.phoneNumber"/>
Expand All @@ -109,6 +119,73 @@
</div>
</div>

<div class="control-group">
<label class="control-label" for="facebook">
<fmt:message key="tatami.user.facebook"/>
</label>

<div class="controls">
<input type="text" disabled="true" class="col-span-12 socialPrefix" value="https://www.facebook.com/"/>
<input name="facebook" type="text" size="10" maxlength="250" value="<@= user.facebook @>" class="socialSuffix"/>
</div>
</div>

<div class="control-group">
<label class="control-label" for="linkedIn">
<fmt:message key="tatami.user.linkedIn"/>
</label>

<div class="controls">
<input type="text" disabled="true" class="col-span-12 socialPrefix" value="http://www.linkedin.com/"/>
<input name="linkedIn" type="text" size="10" maxlength="250" value="<@= user.linkedIn @>" class="socialSuffix"/>
</div>
</div>

<div class="control-group">
<label class="control-label" for="viadeo">
<fmt:message key="tatami.user.viadeo"/>
</label>

<div class="controls">
<input type="text" disabled="true" class="col-span-12 socialPrefix" value="http://www.viadeo.com/"/>
<input name="viadeo" type="text" size="10" maxlength="250" value="<@= user.viadeo @>" class="socialSuffix"/>
</div>
</div>
<%--
<div class="control-group">
<label class="control-label" for="skype">
<fmt:message key="tatami.user.skype"/>
</label>

<div class="controls">
<input type="text" disabled="true" class="col-span-12 socialPrefix" value="http://www.skype.com/"/>
<input name="skype" type="text" size="10" maxlength="250" value="<@= user.skype @>" class="socialSuffix"/>
</div>
</div>
--%>

<div class="control-group">
<label class="control-label" for="twitter">
<fmt:message key="tatami.user.twitter"/>
</label>

<div class="controls">
<input type="text" disabled="true" class="col-span-12 socialPrefix" value="https://twitter.com/"/>
<input name="twitter" type="text" size="10" maxlength="250" value="<@= user.twitter @>" class="socialSuffix"/>
</div>
</div>

<div class="control-group">
<label class="control-label" for="googlePlus">
<fmt:message key="tatami.user.googlePlus"/>
</label>

<div class="controls">
<input type="text" disabled="true" class="col-span-12 socialPrefix" value="https://plus.google.com/"/>
<input name="googlePlus" type="text" size="10" maxlength="250" value="<@= user.googlePlus @>" class="socialSuffix"/>
</div>
</div>

<div class="form-actions">
<button type="submit" class="input-xlarge btn btn-primary btn-block">
<fmt:message key="tatami.form.save"/>
Expand Down
Loading