-
Notifications
You must be signed in to change notification settings - Fork 26
Edits done for pTray #11
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 | ||
http://maven.apache.org/xsd/settings-1.0.0.xsd"> | ||
<localRepository>${user.home}/.m2/repository</localRepository> | ||
<interactiveMode>true</interactiveMode> | ||
<usePluginRegistry>false</usePluginRegistry> | ||
<offline>false</offline> | ||
</settings> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,16 @@ public class Conversation { | |
*/ | ||
private List<ProfileMini> participants; | ||
|
||
private int unreadCount; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The formatting is off here compared to the rest. You should also use spaces, not tabs. |
||
private String excerpt; | ||
@JsonProperty("unread_count") | ||
public int getUnreadCount() { | ||
return unreadCount; | ||
} | ||
public String getExcerpt() { | ||
return excerpt; | ||
} | ||
|
||
@JsonProperty("conversation_id") | ||
public int getId() { | ||
return id; | ||
|
@@ -32,6 +42,13 @@ public int getId() { | |
public void setId(int id) { | ||
this.id = id; | ||
} | ||
@JsonProperty("unread_count") | ||
public void setUnreadCount(int unreadCount) { | ||
this.unreadCount = unreadCount; | ||
} | ||
public void setExcerpt(String excerpt) { | ||
this.excerpt =excerpt; | ||
} | ||
|
||
public String getSubject() { | ||
return subject; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,6 +94,14 @@ public List<Conversation> getConversationsOnObject(Reference object) { | |
}); | ||
} | ||
|
||
|
||
public List<Conversation> getConversations() { | ||
WebResource resource = getResourceFactory().getApiResource( | ||
"/conversation/"); | ||
resource=resource.queryParam("limit","15"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This limit should at least be optional ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, you should add a parameter to the method of type Integer, and add it to the resource if it is != null. |
||
return resource.get(new GenericType<List<Conversation>>() {}); | ||
} | ||
|
||
/** | ||
* Creates a reply to the conversation. | ||
* | ||
|
@@ -110,4 +118,10 @@ public int addReply(int conversationId, String text) { | |
MediaType.APPLICATION_JSON_TYPE) | ||
.get(MessageCreateResponse.class).getMessageId(); | ||
} | ||
public void markRead(int conversationId) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should add a short javadoc and an extra line break to the method above. |
||
getResourceFactory() | ||
.getApiResource("/conversation/" + conversationId + "/read") | ||
.method("POST"); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you get rid of the license java doc? |
||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
|
||
package com.podio.notification; | ||
|
||
import java.util.List; | ||
import org.codehaus.jackson.annotate.JsonProperty; | ||
|
||
/** | ||
* | ||
* @author MrBr | ||
*/ | ||
public class Notification { | ||
private List<NotificationMini> nots; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should add line breaks between the methods and fields. |
||
private NotificationContext context; | ||
@JsonProperty("notifications") | ||
public List<NotificationMini> getNotifications(){ | ||
return this.nots; | ||
} | ||
public NotificationContext getContext(){ | ||
return this.context; | ||
} | ||
public void setContext(NotificationContext context){ | ||
this.context=context; | ||
} | ||
|
||
@JsonProperty("notifications") | ||
public void setNotifications(List<NotificationMini> nots){ | ||
this.nots=nots; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
|
||
package com.podio.notification; | ||
|
||
/** | ||
* | ||
* @author MrBr | ||
*/ | ||
public class NotificationContext { | ||
private String link; | ||
public String getLink(){ | ||
return this.link; | ||
} | ||
public void setLink(String link){ | ||
this.link=link; | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
|
||
package com.podio.notification; | ||
|
||
import com.podio.status.StatusQuestion; | ||
import org.codehaus.jackson.annotate.JsonProperty; | ||
|
||
/** | ||
* | ||
* @author MrBr | ||
*/ | ||
public class NotificationData { | ||
private String value; | ||
private String text; | ||
private String type; | ||
private StatusQuestion questionOption; | ||
public void setValue(String value){ | ||
this.value=value; | ||
} | ||
public String getValue(){ | ||
return this.value; | ||
} | ||
public void setText(String text){ | ||
this.text=text; | ||
} | ||
public String getText(){ | ||
return this.text; | ||
} | ||
public void setType(String type){ | ||
this.type=type; | ||
} | ||
public String getType(){ | ||
return this.type; | ||
} | ||
@JsonProperty("question_option") | ||
public void setQuestionOption(StatusQuestion questionOption){ | ||
this.questionOption=questionOption; | ||
} | ||
@JsonProperty("question_option") | ||
public StatusQuestion getQuestionOption(){ | ||
return this.questionOption; | ||
} | ||
public String getInfoText(){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure about this, it is useful to me for my app. |
||
if("like".equals(type)){ | ||
return "Liked"; | ||
}else if(value!=null){ | ||
return value; | ||
}else if(text!=null){ | ||
return text; | ||
}else if(questionOption!=null){ | ||
return questionOption.getText(); | ||
}else{ | ||
return null; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
|
||
package com.podio.notification; | ||
|
||
import org.codehaus.jackson.annotate.JsonProperty; | ||
|
||
/** | ||
* | ||
* @author MrBr | ||
*/ | ||
public class NotificationMini { | ||
private int id;//notification_id | ||
private String textShort; | ||
private String text; | ||
private NotificationData data; | ||
private String viewedOn; | ||
private Boolean starred; | ||
@JsonProperty("notification_id") | ||
public int getId(){ | ||
return this.id; | ||
} | ||
@JsonProperty("viewed_on") | ||
public String getViewedOn(){ | ||
return this.viewedOn; | ||
} | ||
public Boolean getStarred(){ | ||
return this.starred; | ||
} | ||
|
||
public String getText(){ | ||
return this.text; | ||
} | ||
public String getNotificationShortText(){ | ||
return textShort; | ||
} | ||
@JsonProperty("notification_id") | ||
public void setId(int id){ | ||
this.id=id; | ||
} | ||
@JsonProperty("viewed_on") | ||
public void setViewedOn(String viewedOn){ | ||
this.viewedOn=viewedOn; | ||
} | ||
public void setStarred(Boolean starred){ | ||
this.starred=starred; | ||
} | ||
|
||
public void setText(String text){ | ||
this.text=text; | ||
} | ||
@JsonProperty("text_short") | ||
public void setNotificationShortText(String TextShort){ | ||
textShort=TextShort; | ||
} | ||
public NotificationData getData(){ | ||
return this.data; | ||
} | ||
public void setData(NotificationData data){ | ||
this.data=data; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
|
||
package com.podio.notification; | ||
|
||
/** | ||
* | ||
* @author MrBr | ||
*/ | ||
public class NotificationRef { | ||
private int id; | ||
private String type; | ||
public void setValue(int id){ | ||
this.id=id; | ||
} | ||
public int getValue(){ | ||
return this.id; | ||
} | ||
public void setType(String type){ | ||
this.type=type; | ||
} | ||
public String getType(){ | ||
return this.type; | ||
} | ||
public String getInfoValue(){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure about this, was useful for my app. |
||
if("status".equals(type)){ | ||
return "Liked"; | ||
}else{ | ||
return "UNKNOW TYPE"; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More license stuff |
||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
|
||
package com.podio.status; | ||
|
||
/** | ||
* | ||
* @author MrBr | ||
*/ | ||
public class StatusQuestion { | ||
private String text; | ||
public void setText(String text){ | ||
this.text=text; | ||
} | ||
public String getText(){ | ||
return this.text; | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
import com.podio.common.Empty; | ||
import com.podio.common.Reference; | ||
import com.sun.jersey.api.client.GenericType; | ||
import com.sun.jersey.api.client.WebResource; | ||
|
||
/** | ||
* Tasks are used to track what work has to be done. Tasks have the following | ||
|
@@ -236,4 +237,12 @@ public List<Task> getCompletedTasks() { | |
new GenericType<List<Task>>() { | ||
}); | ||
} | ||
public List<Task> getUncomletedTasks(int userId) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe better create generic function ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I think it would be better to have a generic function. You can then add some helper functions that fill out with some default values. |
||
WebResource resource= getResourceFactory().getApiResource("/task/"); | ||
resource=resource.queryParam("completed", "0"); | ||
resource=resource.queryParam("responsible", Integer.toString(userId)); | ||
resource=resource.queryParam("limit", "25"); | ||
return resource.get(new GenericType<List<Task>>() { | ||
}); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this file from the PR? It shouldn't be part of the source.