changed ApplicationManager constructor to get portletClassName

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@64478 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2012-12-18 15:32:49 +00:00
parent 56133f56dd
commit 2853d2bee8
2 changed files with 17 additions and 19 deletions

View File

@ -34,16 +34,16 @@ public class ApplicationNewsManager extends SocialPortalBridge implements NewsMa
* @param aslSession the ASLSession instance
* @param applicationClass your servlet class name will be used ad unique identifier for your application
*/
public ApplicationNewsManager(ASLSession session, Class<? extends HttpServlet> applicationClass) {
public ApplicationNewsManager(ASLSession session, String portletClassName) {
super(session);
this.application = getProfileFromInfrastrucure(applicationClass);
this.application = getProfileFromInfrastrucure(portletClassName);
}
/**
* this method looks up the application profile among the ones available in the infrastructure
* @param applicationClass
* @return the application profile
*/
private Application getProfileFromInfrastrucure(Class<? extends HttpServlet> applicationClass) {
private Application getProfileFromInfrastrucure(String portletClassName) {
try {
Application toReturn = new Application();
ISClient client = GHNContext.getImplementation(ISClient.class);
@ -52,7 +52,7 @@ public class ApplicationNewsManager extends SocialPortalBridge implements NewsMa
query.setExpression("for $profile in collection('/db/Profiles/GenericResource')//Resource " +
"where $profile/Profile/SecondaryType/string() eq 'ApplicationProfile' and $profile/Profile/Body/AppId/string() " +
" eq '" + applicationClass.getName() + "'" +
" eq '" + portletClassName + "'" +
"return $profile");
GCUBEScope scope = aslSession.getScope();
@ -150,8 +150,9 @@ public class ApplicationNewsManager extends SocialPortalBridge implements NewsMa
//add the GET params if necessary
if (uriParams != null && uriParams.compareTo("") != 0)
uri += "?"+uriParams;
String scope = getScopeByOrganizationId(""+aslSession.getGroupId());
//String scope = "/gcube/devsec/devVRE";
//String scope = getScopeByOrganizationId(""+aslSession.getGroupId());
String scope = aslSession.getScopeName();
System.out.println("scope: " + aslSession.getScopeName());
Feed toReturn = new Feed(
UUID.randomUUID().toString(),
FeedType.PUBLISH,

View File

@ -12,30 +12,27 @@ public interface NewsManager {
/**
* use to share an update from your application
*
* @param applicationClass your servlet class name will be used ad unique identifier for your application
* @param description add a description for the update you are sharing
* @param uri the link to which the subject of this update is available
* @param feedtext add a description for the update you are sharing
* @return true if the update is correctly delivered, false otherwise
*/
boolean shareApplicationUpdate(String description);
boolean shareApplicationUpdate(String feedtext);
/**
* use to share an update from your application with a reference to the news subject
* use to share an update from your application with a reference to the news object
*
* @param description add a description for the update you are sharing
* @param uriParams the additional parameteres your application needs to open the subject of this update e.g. id=12345&type=foo
* @param feedtext description for the update you are sharing
* @param uriGETparams additional parameters if your application supports the direct opening of of this update's object e.g. id=12345&type=foo
* @return true if the update is correctly delivered, false otherwise
*/
boolean shareApplicationUpdate(String description, String uriGETparams);
boolean shareApplicationUpdate(String feedtext, String uriGETparams);
/**
* use to share an update from your application with a link preview
* use to share an update from your application with a reference to the news object and with a link preview
*
* @param applicationClass your servlet class name will be used ad unique identifier for your application with a link preview
* @param description add a description for the update you are sharing
* @param uriParams the additional parameteres your application needs to open the subject of this update e.g. id=12345&type=foo
* @param feedtext add a description for the update you are sharing
* @param uriGETparams additional parameters if your application supports the direct opening of of this update's object e.g. id=12345&type=foo
* @param previewTitle the title to show in the preview
* @param previewDescription the description to show in the preview
* @param previewThumbnailUrl the image url to show in the preview
* @return true if the update is correctly delivered, false otherwise
*/
boolean shareApplicationUpdate(String description, String uriGETparams, String previewTitle, String previewDescription, String previewThumbnailUrl);
boolean shareApplicationUpdate(String feedtext, String uriGETparams, String previewTitle, String previewDescription, String previewThumbnailUrl);
}