moved to version 2.1: removed asl session, changed logging system to liferay's one
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/social-profile@134190 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
6aee580e56
commit
8fc252df86
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/social-profile-2.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry kind="src" output="target/social-profile-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
|
@ -35,5 +35,5 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/social-profile-2.0.1-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="target/social-profile-2.1.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
{"ide":{"scriptPaths":[]},"plugins":{"aui":{},"liferay":{},"yui":{}},"libs":["ecma5","browser"]}
|
|
@ -1,4 +1,9 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.portlet.user.socialprofile.2-1-0"
|
||||
date="2016-12-10">
|
||||
<Change>ASL session removed</Change>
|
||||
<Change>Moved to Liferay logging system</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlet.user.socialprofile.2-0-1"
|
||||
date="2016-10-10">
|
||||
<Change>Minor dependencies fix</Change>
|
||||
|
|
16
pom.xml
16
pom.xml
|
@ -13,7 +13,7 @@
|
|||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>social-profile</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>2.0.1-SNAPSHOT</version>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<name>gCube Social Profile Portlet</name>
|
||||
<description>
|
||||
Social Profile
|
||||
|
@ -67,7 +67,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>gcube-widgets</artifactId>
|
||||
<scope>provided</scope>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
|
@ -93,7 +93,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-scope-maps</artifactId>
|
||||
<scope>compile</scope>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
|
@ -106,11 +106,6 @@
|
|||
<version>1.2.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>aslcore</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>social-networking-library</artifactId>
|
||||
|
@ -176,6 +171,11 @@
|
|||
<artifactId>ic-client</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common.portal</groupId>
|
||||
<artifactId>portal-manager</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<!-- Generate compiled stuff in the folder used for developing mode -->
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -11,6 +11,7 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
|
@ -24,9 +25,8 @@ import org.apache.http.client.methods.HttpGet;
|
|||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.gcube.application.framework.core.session.ASLSession;
|
||||
import org.gcube.application.framework.core.session.SessionManager;
|
||||
import org.gcube.common.encryption.StringEncrypter;
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint.Property;
|
||||
|
@ -35,7 +35,6 @@ import org.gcube.common.scope.api.ScopeProvider;
|
|||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.common.scope.impl.ScopeBean.Type;
|
||||
import org.gcube.portal.custom.communitymanager.SiteManagerUtil;
|
||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||
import org.gcube.portal.databook.shared.UserInfo;
|
||||
import org.gcube.portlets.user.socialprofile.client.SocialService;
|
||||
import org.gcube.portlets.user.socialprofile.shared.UserContext;
|
||||
|
@ -47,11 +46,11 @@ import org.gcube.vomanagement.usermanagement.model.CustomAttributeKeys;
|
|||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||
import org.json.simple.parser.ContainerFactory;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||
import com.liferay.portal.kernel.log.Log;
|
||||
import com.liferay.portal.kernel.log.LogFactoryUtil;
|
||||
import com.liferay.portal.model.Contact;
|
||||
import com.liferay.portal.service.ContactLocalServiceUtil;
|
||||
import com.liferay.portal.service.UserLocalServiceUtil;
|
||||
|
@ -62,7 +61,8 @@ import com.liferay.portal.service.UserLocalServiceUtil;
|
|||
@SuppressWarnings("serial")
|
||||
public class SocialServiceImpl extends RemoteServiceServlet implements SocialService {
|
||||
|
||||
private static final Logger _log = LoggerFactory.getLogger(SocialServiceImpl.class);
|
||||
//private static final Logger logger = LoggerFactory.getLogger(SocialServiceImpl.class);
|
||||
private static final Log logger = LogFactoryUtil.getLog(SocialServiceImpl.class);
|
||||
|
||||
private static final String LINKEDIN_HOST_SERVICE_NAME = "host";
|
||||
private static final String LINKEDIN_CLIEND_ID_PROPNAME = "client_id";
|
||||
|
@ -71,29 +71,36 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
private static final String LINKEDIN_API_REQUEST = "https://api.linkedin.com/v1/people/~:(id,headline,summary,location:(name),industry,positions,picture-urls::(original),public-profile-url)";
|
||||
|
||||
/**
|
||||
* the current ASLSession
|
||||
* @return the session
|
||||
* Retrieve the current user by using the portal manager
|
||||
* @return a GcubeUser object
|
||||
*/
|
||||
private ASLSession getASLSession() {
|
||||
String sessionID = this.getThreadLocalRequest().getSession().getId();
|
||||
String user = (String) this.getThreadLocalRequest().getSession().getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
|
||||
if (user == null) {
|
||||
_log.warn("USER IS NULL setting test.user and Running OUTSIDE PORTAL");
|
||||
user = getDevelopmentUser();
|
||||
SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube");
|
||||
}
|
||||
return SessionManager.getInstance().getASLSession(sessionID, user);
|
||||
}
|
||||
private GCubeUser getCurrentUser(HttpServletRequest request){
|
||||
|
||||
/**
|
||||
* when packaging test will fail if the user is not set to test.user
|
||||
* @return .
|
||||
*/
|
||||
public String getDevelopmentUser() {
|
||||
String user = "test.user";
|
||||
// user = "costantino.perciante";
|
||||
if(request == null)
|
||||
throw new IllegalArgumentException("HttpServletRequest is null!");
|
||||
|
||||
PortalContext pContext = PortalContext.getConfiguration();
|
||||
GCubeUser user = pContext.getCurrentUser(request);
|
||||
logger.debug("Returning user " + user);
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the current scope by using the portal manager
|
||||
* @return a string representing the context
|
||||
*/
|
||||
private String getCurrentContext(HttpServletRequest request){
|
||||
|
||||
if(request == null)
|
||||
throw new IllegalArgumentException("HttpServletRequest is null!");
|
||||
|
||||
PortalContext pContext = PortalContext.getConfiguration();
|
||||
String context = pContext.getCurrentScope(request);
|
||||
logger.debug("Returning context " + context);
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return true if you're running into the portal, false if in development
|
||||
|
@ -104,37 +111,39 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
return true;
|
||||
}
|
||||
catch (com.liferay.portal.kernel.bean.BeanLocatorException ex) {
|
||||
_log.trace("Development Mode ON");
|
||||
logger.trace("Development Mode ON");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext getUserContext(String userid) {
|
||||
if (userid == null || userid.equals("") || userid.equals(getASLSession().getUsername())) {
|
||||
if (userid == null || userid.equals("") || userid.equals(getCurrentUser(this.getThreadLocalRequest()).getUsername())) {
|
||||
System.out.println("Own Profile");
|
||||
_log.info("Own Profile");
|
||||
logger.info("Own Profile");
|
||||
return getOwnProfile();
|
||||
}
|
||||
else {
|
||||
System.out.println("Reading Profile");
|
||||
_log.info(userid + " Reading Profile");
|
||||
logger.info(userid + " Reading Profile");
|
||||
return getUserProfile(userid);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String saveProfessionalBackground(String summary) {
|
||||
|
||||
String username = getCurrentUser(this.getThreadLocalRequest()).getUsername();
|
||||
// parse (html sanitize)
|
||||
String toReturn = transformSummary(summary);
|
||||
if(isWithinPortal()){
|
||||
UserManager um = new LiferayUserManager();
|
||||
ASLSession session = getASLSession();
|
||||
try{
|
||||
GCubeUser user = um.getUserByUsername(session.getUsername());
|
||||
GCubeUser user = um.getUserByUsername(username);
|
||||
um.setUserProfessionalBackground(user.getUserId(), summary); // save as it is
|
||||
return toReturn; // sanitized
|
||||
}catch(Exception e){
|
||||
_log.error("Unable to save the professional background " + summary + " for user " + session.getUsername());
|
||||
logger.error("Unable to save the professional background " + summary + " for user " + username);
|
||||
return null;
|
||||
}
|
||||
}else
|
||||
|
@ -142,10 +151,11 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
}
|
||||
|
||||
private UserContext getUserProfile(String username) {
|
||||
ASLSession session = getASLSession();
|
||||
String email = username+"@isti.cnr.it";
|
||||
String fullName = username+" FULL";
|
||||
String thumbnailURL = "images/Avatar_default.png";
|
||||
PortalContext pContext = PortalContext.getConfiguration();
|
||||
String contextName = pContext.getCurrentGroupName(this.getThreadLocalRequest());
|
||||
if (isWithinPortal()) {
|
||||
try {
|
||||
UserManager um = new LiferayUserManager();
|
||||
|
@ -160,14 +170,14 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
String company = user.getLocation_industry();
|
||||
String summary = transformSummary(um.getUserProfessionalBackground(user.getUserId()));
|
||||
|
||||
return new UserContext(userInfo, headline, company, summary, session.getScopeName(), false, isInfrastructureScope());
|
||||
return new UserContext(userInfo, headline, company, summary, contextName, false, isInfrastructureScope());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new UserContext();
|
||||
}
|
||||
} else {
|
||||
_log.info("Returning test USER");
|
||||
logger.info("Returning test USER");
|
||||
HashMap<String, String> fakeVreNames = new HashMap<String, String>();
|
||||
fakeVreNames.put("/gcube/devsec/devVRE","devVRE");
|
||||
//fakeVreNames.put("/gcube/devNext/NexNext","NexNext");
|
||||
|
@ -175,14 +185,15 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
UserInfo user = new UserInfo(username, username+ "FULL", thumbnailURL, email, "fakeAccountUrl", true, false, fakeVreNames);
|
||||
return new UserContext(user, "", "", ""
|
||||
+ "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam."
|
||||
+ "", session.getScopeName(), false, isInfrastructureScope());
|
||||
+ "", contextName, false, isInfrastructureScope());
|
||||
}
|
||||
}
|
||||
|
||||
private UserContext getOwnProfile() {
|
||||
try {
|
||||
ASLSession session = getASLSession();
|
||||
String username = session.getUsername();
|
||||
PortalContext pContext = PortalContext.getConfiguration();
|
||||
String contextName = pContext.getCurrentGroupName(this.getThreadLocalRequest());
|
||||
String username = getCurrentUser(this.getThreadLocalRequest()).getUsername();
|
||||
String email = username+"@isti.cnr.it";
|
||||
String fullName = username+" FULL";
|
||||
String thumbnailURL = "images/Avatar_default.png";
|
||||
|
@ -203,18 +214,18 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
String company = user.getLocation_industry();
|
||||
String summary = transformSummary(um.getUserProfessionalBackground(user.getUserId()));
|
||||
|
||||
return new UserContext(userInfo, headline, company, summary, session.getScopeName(), true, isInfrastructureScope() );
|
||||
return new UserContext(userInfo, headline, company, summary, contextName, true, isInfrastructureScope() );
|
||||
}
|
||||
else {
|
||||
_log.info("Returning test USER");
|
||||
logger.info("Returning test USER");
|
||||
HashMap<String, String> fakeVreNames = new HashMap<String, String>();
|
||||
fakeVreNames.put("/gcube/devsec/devVRE","devVRE");
|
||||
//fakeVreNames.put("/gcube/devNext/NexNext","NexNext");
|
||||
|
||||
UserInfo user = new UserInfo(getASLSession().getUsername(), fullName, thumbnailURL, email, "fakeAccountUrl", true, false, fakeVreNames);
|
||||
UserInfo user = new UserInfo(username, fullName, thumbnailURL, email, "fakeAccountUrl", true, false, fakeVreNames);
|
||||
return new UserContext(user, "", "", ""
|
||||
+ "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam."
|
||||
+ "", session.getScopeName(), true, isInfrastructureScope() );
|
||||
+ "", contextName, true, isInfrastructureScope() );
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
@ -237,7 +248,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
public Boolean saveHeadline(String newHeadline) {
|
||||
try {
|
||||
UserManager um = new LiferayUserManager();
|
||||
return um.updateJobTitle(um.getUserId(getASLSession().getUsername()), newHeadline);
|
||||
return um.updateJobTitle(um.getUserId(getCurrentUser(this.getThreadLocalRequest()).getUsername()), newHeadline);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
|
@ -249,7 +260,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
//try save the location/industry
|
||||
try {
|
||||
UserManager um = new LiferayUserManager();
|
||||
um.saveCustomAttr(um.getUserId(getASLSession().getUsername()), CustomAttributeKeys.USER_LOCATION_INDUSTRY.getKeyName(), institution);
|
||||
um.saveCustomAttr(um.getUserId(getCurrentUser(this.getThreadLocalRequest()).getUsername()), CustomAttributeKeys.USER_LOCATION_INDUSTRY.getKeyName(), institution);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -287,7 +298,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
InputStream myInputStream = entity.getContent();
|
||||
try {
|
||||
String jsonText = IOUtils.toString(myInputStream, "UTF-8");
|
||||
_log.debug("LinkedIn response: " + jsonText);
|
||||
logger.debug("LinkedIn response: " + jsonText);
|
||||
if (jsonText == null)
|
||||
return null;
|
||||
|
||||
|
@ -336,7 +347,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
// add request header as in the documentation, @see https://developer.linkedin.com/documents/authentication
|
||||
request.addHeader("Authorization", "Bearer " + token);
|
||||
try {
|
||||
_log.debug("Asking LinkedIn profile via http GET for " + getASLSession().getUsername());
|
||||
logger.debug("Asking LinkedIn profile via http GET for " + getCurrentUser(this.getThreadLocalRequest()).getUsername());
|
||||
HttpResponse httpResponse = httpClient.execute(request);
|
||||
HttpEntity entity = httpResponse.getEntity();
|
||||
|
||||
|
@ -345,14 +356,14 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
try {
|
||||
String xmlResponse = IOUtils.toString(myInputStream, "UTF-8");
|
||||
//xmlResponse = testParsing();
|
||||
_log.debug("LinkedIn xmlResponse: " + xmlResponse);
|
||||
logger.debug("LinkedIn xmlResponse: " + xmlResponse);
|
||||
|
||||
|
||||
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
|
||||
Document doc = dBuilder.parse(IOUtils.toInputStream(xmlResponse));
|
||||
|
||||
_log.debug("Parsing LinkedIn profile xmlResponse for " + getASLSession().getUsername());
|
||||
logger.debug("Parsing LinkedIn profile xmlResponse for " + getCurrentUser(this.getThreadLocalRequest()).getUsername());
|
||||
String headline = "";
|
||||
String summary = "";
|
||||
String location = "";
|
||||
|
@ -380,7 +391,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
String positions = "";
|
||||
currValue = helper.evaluate("/person/positions/position");
|
||||
int positionsNo = currValue.size();
|
||||
_log.debug("Number of positions: " + positions);
|
||||
logger.debug("Number of positions: " + positions);
|
||||
if (positionsNo > 0) {
|
||||
positions = (positionsNo > 1) ? "\n\nCurrent Positions:" : "\n\nCurrent Position:";
|
||||
for (int i = 0; i < positionsNo; i++) {
|
||||
|
@ -434,9 +445,9 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
summary += positions;
|
||||
|
||||
if (isWithinPortal()) {
|
||||
_log.debug("LinkedIn Profile gotten correctly for " + getASLSession().getUsername() + " attempting to write into DB ...");
|
||||
logger.debug("LinkedIn Profile gotten correctly for " + getCurrentUser(this.getThreadLocalRequest()).getUsername() + " attempting to write into DB ...");
|
||||
com.liferay.portal.model.User user;
|
||||
user = UserLocalServiceUtil.getUserByScreenName(SiteManagerUtil.getCompany().getCompanyId(), getASLSession().getUsername());
|
||||
user = UserLocalServiceUtil.getUserByScreenName(SiteManagerUtil.getCompany().getCompanyId(), getCurrentUser(this.getThreadLocalRequest()).getUsername());
|
||||
//headline
|
||||
if (headline.compareTo("") != 0) {
|
||||
String checkedHeadline = headline;
|
||||
|
@ -467,7 +478,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
if (pictureURL.compareTo("") != 0 && pictureURL.startsWith("http")) {
|
||||
byte[] pictureData = getUserPictureFromURL(httpClient, pictureURL);
|
||||
if (pictureData != null) {
|
||||
_log.debug("Updating Image Profile with this one: " + pictureURL);
|
||||
logger.debug("Updating Image Profile with this one: " + pictureURL);
|
||||
UserLocalServiceUtil.updatePortrait(user.getUserId(), pictureData);
|
||||
}
|
||||
}
|
||||
|
@ -479,7 +490,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
return publicProfileURL;
|
||||
else return null;
|
||||
} else {
|
||||
_log.warn("Development Mode ON, not attempting to write into DB");
|
||||
logger.warn("Development Mode ON, not attempting to write into DB");
|
||||
return "fakePublicURL";
|
||||
}
|
||||
}
|
||||
|
@ -508,7 +519,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
try {
|
||||
return IOUtils.toByteArray(httpClient.execute(request).getEntity().getContent());
|
||||
} catch (Exception e) {
|
||||
_log.error("Could not get bytes from picture URL " + e.getMessage());
|
||||
logger.error("Could not get bytes from picture URL " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
@ -520,8 +531,8 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
* @return an hashmap containing the 3 info needed
|
||||
*/
|
||||
private HashMap<String, String> getLinkedInUASInfo(){
|
||||
String scope = getASLSession().getScope();
|
||||
_log.info("Looking for a LinkedIn UAS in " + scope);
|
||||
String scope = getCurrentContext(this.getThreadLocalRequest());
|
||||
logger.info("Looking for a LinkedIn UAS in " + scope);
|
||||
String previousScope = ScopeProvider.instance.get();
|
||||
ScopeProvider.instance.set(scope);
|
||||
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||
|
@ -533,7 +544,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
ScopeProvider.instance.set(previousScope);
|
||||
|
||||
if (list.size() > 1) {
|
||||
_log.warn("Multiple LinkedIn-user-authorization Service Endpoints available in the scope, should be only one.");
|
||||
logger.warn("Multiple LinkedIn-user-authorization Service Endpoints available in the scope, should be only one.");
|
||||
return null;
|
||||
}
|
||||
else if (list.size() == 1) {
|
||||
|
@ -566,7 +577,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
* @return <code>true</code> if it is, <code>false</code> otherwise.
|
||||
*/
|
||||
private boolean isInfrastructureScope() {
|
||||
ScopeBean scope = new ScopeBean(getASLSession().getScope());
|
||||
ScopeBean scope = new ScopeBean(getCurrentContext(this.getThreadLocalRequest()));
|
||||
return scope.is(Type.INFRASTRUCTURE);
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
|
||||
package org.gcube.portlets.user.socialprofile.server.portlet;
|
||||
|
||||
import javax.portlet.GenericPortlet;
|
||||
import javax.portlet.ActionRequest;
|
||||
import javax.portlet.RenderRequest;
|
||||
import javax.portlet.ActionResponse;
|
||||
import javax.portlet.RenderResponse;
|
||||
import javax.portlet.PortletException;
|
||||
import java.io.IOException;
|
||||
import javax.portlet.PortletRequestDispatcher;
|
||||
|
||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||
import javax.portlet.ActionRequest;
|
||||
import javax.portlet.ActionResponse;
|
||||
import javax.portlet.GenericPortlet;
|
||||
import javax.portlet.PortletException;
|
||||
import javax.portlet.PortletRequestDispatcher;
|
||||
import javax.portlet.RenderRequest;
|
||||
import javax.portlet.RenderResponse;
|
||||
|
||||
/**
|
||||
* WfTemplatesPortlet Portlet Class
|
||||
|
@ -21,7 +20,6 @@ import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
|||
public class SocialProfilePortlet extends GenericPortlet {
|
||||
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
|
||||
response.setContentType("text/html");
|
||||
ScopeHelper.setContext(request);
|
||||
PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/SocialProfile_view.jsp");
|
||||
dispatcher.include(request, response);
|
||||
}
|
||||
|
|
|
@ -77,7 +77,4 @@ public class UserContext implements Serializable {
|
|||
public void setInfrastructure(boolean isInfrastructure) {
|
||||
this.isInfrastructure = isInfrastructure;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
log4j.rootLogger=DEBUG, A1
|
||||
log4j.appender.A1=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
|
||||
|
||||
# Print the date in ISO 8601 format
|
||||
log4j.appender.A1.layout.ConversionPattern=%d %-5p %c - %m%n
|
||||
|
||||
# Print only messages of level TRACE or above in the package org.gcube
|
||||
log4j.logger.org.gcube=TRACE
|
||||
log4j.logger.org.gcube.application.framework.core.session=INFO
|
||||
log4j.logger.org.gcube.contentmanager=ERROR
|
||||
log4j.logger.org.gcube.common.scope=ERROR
|
||||
log4j.logger.org.gcube.contentmanagement=ERROR
|
||||
log4j.logger.org.gcube.resources.discovery.icclient=ERROR
|
||||
log4j.logger.org.gcube.common.clients=ERROR
|
||||
log4j.logger.org.gcube.common.homelibrary.jcr=ERROR
|
||||
log4j.logger.org.gcube.application.framework.accesslogger=ERROR
|
||||
log4j.logger.org.apache.pdfbox.util.PDFStreamEngine=ERROR
|
||||
log4j.logger.org.apache.http=INFO
|
|
@ -8,13 +8,12 @@
|
|||
<!-- inherits GCUBE Widgets -->
|
||||
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
<inherits name='org.gcube.portlets.widgets.wsmail.WsMail_Widget' />
|
||||
<inherits name='org.gcube.portlets.widgets.sessionchecker.SessionChecker' />
|
||||
<inherits name='org.gcube.portal.databook.GCubeSocialNetworking' />
|
||||
<inherits name="net.eliasbalasis.tibcopagebus4gwt.tibcopagebus4gwt" />
|
||||
<inherits name="org.jsonmaker.gwt.Gwt_jsonmaker" />
|
||||
<inherits
|
||||
name="net.eliasbalasis.tibcopagebus4gwt.testsubscriber.TestSubscriber" />
|
||||
|
||||
|
||||
<!-- Bootstrap import -->
|
||||
<inherits name="com.github.gwtbootstrap.Bootstrap" />
|
||||
|
||||
|
|
|
@ -35,17 +35,6 @@
|
|||
<url-pattern>/socialprofile/WorkspaceExplorerService</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>checkServlet</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.widgets.sessionchecker.server.SessionCheckerServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>checkServlet</servlet-name>
|
||||
<url-pattern>/socialprofile/checksession</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
<!-- Default page to serve -->
|
||||
<welcome-file-list>
|
||||
<welcome-file>SocialProfile.html</welcome-file>
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
package org.gcube.portlets.user.socialprofile.test;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.gcube.portlets.user.socialprofile.server.SocialServiceImpl;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TestForDeploy {
|
||||
|
||||
@Test
|
||||
public void testUserIsTestUser() {
|
||||
SocialServiceImpl serviceImpl = new SocialServiceImpl();
|
||||
String username = serviceImpl.getDevelopmentUser();
|
||||
System.out.println("username for deploy is: " + username);
|
||||
assertTrue(username.compareTo("test.user") == 0);
|
||||
System.out.println("Test OK!");
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue