Skip to content

Commit

Permalink
DASH-344 including the directURL in the entity broker call only
Browse files Browse the repository at this point in the history
  • Loading branch information
pushyamig committed Nov 4, 2015
1 parent a4dc066 commit 500fdb4
Show file tree
Hide file tree
Showing 4 changed files with 183 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ public interface DashboardUserLogic {
*/
public List<NewsLink> getCurrentNewsLinks(String sakaiUserId, String contextId);

/**
* Returns a list of NewsLink objects which the specified person has permission to access and has not hidden.
* If the contextId is not null, the results will be limited to the site indicated by that value.
* variable 'includeInfoLinkUrl' is used for method overloading purpose
* @param sakaiUserId
* @param contextId
* @param includeInfoLinkUrl
* @return
*/
public List<NewsLink> getCurrentNewsLinks(String sakaiUserId, String contextId,boolean includeInfoLinkUrl);

/**
* Returns a list of CalendarLink objects linking a particular person to calendar items
* whose time attribute is in the current date or later (i.e. it will return items representing
Expand All @@ -48,6 +59,20 @@ public interface DashboardUserLogic {
* @return
*/
public List<CalendarLink> getFutureCalendarLinks(String sakaiUserId, String contextId, boolean hidden);

/**
* Returns a list of CalendarLink objects linking a particular person to calendar items
* whose time attribute is in the current date or later (i.e. it will return items representing
* events that occurred earlier in the current day) and whose "hidden" state matches the
* specified value. Results will be limited to a particular site if the contextId parameter
* is not null. variable 'includeInfoLinkUrl' is used for method overloading purpose
* @param sakaiUserId
* @param contextId
* @param hidden
* @param includeInfoLinkUrl
* @return
*/
public List<CalendarLink> getFutureCalendarLinks(String sakaiUserId, String contextId, boolean hidden, boolean includeInfoLinkUrl);

/**
* Returns a list of NewsLink objects which the specified person has permission to access and has hidden.
Expand All @@ -57,6 +82,18 @@ public interface DashboardUserLogic {
* @return
*/
public List<NewsLink> getHiddenNewsLinks(String sakaiUserId, String siteId);

/**
* Returns a list of NewsLink objects which the specified person has permission to access and has hidden.
* If the contextId is not null, the results will be limited to the site indicated by that value.
* variable 'includeInfoLinkUrl' is used for method overloading purpose
* @param sakaiUserId
* @param contextId
* @param includeInfoLinkUrl
* @return
*/

public List<NewsLink> getHiddenNewsLinks(String userUuid, String siteId, boolean includeInfoLinkUrl);

/**
* Returns a paged list of NewsLink objects representing items in a "group" that the specified person
Expand Down Expand Up @@ -84,6 +121,19 @@ public List<NewsLink> getNewsLinksByGroupId(String sakaiUserId,
* @return
*/
public List<CalendarLink> getPastCalendarLinks(String sakaiUserId, String contextId, boolean hidden);

/**
* Returns a list of CalendarLink objects linking a particular person to calendar items
* whose time attribute is before the current instant and whose "hidden" state matches the
* specified value. Results will be limited to a particular site if the contextId parameter
* is not null. variable 'includeInfoLinkUrl' is used for method overloading purpose
* @param sakaiUserId
* @param contextId
* @param hidden
* @param includeInfoLinkUrl
* @return
*/
public List<CalendarLink> getPastCalendarLinks(String sakaiUserId, String contextId, boolean hidden, boolean includeInfoLinkUrl);

/**
* Returns a list of CalendarLink objects linking a particular person to calendar items
Expand All @@ -94,6 +144,16 @@ public List<NewsLink> getNewsLinksByGroupId(String sakaiUserId,
* @return
*/
public List<CalendarLink> getStarredCalendarLinks(String sakaiUserId, String contextId);
/**
* Returns a list of CalendarLink objects linking a particular person to calendar items
* that the specified user has "starred". Results will be limited to a particular site if
* the contextId parameter is not null. variable 'includeInfoLinkUrl' is used for method overloading purpose
* @param sakaiUserId
* @param contextId
* @param includeInfoLinkUrl
* @return
*/
public List<CalendarLink> getStarredCalendarLinks(String sakaiUserId, String contextId,boolean includeInfoLinkUrl);

/**
* Returns a list of NewsLink objects which the specified person has permission to access and has "starred".
Expand All @@ -103,6 +163,17 @@ public List<NewsLink> getNewsLinksByGroupId(String sakaiUserId,
* @return
*/
public List<NewsLink> getStarredNewsLinks(String sakaiUserId, String siteId);

/**
* Returns a list of NewsLink objects which the specified person has permission to access and has "starred".
* If the contextId is not null, the results will be limited to the site indicated by that value.
* variable 'includeInfoLinkUrl' is used for method overloading purpose
* @param sakaiUserId
* @param contextId
* @param includeInfoLinkUrl
* @return
*/
public List<NewsLink> getStarredNewsLinks(String sakaiUserId, String siteId,boolean includeInfoLinkUrl);

/**
* Hide a calendar item from views of calendar items for a particular user.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ public List<?> getNewsItems(EntityView view, EntityReference ref, Map<String, Ob

//only return hidden items
if(hidden){
return dashboardCommonLogic.getHiddenNewsLinks(userUuid, siteId);
return dashboardCommonLogic.getHiddenNewsLinks(userUuid, siteId,true);
}

//only return starred items
if(starred){
return dashboardCommonLogic.getStarredNewsLinks(userUuid, siteId);
return dashboardCommonLogic.getStarredNewsLinks(userUuid, siteId,true);
}

//return everything
return dashboardCommonLogic.getCurrentNewsLinks(userUuid, siteId);
return dashboardCommonLogic.getCurrentNewsLinks(userUuid, siteId, true);
}

@EntityCustomAction(action="calendar",viewKey=EntityView.VIEW_LIST)
Expand All @@ -80,16 +80,16 @@ public List<?> getCalendarItems(EntityView view, EntityReference ref, Map<String

//only return starred items
if(starred){
return dashboardCommonLogic.getStarredCalendarLinks(userUuid, siteId);
return dashboardCommonLogic.getStarredCalendarLinks(userUuid, siteId,true);
}

//only return past items. Could be hidden depending on param
if(past){
return dashboardCommonLogic.getPastCalendarLinks(userUuid, siteId, hidden);
return dashboardCommonLogic.getPastCalendarLinks(userUuid, siteId, hidden,true);
}

//return everything. Could be hidden depending on param
return dashboardCommonLogic.getFutureCalendarLinks(userUuid, siteId, hidden);
return dashboardCommonLogic.getFutureCalendarLinks(userUuid, siteId, hidden, true);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,11 @@ public List<NewsLink> getCurrentNewsLinks(String sakaiUserId,
return this.dashboardUserLogic.getCurrentNewsLinks(sakaiUserId, contextId);
}

public List<NewsLink> getCurrentNewsLinks(String sakaiUserId,String contextId, boolean includeInfoLinkUrl) {

return this.dashboardUserLogic.getCurrentNewsLinks(sakaiUserId, contextId, includeInfoLinkUrl);
}

/* (non-Javadoc)
* @see org.sakaiproject.dash.app.DashboardUserLogic#getFutureCalendarLinks(java.lang.String, java.lang.String, boolean)
*/
Expand All @@ -1336,6 +1341,12 @@ public List<CalendarLink> getFutureCalendarLinks(String sakaiUserId,

return this.dashboardUserLogic.getFutureCalendarLinks(sakaiUserId, contextId, hidden);
}

public List<CalendarLink> getFutureCalendarLinks(String sakaiUserId,
String contextId, boolean hidden, boolean includeInfoLinkUrl) {

return this.dashboardUserLogic.getFutureCalendarLinks(sakaiUserId, contextId, hidden,includeInfoLinkUrl);
}

/* (non-Javadoc)
* @see org.sakaiproject.dash.app.DashboardUserLogic#getHiddenNewsLinks(java.lang.String, java.lang.String)
Expand All @@ -1345,6 +1356,11 @@ public List<NewsLink> getHiddenNewsLinks(String sakaiUserId, String siteId) {

return this.dashboardUserLogic.getHiddenNewsLinks(sakaiUserId, siteId);
}

public List<NewsLink> getHiddenNewsLinks(String sakaiUserId, String siteId, boolean includeInfoLinkUrl) {

return this.dashboardUserLogic.getHiddenNewsLinks(sakaiUserId, siteId, includeInfoLinkUrl);
}

/* (non-Javadoc)
* @see org.sakaiproject.dash.app.DashboardUserLogic#getNewsLinksByGroupId(java.lang.String, java.lang.String, int, int)
Expand All @@ -1365,6 +1381,12 @@ public List<CalendarLink> getPastCalendarLinks(String sakaiUserId,

return this.dashboardUserLogic.getPastCalendarLinks(sakaiUserId, contextId, hidden);
}

public List<CalendarLink> getPastCalendarLinks(String sakaiUserId,
String contextId, boolean hidden, boolean includeInfoLinkUrl) {

return this.dashboardUserLogic.getPastCalendarLinks(sakaiUserId, contextId, hidden, includeInfoLinkUrl);
}

/* (non-Javadoc)
* @see org.sakaiproject.dash.app.DashboardUserLogic#getStarredCalendarLinks(java.lang.String, java.lang.String)
Expand All @@ -1375,6 +1397,12 @@ public List<CalendarLink> getStarredCalendarLinks(String sakaiUserId,

return this.dashboardUserLogic.getStarredCalendarLinks(sakaiUserId, contextId);
}

public List<CalendarLink> getStarredCalendarLinks(String sakaiUserId,
String contextId, boolean includeInfoLinkUrl) {

return this.dashboardUserLogic.getStarredCalendarLinks(sakaiUserId, contextId, includeInfoLinkUrl);
}

/* (non-Javadoc)
* @see org.sakaiproject.dash.app.DashboardUserLogic#getStarredNewsLinks(java.lang.String, java.lang.String)
Expand All @@ -1384,6 +1412,11 @@ public List<NewsLink> getStarredNewsLinks(String sakaiUserId, String siteId) {

return this.dashboardUserLogic.getStarredNewsLinks(sakaiUserId, siteId);
}

public List<NewsLink> getStarredNewsLinks(String sakaiUserId, String siteId,boolean includeInfoLinkUrl) {

return this.dashboardUserLogic.getStarredNewsLinks(sakaiUserId, siteId, includeInfoLinkUrl);
}

/* (non-Javadoc)
* @see org.sakaiproject.dash.app.DashboardUserLogic#hideCalendarItem(java.lang.String, long)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ public int countNewsLinksByGroupId(String sakaiUserId,
*/
@Override
public List<NewsLink> getCurrentNewsLinks(String sakaiId, String siteId) {
return getCurrentNewsLinks(sakaiId, siteId, false);
}
/*
* This method is used for getting CurrentNewsLinks, if 'includeInfoLinkUrl`= true directUrl of a particular source type will be included
* part of the list. For EntityBroker feed call we are including this infolinkUrl as part of the list. For the Dashboard UI call we are not as this has
* some performance issues.
*/
public List<NewsLink> getCurrentNewsLinks(String sakaiId, String siteId, boolean includeInfoLinkUrl) {
List<NewsLink> links = dao.getCurrentNewsLinks(sakaiId, siteId);

if(links != null) {
Expand All @@ -110,10 +118,12 @@ public List<NewsLink> getCurrentNewsLinks(String sakaiId, String siteId) {
} else {
item.setTitle(typeObj.getGroupTitle(itemCount, item.getContext().getContextTitle(), item.getNewsTimeLabelKey()));
}
}else{
logger.debug("The source type is null");
}
}else{
//When getItemCount() > 1 the infoLinkUrl is null and hence we don't need to run this call.
if(item!=null){
//When getItemCount() > 1 the infoLinkUrl is null and hence we don't get the InfoLinkUrl and we are running this call only for entity broker feed.
if(item!=null && includeInfoLinkUrl){
setItemInfoLinkUrl(item);
}
}
Expand Down Expand Up @@ -189,10 +199,22 @@ private void setItemInfoLinkUrl(CalendarItem item) {
*/
@Override
public List<CalendarLink> getFutureCalendarLinks(String sakaiUserId, String contextId, boolean hidden) {
return getFutureCalendarLinks(sakaiUserId, contextId, hidden,false);
}

/*
* This method is used for getting FutureCalendarLinks, if 'includeInfoLinkUrl`= true directUrl of a particular source type will be included
* part of the list. For EntityBroker feed call we are including this infolinkUrl as part of the list. For the Dashboard UI call we are not as this has
* some performance issues.
*/
public List<CalendarLink> getFutureCalendarLinks(String sakaiUserId, String contextId, boolean hidden, boolean includeInfoLinkUrl) {
List<CalendarLink> futureCalendarLinks = dao.getFutureCalendarLinks(sakaiUserId, contextId, hidden);
if(!includeInfoLinkUrl){
return futureCalendarLinks;
}
for (CalendarLink calendarLink : futureCalendarLinks) {
CalendarItem calendarItem = calendarLink.getCalendarItem();
setItemInfoLinkUrl(calendarItem);
CalendarItem calendarItem = calendarLink.getCalendarItem();
setItemInfoLinkUrl(calendarItem);
}
return futureCalendarLinks;
}
Expand All @@ -202,7 +224,18 @@ public List<CalendarLink> getFutureCalendarLinks(String sakaiUserId, String cont
*/
@Override
public List<NewsLink> getHiddenNewsLinks(String sakaiId, String siteId) {
return getHiddenNewsLinks(sakaiId,siteId,false);
}
/*
* This method is used for getting HiddenNewsLinks, if 'includeInfoLinkUrl`= true directUrl of a particular source type will be included
* part of the list. For EntityBroker feed call we are including this infolinkUrl as part of the list. For the Dashboard UI call we are not as this has
* some performance issues.
*/
public List<NewsLink> getHiddenNewsLinks(String sakaiId, String siteId, boolean includeInfoLinkUrl) {
List<NewsLink> hiddenNewsLinks = dao.getHiddenNewsLinks(sakaiId, siteId);
if(!includeInfoLinkUrl){
return hiddenNewsLinks;
}
for (NewsLink newsLink : hiddenNewsLinks) {
NewsItem item = newsLink.getNewsItem();
setItemInfoLinkUrl(item);
Expand All @@ -224,7 +257,18 @@ public List<NewsLink> getNewsLinksByGroupId(String sakaiUserId,
*/
@Override
public List<CalendarLink> getPastCalendarLinks(String sakaiUserId, String contextId, boolean hidden) {
return getPastCalendarLinks(sakaiUserId, contextId, hidden,false);
}
/*
* This method is used for getting PastCalendarLinks, if 'includeInfoLinkUrl`= true directUrl of a particular source type will be included
* part of the list. For EntityBroker feed call we are including this infolinkUrl as part of the list. For the Dashboard UI call we are not as this has
* some performance issues.
*/
public List<CalendarLink> getPastCalendarLinks(String sakaiUserId, String contextId, boolean hidden, boolean includeInfoLinkUrl) {
List<CalendarLink> pastCalendarLinks = dao.getPastCalendarLinks(sakaiUserId, contextId, hidden);
if(!includeInfoLinkUrl){
return pastCalendarLinks;
}
for (CalendarLink calendarLink : pastCalendarLinks) {
CalendarItem calendarItem = calendarLink.getCalendarItem();
setItemInfoLinkUrl(calendarItem);
Expand All @@ -237,7 +281,19 @@ public List<CalendarLink> getPastCalendarLinks(String sakaiUserId, String contex
*/
@Override
public List<CalendarLink> getStarredCalendarLinks(String sakaiUserId, String contextId) {
return getStarredCalendarLinks(sakaiUserId, contextId,false);
}

/*
* This method is used for getting StarredCalendarLinks, if 'includeInfoLinkUrl`= true directUrl of a particular source type will be included
* part of the list. For EntityBroker feed call we are including this infolinkUrl as part of the list. For the Dashboard UI call we are not as this has
* some performance issues.
*/
public List<CalendarLink> getStarredCalendarLinks(String sakaiUserId, String contextId, boolean includeInfoLinkUrl) {
List<CalendarLink> starredCalendarLinks = dao.getStarredCalendarLinks(sakaiUserId, contextId);
if(!includeInfoLinkUrl){
return starredCalendarLinks;
}
for (CalendarLink calendarLink : starredCalendarLinks) {
CalendarItem calendarItem = calendarLink.getCalendarItem();
setItemInfoLinkUrl(calendarItem);
Expand All @@ -250,7 +306,20 @@ public List<CalendarLink> getStarredCalendarLinks(String sakaiUserId, String con
*/
@Override
public List<NewsLink> getStarredNewsLinks(String sakaiId, String siteId) {
return getStarredNewsLinks(sakaiId, siteId, false);
}

/*
* This method is used for getting StarredNewsLinks, if 'includeInfoLinkUrl`= true directUrl of a particular source type will be included
* part of the list. For EntityBroker feed call we are including this infolinkUrl as part of the list. For the Dashboard UI call we are not as this has
* some performance issues.
*/

public List<NewsLink> getStarredNewsLinks(String sakaiId, String siteId, boolean includeInfoLinkUrl) {
List<NewsLink> starredNewsLinks = dao.getStarredNewsLinks(sakaiId, siteId);
if(!includeInfoLinkUrl){
return starredNewsLinks;
}
for (NewsLink newsLink : starredNewsLinks) {
NewsItem item = newsLink.getNewsItem();
setItemInfoLinkUrl(item);
Expand Down

0 comments on commit 500fdb4

Please sign in to comment.