mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
ALF-9156 Calendar Java API tagging support, and convert the Event Get webscript to be java backed
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28840 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -61,8 +61,13 @@ public abstract class AbstractCalendarWebScript extends DeclarativeWebScript
|
||||
*/
|
||||
protected Map<String,Object> buildError(String message)
|
||||
{
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("error", message);
|
||||
|
||||
HashMap<String, Object> model = new HashMap<String, Object>();
|
||||
model.put("error", message);
|
||||
model.put("result", result);
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@@ -76,7 +81,12 @@ public abstract class AbstractCalendarWebScript extends DeclarativeWebScript
|
||||
return buildError("No parameters supplied");
|
||||
}
|
||||
|
||||
String siteName = templateVars.get("site");
|
||||
// Get the site short name. Try quite hard to do so...
|
||||
String siteName = templateVars.get("siteid");
|
||||
if(siteName == null)
|
||||
{
|
||||
siteName = templateVars.get("site");
|
||||
}
|
||||
if(siteName == null)
|
||||
{
|
||||
siteName = req.getParameter("site");
|
||||
@@ -86,6 +96,7 @@ public abstract class AbstractCalendarWebScript extends DeclarativeWebScript
|
||||
return buildError("No site given");
|
||||
}
|
||||
|
||||
// Grab the requested site
|
||||
SiteInfo site = siteService.getSite(siteName);
|
||||
if(site == null)
|
||||
{
|
||||
|
@@ -52,19 +52,33 @@ public class CalendarEntryGet extends AbstractCalendarWebScript
|
||||
return buildError("Could not find event: " + eventName);
|
||||
}
|
||||
|
||||
// Build the object
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("name", entry.getSystemName());
|
||||
result.put("what", entry.getTitle());
|
||||
result.put("description", entry.getDescription());
|
||||
result.put("location", entry.getLocation());
|
||||
result.put("from", entry.getStart());
|
||||
result.put("to", entry.getEnd());
|
||||
result.put("tags", entry.getTags());
|
||||
result.put("isoutlook", entry.isOutlook());
|
||||
result.put("outlookuid", entry.getOutlookUID());
|
||||
result.put("allday", CalendarEntryDTO.isAllDay(entry));
|
||||
result.put("recurrence", null); // TODO
|
||||
result.put("docfolder", null); // TODO
|
||||
|
||||
// Replace nulls with blank strings for the JSON
|
||||
for(String key : result.keySet())
|
||||
{
|
||||
if(result.get(key) == null)
|
||||
{
|
||||
result.put(key, "");
|
||||
}
|
||||
}
|
||||
|
||||
// All done
|
||||
Map<String, Object> model = new HashMap<String, Object>();
|
||||
model.put("name", entry.getSystemName());
|
||||
model.put("what", entry.getTitle());
|
||||
model.put("description", entry.getDescription());
|
||||
model.put("location", entry.getLocation());
|
||||
model.put("from", entry.getStart());
|
||||
model.put("to", entry.getEnd());
|
||||
model.put("tags", entry.getTags());
|
||||
model.put("isoutlook", entry.isOutlook());
|
||||
model.put("outlookuid", entry.getOutlookUID());
|
||||
model.put("allday", CalendarEntryDTO.isAllDay(entry));
|
||||
model.put("recurrence", null); // TODO
|
||||
model.put("docfolder", null); // TODO
|
||||
model.put("result", result);
|
||||
return model;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user