Massimiliano Assante 11 years ago
parent 461dd3ed59
commit bdc3e6274f

@ -69,6 +69,17 @@
<artifactId>aslvre</artifactId>
<version>[5.0.0-SNAPSHOT, 6.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslsocial</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>home-library</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-widgets</artifactId>
@ -83,6 +94,7 @@
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.vremanagement</groupId>

@ -29,6 +29,10 @@ import javax.xml.transform.stream.StreamSource;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.session.SessionManager;
import org.gcube.application.framework.vremanagement.vremanagement.impl.VREGeneratorEvo;
import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
import org.gcube.applicationsupportlayer.social.NotificationsManager;
import org.gcube.common.homelibrary.home.HomeLibrary;
import org.gcube.common.homelibrary.home.workspace.Workspace;
import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
import org.gcube.portal.custom.communitymanager.PortletsIdManager;
import org.gcube.portal.custom.communitymanager.ThemesIdManager;
@ -163,7 +167,7 @@ public class VREDeployerServiceImpl extends RemoteServiceServlet implements Vre
*/
private ASLSession getASLSession() {
log.info("getVREGeneratorEvo getASLSession() : ");
HttpSession session = this.getThreadLocalRequest().getSession();
HttpSession session = this.getThreadLocalRequest().getSession();
String username = (String) session.getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
if (username == null) {
username = "massimiliano.assante";
@ -616,18 +620,18 @@ public class VREDeployerServiceImpl extends RemoteServiceServlet implements Vre
e.printStackTrace();
return false;
}
// AccessLogger log = AccessLogger.getAccessLogger();
// CreatedVRELogEntry logEntry;
// try {
// logEntry = new CreatedVRELogEntry(
// vreGenerator.getVREModel().name(),
// vreGenerator.getVREepr(),
// vreGenerator.getVREModel().designer(),
// vreGenerator.getVREModel().manager());
// log.logEntry(getASLSession().getUsername(), getASLSession().getScopeName(), logEntry);
// } catch (RemoteException e) {
// e.printStackTrace();
// }
// AccessLogger log = AccessLogger.getAccessLogger();
// CreatedVRELogEntry logEntry;
// try {
// logEntry = new CreatedVRELogEntry(
// vreGenerator.getVREModel().name(),
// vreGenerator.getVREepr(),
// vreGenerator.getVREModel().designer(),
// vreGenerator.getVREModel().manager());
// log.logEntry(getASLSession().getUsername(), getASLSession().getScopeName(), logEntry);
// } catch (RemoteException e) {
// e.printStackTrace();
// }
return true;
}
@ -670,15 +674,38 @@ public class VREDeployerServiceImpl extends RemoteServiceServlet implements Vre
}
if (report.getStatus() == Status.Finished) {
System.out.println("--- Create VRE COMPLETED, CREATING LAYOUTS AND COMMUNITY ... ");
log.info("--- Create VRE COMPLETED, CREATING LAYOUTS AND COMMUNITY ... ");
String name = "";
try {
name = vreGenerator.getVREModel().name();
} catch (RemoteException e) {
e.printStackTrace();
}
createCommunityAndLayout(name);
System.out.println("--- CREATed LAYOUTS AND COMMUNITY ---");
if (createCommunityAndLayout(name)) {
log.info("--- CREATED LAYOUTS AND COMMUNITY --- OK, sending Message to designer.");
try {
String designer = (String) getASLSession().getAttribute(DESIGNER);
String manager = (String) getASLSession().getAttribute(MANAGER);
UserManager um = new LiferayUserManager();
UserModel userDesigner = um.getUserByScreenName(designer);
UserModel userManager = um.getUserByScreenName(manager);
Workspace workspace = HomeLibrary.getUserWorkspace(getASLSession().getUsername());
ArrayList<String> toSend = new ArrayList<String>();
toSend.add(designer);
String subject = "VRE Definition approved and deployed";
String body = "Dear "+userDesigner.getFirstname()+", \n\n" + userManager.getFullname() + " has approved the deployment of the Virtual Research Environment you requested: " + name +".";
body+=".\n\nThis VRE has been deployed successfully and is already available for you on this portal. Please, check your Virtual Research Environments list.";
workspace.getWorkspaceMessageManager().sendMessageToPortalLogins(subject, body, new ArrayList<String>(), toSend);
NotificationsManager nnm = new ApplicationNotificationsManager(getASLSession());
if (nnm.notifyMessageReceived(designer, subject))
log.trace("Sending VRE Definition create notification: " + subject + " OK");
} catch (Exception e) {
}
} else
log.error("--- DANGER DANGER DANGER!!!!! -> CREATED LAYOUTS AND COMMUNITY WITH ERRORS");
}
else
setDeployingStatusOn();
@ -854,11 +881,11 @@ public class VREDeployerServiceImpl extends RemoteServiceServlet implements Vre
/**
* Creates the community and its layout in Liferay
*/
private void createCommunityAndLayout(String vreName) {
private boolean createCommunityAndLayout(String vreName) {
if (vreExists(vreName)) {
System.out.println("VRE Exists already");
return;
return false;
}
@ -919,7 +946,9 @@ public class VREDeployerServiceImpl extends RemoteServiceServlet implements Vre
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
}
/**
* Create a Regular Manager Role for the community
@ -1000,7 +1029,7 @@ public class VREDeployerServiceImpl extends RemoteServiceServlet implements Vre
InputSource inputSource = new InputSource(reader);
log.debug("***** --- Reading **** ");
try {
document = builder.parse(inputSource);

Loading…
Cancel
Save