Dekoh platform API

dekoh.portal.fwk.share
Class LocalRequestContext

java.lang.Object
  extended by dekoh.portal.fwk.share.RequestContext
      extended by dekoh.portal.fwk.share.LocalRequestContext

public class LocalRequestContext
extends RequestContext

Since:
Nov 23, 2006

Field Summary
protected  DIOEntityManagerFactory dioemf
           
 
Fields inherited from class dekoh.portal.fwk.share.RequestContext
contextPath, DIO_ID_PARAMETER_KEY, em, request, REQUEST_CONTEXT_ATTRIBUTE
 
Constructor Summary
LocalRequestContext(HttpServletRequest request, DIOEntityManager em, DIOEntityManagerFactory emf)
           
LocalRequestContext(HttpServletRequest request, DIOEntityManager em, DIOEntityManagerFactory emf, String contextPath)
           
 
Method Summary
protected  DioCollection _createCollection(String collectionName, int previewDioId)
           
 Share addBuddiesToShare(int shareId, String[] contactKeys)
          Adds the given buddy contactKeys to the share
 Set addTagToDio(String dioId, String[] tagNames)
          Adds the given tags to the dio.
protected  void checkAccessControl()
           
 void copyDigitalObjectsToCollection(int dioCollectionId, String[] dioIDs)
          Copy photos selected to the given collection
 DioCollection createCollection(String collectionName, String[] dioIds)
          This method makes a new collection with the given name, and the specified photos as its members.
 Share createPublicShare(DioCollection dio, String contextPath, String shareName)
           
 Share createShare(DioCollection dio, String contextPath, String shareName, String[] contactKeys)
           
 void deleteComment(String commentId, int numberOfReplies)
          Deletes a comment.
 int deleteShareByID(int shareID)
          deletes a share by shareId.
 void deleteTag(String[] tags)
          deletes the given tag
 void disableShares(List shareIds)
           
 void enableAllDisabledShares(int dioId)
           
 void enableShares(List shareIds)
           
 List findMostRecentComments(int numComments)
           
 AccessPath getAccessPathForComment(Comment comment)
           
 List getAllBuddies(HttpServletRequest request)
           
 List getAllCommentsForDigitalObject(Integer dioId)
           
 Set getAllDIOByTagName(String tagName)
          gets the set all digital object to the given tag
 List getAllDIOForTags(String tags)
          gets the List of all DigitalObjects for the given tags
 List getAllSharedBuddiesForDIO(DigitalObject digitalObject)
          Gets all buddies to whom the given digitalObject is shared to
 List getAllShares()
           
 DigitalObject getDio(Class entityClass, int id)
           
 DIOEntityManager getEntityManager()
           
 TagCloud getLastMonthUsedTagCloud(int maxCount)
          Gets Tagcloud with tags used in the last one month
 TagCloud getLastOneDayUsedTagCloud(int maxCount)
          Gets Tagcloud with tags used in the last 24 hours
 TagCloud getLastWeekUsedTagCloud(int maxCount)
          Gets Tagcloud with tags used in the last one week (7 days)
 LocalUser getOwner()
           
protected  String getOwnerUserName(HttpServletRequest request)
           
 List getRecentBuddyShareVisits(int maxNoOfVisits)
           
 Share getShareById(int id)
           
 List getShareForDigitalObject(int dioId)
          Gets the list of all share for the given DigitalObject
 TagCloud getTagCloud(int numOfTags)
           
 Set getTagsForDigitalObject(int dioId)
          Gets all tags of the given digital object
 boolean isLocalRequest()
           
 Tag mergeTags(String[] oldTags, String newTag)
           
 void moveDigitalObjectToCollection(AccessPath accessPath, int digitalObjectId, int dioCollectionId)
          move the photos from a colletion to another collection
 DIOEntityManager newEntityManager()
           
 Comment postNewComment(String comment, AccessPath accessPath, String dioId)
          Adds new comment to a dioId.
 void removeBuddyFromShare(int shareId, String[] contactKeys)
           
 void removeCollection(int dioId)
          To remove the entire collection
 void removeDigitalObjectFromCollection(AccessPath collectionPath, int dioId)
          Remove photo from a given collection
 void removeTagForDio(int dioId, String[] tags)
          Untags the given tag from the digital object if it is tagged with
 Tag renameTag(String fromTag, String toTag)
          Moves all digitalObject tagged with fromTag to toTag
 Comment replyToComment(String comment, String commentId)
          Post Reply to comment.
 void sendCollectionShareMail(ShareMetadata metaData, MailTemplateObject template, String[] contactKeys)
           
 void setOrAddCollectionTemplate(DioCollection dioCollection, Properties templateProperties)
          sets or changed the template properties for the given collection
 void setOrAddCollectionTemplate(int dioCollectionId, Properties templateProperties)
           
protected  void updateParentPreviewDioIfRequired(DioCollection dioCollection)
           
protected  void updatePreviewDioIfRequired(DioCollection collection, DigitalObject oldpreviewDio)
           
 
Methods inherited from class dekoh.portal.fwk.share.RequestContext
checkAccessControl, createAccessPath, createDioCollectionQueryInterface, createMailTemplateObject, createRequestContext, createRequestContext, createRequestContext, createRequestContext, createResizeImageCache, createShareQueryInterface, createShareQueryInterface, getAccessOptionUri, getAccessPath, getBuddy, getCommentOrThrowException, getContextPath, getDigitalObjectPage, getDioCollectionQueryInterface, getDioId, getDioQueryInterface, getImageCacheDir, getIncomingUserAliases, getOrCreateResizeImageCache, getOwnerName, getQueryParams, getRequestContext, getResizeImageCacheInContext, getShareQueryInterface, isAnonymousAccess, isRemoteAccess, recordBuddyVisit, setDioCollectionQueryInterface, setDioQueryInterface, setResizeImageCacheInContext, setShareQueryInterface
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dioemf

protected final DIOEntityManagerFactory dioemf
Constructor Detail

LocalRequestContext

public LocalRequestContext(HttpServletRequest request,
                           DIOEntityManager em,
                           DIOEntityManagerFactory emf)

LocalRequestContext

public LocalRequestContext(HttpServletRequest request,
                           DIOEntityManager em,
                           DIOEntityManagerFactory emf,
                           String contextPath)
Method Detail

getEntityManager

public DIOEntityManager getEntityManager()

newEntityManager

public DIOEntityManager newEntityManager()

deleteComment

public void deleteComment(String commentId,
                          int numberOfReplies)
                   throws CommentIsUpdatedException
Deletes a comment. If the comment is 'parent' of a thread of comemnts, all its child comments will also be deleted.

Parameters:
commentId - comment to be deleted -- must be an integer.
numberOfReplies - numberOfReplies to this comment, as the user sees them.
Throws:
CommentIsUpdatedException - when the number of replies of this comment is different -- this usually means that someone has replied to this comment.

postNewComment

public Comment postNewComment(String comment,
                              AccessPath accessPath,
                              String dioId)
Description copied from class: RequestContext
Adds new comment to a dioId.

Overrides:
postNewComment in class RequestContext
Returns:

replyToComment

public Comment replyToComment(String comment,
                              String commentId)
Description copied from class: RequestContext
Post Reply to comment.

Overrides:
replyToComment in class RequestContext
Parameters:
comment - - comment text
commentId - - reply to comment
Returns:
return added reply comment.

sendCollectionShareMail

public void sendCollectionShareMail(ShareMetadata metaData,
                                    MailTemplateObject template,
                                    String[] contactKeys)
                             throws HeuristicShareException,
                                    ShareException
Throws:
HeuristicShareException
ShareException

getOwnerUserName

protected String getOwnerUserName(HttpServletRequest request)
Overrides:
getOwnerUserName in class RequestContext

getDio

public DigitalObject getDio(Class entityClass,
                            int id)
Overrides:
getDio in class RequestContext

isLocalRequest

public boolean isLocalRequest()
Overrides:
isLocalRequest in class RequestContext

getTagCloud

public TagCloud getTagCloud(int numOfTags)

getLastMonthUsedTagCloud

public TagCloud getLastMonthUsedTagCloud(int maxCount)
Gets Tagcloud with tags used in the last one month

Parameters:
maxCount - - Maximum number of tag to fetch
Returns:
- tagcloud

getLastWeekUsedTagCloud

public TagCloud getLastWeekUsedTagCloud(int maxCount)
Gets Tagcloud with tags used in the last one week (7 days)

Parameters:
maxCount - - Maximum number of tag to fetch
Returns:
- tagcloud

getLastOneDayUsedTagCloud

public TagCloud getLastOneDayUsedTagCloud(int maxCount)
Gets Tagcloud with tags used in the last 24 hours

Parameters:
maxCount - - Maximum number of tag to fetch
Returns:
- tagcloud

addTagToDio

public Set addTagToDio(String dioId,
                       String[] tagNames)
Adds the given tags to the dio. If no DigitalObject by given id exists or if the tagNames is null this method be a no-op.

Parameters:
dioId - which dio to add tags to, if the dio is null this method will create Tag objects but will not add to any Dio.
tagNames - key words
Returns:
set of tag entities. order is same as in the input array.

deleteTag

public void deleteTag(String[] tags)
deletes the given tag

Parameters:
tags - - array of tags

renameTag

public Tag renameTag(String fromTag,
                     String toTag)
Moves all digitalObject tagged with fromTag to toTag

Parameters:
fromTag - - rename tag
toTag - - new Tag Name
Returns:

removeTagForDio

public void removeTagForDio(int dioId,
                            String[] tags)
Untags the given tag from the digital object if it is tagged with

Parameters:
dioId - - DigitalObject ID
tags - - Array of Tag to be removed

mergeTags

public Tag mergeTags(String[] oldTags,
                     String newTag)

getAllDIOByTagName

public Set getAllDIOByTagName(String tagName)
gets the set all digital object to the given tag

Parameters:
tagName - - tag name to fetch
Returns:
- set of all digital objects

getAllDIOForTags

public List getAllDIOForTags(String tags)
gets the List of all DigitalObjects for the given tags

Parameters:
tags - - tags separated by , (comma)
Returns:
list DigitalObjects for the given tags

getTagsForDigitalObject

public Set getTagsForDigitalObject(int dioId)
Gets all tags of the given digital object

Parameters:
dioId - - digitalobject ID
Returns:
- list of tags

getAllSharedBuddiesForDIO

public List getAllSharedBuddiesForDIO(DigitalObject digitalObject)
Gets all buddies to whom the given digitalObject is shared to

Parameters:
digitalObject - - DigitalObject
Returns:
- List of Buddies

getAllCommentsForDigitalObject

public List getAllCommentsForDigitalObject(Integer dioId)
Overrides:
getAllCommentsForDigitalObject in class RequestContext

findMostRecentComments

public List findMostRecentComments(int numComments)
Overrides:
findMostRecentComments in class RequestContext

createCollection

public DioCollection createCollection(String collectionName,
                                      String[] dioIds)
This method makes a new collection with the given name, and the specified photos as its members.

Parameters:
collectionName - the name of the new collection
dioIds - array of dioIds to be added to the collection
Returns:

_createCollection

protected DioCollection _createCollection(String collectionName,
                                          int previewDioId)

setOrAddCollectionTemplate

public void setOrAddCollectionTemplate(DioCollection dioCollection,
                                       Properties templateProperties)
sets or changed the template properties for the given collection

Parameters:
dioCollection - - DIOCollection
templateProperties - templateProperties

setOrAddCollectionTemplate

public void setOrAddCollectionTemplate(int dioCollectionId,
                                       Properties templateProperties)

removeDigitalObjectFromCollection

public void removeDigitalObjectFromCollection(AccessPath collectionPath,
                                              int dioId)
Remove photo from a given collection

Parameters:
collectionPath - AccessPath To get the collection from which photo has to be deleted
dioId - PhotoDio to be deleted

updatePreviewDioIfRequired

protected void updatePreviewDioIfRequired(DioCollection collection,
                                          DigitalObject oldpreviewDio)

removeCollection

public void removeCollection(int dioId)
To remove the entire collection

Parameters:
dioId - DioCollection ID

updateParentPreviewDioIfRequired

protected void updateParentPreviewDioIfRequired(DioCollection dioCollection)

copyDigitalObjectsToCollection

public void copyDigitalObjectsToCollection(int dioCollectionId,
                                           String[] dioIDs)
Copy photos selected to the given collection

Parameters:
dioCollectionId - DioCollection ID
dioIDs - PhotoId's to be copied

moveDigitalObjectToCollection

public void moveDigitalObjectToCollection(AccessPath accessPath,
                                          int digitalObjectId,
                                          int dioCollectionId)
move the photos from a colletion to another collection

Parameters:
accessPath - to get the curent collection the photos to be moved
digitalObjectId - digitalObject to move
dioCollectionId - from collection

getAllBuddies

public List getAllBuddies(HttpServletRequest request)
Parameters:
request - Request object
Returns:
Returns a list of Contacts for the logged in user.

getAllShares

public List getAllShares()
Returns:
list of shares created by the current user.

getShareById

public Share getShareById(int id)
Parameters:
id - primary key
Returns:
share entity
Throws:
NoSuchEntityException - if there is no Share by given Id owner by the logged in user.

deleteShareByID

public int deleteShareByID(int shareID)
deletes a share by shareId. Comments made on this Share are not deleted.

Parameters:
shareID -
Returns:
returns number of elements deleted

createShare

public Share createShare(DioCollection dio,
                         String contextPath,
                         String shareName,
                         String[] contactKeys)

createPublicShare

public Share createPublicShare(DioCollection dio,
                               String contextPath,
                               String shareName)

addBuddiesToShare

public Share addBuddiesToShare(int shareId,
                               String[] contactKeys)
Adds the given buddy contactKeys to the share

Parameters:
shareId - share Id
contactKeys - buddy contactkeys
Returns:
updated Share object

removeBuddyFromShare

public void removeBuddyFromShare(int shareId,
                                 String[] contactKeys)

getRecentBuddyShareVisits

public List getRecentBuddyShareVisits(int maxNoOfVisits)

getShareForDigitalObject

public List getShareForDigitalObject(int dioId)
Gets the list of all share for the given DigitalObject

Parameters:
dioId - digitalObject Id
Returns:
list of shares

getAccessPathForComment

public AccessPath getAccessPathForComment(Comment comment)
Overrides:
getAccessPathForComment in class RequestContext

getOwner

public LocalUser getOwner()

checkAccessControl

protected void checkAccessControl()
Overrides:
checkAccessControl in class RequestContext

enableAllDisabledShares

public void enableAllDisabledShares(int dioId)

enableShares

public void enableShares(List shareIds)

disableShares

public void disableShares(List shareIds)

Dekoh platform API

© 2009 Pramati Technologies - Dekoh - Portal for Developers