wrong ApplicationProfileNotFoundException import
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@62274 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
5014089ac5
commit
465a6ec75d
|
@ -7,6 +7,7 @@ import java.util.UUID;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
|
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
|
import org.gcube.applicationsupportlayer.social.ex.ApplicationProfileNotFoundException;
|
||||||
import org.gcube.common.core.contexts.GHNContext;
|
import org.gcube.common.core.contexts.GHNContext;
|
||||||
import org.gcube.common.core.informationsystem.client.ISClient;
|
import org.gcube.common.core.informationsystem.client.ISClient;
|
||||||
import org.gcube.common.core.informationsystem.client.XMLResult;
|
import org.gcube.common.core.informationsystem.client.XMLResult;
|
||||||
|
@ -15,7 +16,7 @@ import org.gcube.portal.databook.shared.Application;
|
||||||
import org.gcube.portal.databook.shared.Feed;
|
import org.gcube.portal.databook.shared.Feed;
|
||||||
import org.gcube.portal.databook.shared.FeedType;
|
import org.gcube.portal.databook.shared.FeedType;
|
||||||
import org.gcube.portal.databook.shared.PrivacyLevel;
|
import org.gcube.portal.databook.shared.PrivacyLevel;
|
||||||
import org.gcube.portlets.user.homelibrary.home.data.application.ApplicationDataNotFoundException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -55,7 +56,7 @@ public class ApplicationNewsManager extends SocialPortalBridge implements NewsMa
|
||||||
|
|
||||||
List<XMLResult> appProfile = client.execute(query, aslSession.getScope().getInfrastructure());
|
List<XMLResult> appProfile = client.execute(query, aslSession.getScope().getInfrastructure());
|
||||||
if (appProfile == null || appProfile.size() == 0)
|
if (appProfile == null || appProfile.size() == 0)
|
||||||
throw new ApplicationDataNotFoundException("Your application is not registered in the infrastructure");
|
throw new ApplicationProfileNotFoundException("Your application is not registered in the infrastructure");
|
||||||
else {
|
else {
|
||||||
XMLResult node = appProfile.get(0);
|
XMLResult node = appProfile.get(0);
|
||||||
List<String> currValue = null;
|
List<String> currValue = null;
|
||||||
|
@ -63,7 +64,7 @@ public class ApplicationNewsManager extends SocialPortalBridge implements NewsMa
|
||||||
if (currValue != null && currValue.size() > 0) {
|
if (currValue != null && currValue.size() > 0) {
|
||||||
toReturn.setName(currValue.get(0));
|
toReturn.setName(currValue.get(0));
|
||||||
}
|
}
|
||||||
else throw new ApplicationDataNotFoundException("Your application NAME was not found in the profile");
|
else throw new ApplicationProfileNotFoundException("Your application NAME was not found in the profile");
|
||||||
|
|
||||||
currValue = node.evaluate("/Resource/Profile/Description/text()");
|
currValue = node.evaluate("/Resource/Profile/Description/text()");
|
||||||
if (currValue != null && currValue.size() > 0) {
|
if (currValue != null && currValue.size() > 0) {
|
||||||
|
@ -75,13 +76,13 @@ public class ApplicationNewsManager extends SocialPortalBridge implements NewsMa
|
||||||
if (currValue != null && currValue.size() > 0) {
|
if (currValue != null && currValue.size() > 0) {
|
||||||
toReturn.setKey(currValue.get(0));
|
toReturn.setKey(currValue.get(0));
|
||||||
}
|
}
|
||||||
else throw new ApplicationDataNotFoundException("Your application ID n was not found in the profile, consider adding <AppId> element in <Body>");
|
else throw new ApplicationProfileNotFoundException("Your application ID n was not found in the profile, consider adding <AppId> element in <Body>");
|
||||||
|
|
||||||
currValue = node.evaluate("/Resource/Profile/Body/ThumbnailURL/text()");
|
currValue = node.evaluate("/Resource/Profile/Body/ThumbnailURL/text()");
|
||||||
if (currValue != null && currValue.size() > 0) {
|
if (currValue != null && currValue.size() > 0) {
|
||||||
toReturn.setImageUrl(currValue.get(0));
|
toReturn.setImageUrl(currValue.get(0));
|
||||||
}
|
}
|
||||||
else throw new ApplicationDataNotFoundException("Your application Image Url was not found in the profile, consider adding <ThumbnailURL> element in <Body>");
|
else throw new ApplicationProfileNotFoundException("Your application Image Url was not found in the profile, consider adding <ThumbnailURL> element in <Body>");
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,22 +97,22 @@ public class ApplicationNewsManager extends SocialPortalBridge implements NewsMa
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean shareApplicationUpdate(String description) {
|
public boolean shareApplicationUpdate(String feedText) {
|
||||||
return getStoreInstance().saveAppFeed(buildFeed(description, "", "", "", ""));
|
return getStoreInstance().saveAppFeed(buildFeed(feedText, "", "", "", ""));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean shareApplicationUpdate(String description, String uri) {
|
public boolean shareApplicationUpdate(String feedText, String uri) {
|
||||||
return getStoreInstance().saveAppFeed(buildFeed(description, uri, "", "", ""));
|
return getStoreInstance().saveAppFeed(buildFeed(feedText, uri, "", "", ""));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean shareApplicationUpdate(String description, String uri, String previewTitle, String previewDescription, String previewThumbnailUrl) {
|
public boolean shareApplicationUpdate(String feedText, String uri, String previewTitle, String previewDescription, String previewThumbnailUrl) {
|
||||||
return getStoreInstance().saveAppFeed(buildFeed(description, uri, previewTitle, previewDescription, previewThumbnailUrl));
|
return getStoreInstance().saveAppFeed(buildFeed(feedText, uri, previewTitle, previewDescription, previewThumbnailUrl));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Feed buildFeed(String description, String uri, String previewTitle, String previewDescription, String previewThumbnailUrl) {
|
private Feed buildFeed(String description, String uri, String previewTitle, String previewDescription, String previewThumbnailUrl) {
|
||||||
|
|
Loading…
Reference in New Issue