Skip to content

Commit

Permalink
Ending the mapping of News class and sub-classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Treydone committed Oct 5, 2011
1 parent bd9bf7e commit a748387
Show file tree
Hide file tree
Showing 10 changed files with 344 additions and 110 deletions.
44 changes: 39 additions & 5 deletions src/main/java/org/springframework/social/viadeo/api/Comment.java
Expand Up @@ -34,14 +34,20 @@ public class Comment implements Serializable{

private final ViadeoProfile from;

private final Date createdDate;
private final Date createdTime;

private Date updatedTime;

private String privacy;

private String type;

public Comment(String id, String message, ViadeoProfile from,
Date createdDate) {
Date createdTime) {
this.id = id;
this.message = message;
this.from = from;
this.createdDate = createdDate;
this.createdTime = createdTime;
}

public String getId() {
Expand All @@ -56,8 +62,36 @@ public ViadeoProfile getFrom() {
return from;
}

public Date getCreatedDate() {
return createdDate;
public Date getCreatedTime() {
return createdTime;
}

public Date getUpdatedTime() {
return updatedTime;
}

public String getPrivacy() {
return privacy;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public static long getSerialversionuid() {
return serialVersionUID;
}

public void setUpdatedTime(Date updatedTime) {
this.updatedTime = updatedTime;
}

public void setPrivacy(String privacy) {
this.privacy = privacy;
}

}
52 changes: 42 additions & 10 deletions src/main/java/org/springframework/social/viadeo/api/News.java
Expand Up @@ -19,6 +19,7 @@
import java.util.Date;

import org.springframework.social.viadeo.api.impl.Comments;
import org.springframework.social.viadeo.api.impl.Likes;

/**
* Model class representing an entry in a feed.
Expand All @@ -36,21 +37,27 @@ public class News implements Serializable {

private final ViadeoProfile from;

private final Date creationDate;
private final Date createdTime;

private final Date updatedDate;
private final Date updatedTime;

private String label;

private Comments comments;


private Likes likes;

private String infeedLink;

private String type;

public News(String id, String message, ViadeoProfile from,
Date creationDate, Date updatedDate) {
Date createdTime, Date updatedTime) {
this.id = id;
this.message = message;
this.from = from;
this.creationDate = creationDate;
this.updatedDate = updatedDate;
this.createdTime = createdTime;
this.updatedTime = updatedTime;
}

public String getId() {
Expand All @@ -65,12 +72,12 @@ public ViadeoProfile getFrom() {
return from;
}

public Date getCreationDate() {
return creationDate;
public Date getCreatedTime() {
return createdTime;
}

public Date getUpdatedDate() {
return updatedDate;
public Date getUpdatedTime() {
return updatedTime;
}

public String getLabel() {
Expand All @@ -88,4 +95,29 @@ public Comments getComments() {
public void setComments(Comments comments) {
this.comments = comments;
}

public String getInfeedLink() {
return infeedLink;
}

public void setInfeedLink(String infeedLink) {
this.infeedLink = infeedLink;
}

public Likes getLikes() {
return likes;
}

public void setLikes(Likes likes) {
this.likes = likes;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

}
Expand Up @@ -53,15 +53,15 @@ public interface UserOperations {
List<ViadeoProfile> getContacts(String userId);

/**
* Retrieve a members newsfeed i.e. a list of updates from a members
* Retrieve a member's newsfeed i.e. a list of updates from a member's
* professional contacts for the authenticated user.
*
* @return
*/
List<News> getNewsFeed();

/**
* Retrieve a members newsfeed i.e. a list of updates from a members
* Retrieve a member's newsfeed i.e. a list of updates from a member's
* professional contacts for a given user.
*
* @param userId
Expand All @@ -70,15 +70,15 @@ public interface UserOperations {
List<News> getNewsFeed(String userId);

/**
* Retrieve a list of a members newsfeed updates for the authenticated
* Retrieve a list of a member's newsfeed updates for the authenticated
* user.
*
* @return
*/
List<News> getUserFeed();

/**
* Retrieve a list of a members newsfeed updates for a given user.
* Retrieve a list of a member's newsfeed updates for a given user.
*
* @param userId
* @return
Expand Down
Expand Up @@ -29,6 +29,8 @@ public class Comments implements Serializable{
private static final long serialVersionUID = -8748950763266683264L;

private final List<Comment> comments;

private int count;

public Comments(List<Comment> comments) {
this.comments = comments;
Expand All @@ -38,4 +40,12 @@ public List<Comment> getComments() {
return comments;
}

public int getCount() {
return count;
}

public void setCount(int count) {
this.count = count;
}

}
@@ -1,18 +1,18 @@
/*
* Copyright 2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright 2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.social.viadeo.api.impl.json;

import java.util.Date;
Expand All @@ -25,11 +25,22 @@
/**
* Annotated mixin to add Jackson annotations to Comment.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonIgnoreProperties({ "link", "name" })
abstract class CommentMixin {

@JsonCreator
CommentMixin(@JsonProperty("id") String id, @JsonProperty("message")String message, @JsonProperty("from")ViadeoProfile from,
@JsonProperty("data")Date created_time) {
CommentMixin(@JsonProperty("id") String id,
@JsonProperty("message") String message,
@JsonProperty("from") ViadeoProfile from,
@JsonProperty("created_time") Date createdTime) {
}

@JsonProperty("type")
String type;

@JsonProperty("privacy")
String privacy;

@JsonProperty("updated_time")
Date updatedTime;
}
Expand Up @@ -18,17 +18,18 @@
import java.util.List;

import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
import org.springframework.social.viadeo.api.Comment;

/**
* Annotated mixin to add Jackson annotations to Comments.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
abstract class CommentsMixin {

@JsonCreator
CommentsMixin(@JsonProperty("data") List<Comment> comments) {
}

@JsonProperty("count")
int count;
}
Expand Up @@ -26,7 +26,7 @@
/**
* Annotated mixin to add Jackson annotations to News.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonIgnoreProperties({ "name", "link" })
abstract class NewsMixin {

@JsonCreator
Expand All @@ -42,5 +42,11 @@ abstract class NewsMixin {

@JsonProperty("label")
String label;

@JsonProperty("infeed_link")
String infeedLink;

@JsonProperty("type")
String type;

}
Expand Up @@ -24,6 +24,7 @@
import org.springframework.social.viadeo.api.Group;
import org.springframework.social.viadeo.api.InboxMessage;
import org.springframework.social.viadeo.api.Job;
import org.springframework.social.viadeo.api.Like;
import org.springframework.social.viadeo.api.Location;
import org.springframework.social.viadeo.api.News;
import org.springframework.social.viadeo.api.Phone;
Expand All @@ -34,6 +35,7 @@
import org.springframework.social.viadeo.api.impl.GroupsResult;
import org.springframework.social.viadeo.api.impl.InboxMessagesResult;
import org.springframework.social.viadeo.api.impl.JobsResult;
import org.springframework.social.viadeo.api.impl.Likes;
import org.springframework.social.viadeo.api.impl.VisitCards;

/**
Expand All @@ -60,6 +62,8 @@ public void setupModule(SetupContext context) {
context.setMixInAnnotations(Career.class, CareerMixin.class);
context.setMixInAnnotations(Comment.class, CommentMixin.class);
context.setMixInAnnotations(Comments.class, CommentsMixin.class);
context.setMixInAnnotations(Like.class, LikeMixin.class);
context.setMixInAnnotations(Likes.class, LikesMixin.class);
context.setMixInAnnotations(Job.class, JobMixin.class);
context.setMixInAnnotations(JobsResult.class, JobsResultMixin.class);
context.setMixInAnnotations(Phone.class, PhoneMixin.class);
Expand Down

0 comments on commit a748387

Please sign in to comment.