|
|
|
@ -139,7 +139,7 @@ import com.liferay.portal.theme.ThemeDisplay;
|
|
|
|
|
*/
|
|
|
|
|
@SuppressWarnings("serial")
|
|
|
|
|
public class VREDeployerServiceImpl extends RemoteServiceServlet implements VredeployerService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(VREDeployerServiceImpl.class);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -147,7 +147,7 @@ public class VREDeployerServiceImpl extends RemoteServiceServlet implements Vre
|
|
|
|
|
*/
|
|
|
|
|
private static final String CALENDAR_APPID = "org.gcube.portal.calendarwrapper.GCubeCalendarHandler";
|
|
|
|
|
private static final String NEWS_FEED_APPID = "org.gcube.portlets.user.newsfeed.server.NewsServiceImpl";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected static final String ORGANIZATION_DEFAULT_LOGO = "/org/gcube/portal/custom/communitymanager/resources/default_logo.png";
|
|
|
|
|
protected static final String ORGANIZATION_DEFAULT_LOGO_URL = "http://ftp.d4science.org/apps/profiles/d4slogo.png";
|
|
|
|
|
|
|
|
|
@ -729,20 +729,35 @@ public class VREDeployerServiceImpl extends RemoteServiceServlet implements Vre
|
|
|
|
|
Organization vreCreated = createCommunityAndLayout(name);
|
|
|
|
|
if (vreCreated != null) {
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log.info("--- CREATED LAYOUTS AND COMMUNITY OK, updating Calendar Application Profile.");
|
|
|
|
|
String vreScope = getScopeByOrganizationId(""+vreCreated.getOrganizationId());
|
|
|
|
|
String vreUrl = "/group/"+vreCreated.getName().toLowerCase();
|
|
|
|
|
updateApplicationProfile(CALENDAR_APPID, vreScope, vreUrl+"/calendar");
|
|
|
|
|
updateApplicationProfile(NEWS_FEED_APPID, vreScope, vreUrl); //assumes it is deployed in the home of the VRE
|
|
|
|
|
boolean calandarAppProfileUpdated = false;
|
|
|
|
|
try {
|
|
|
|
|
calandarAppProfileUpdated = updateApplicationProfile(CALENDAR_APPID, vreScope, vreUrl+"/calendar");
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
log.error("Something wrong in updateApplicationProfile for " + CALENDAR_APPID);
|
|
|
|
|
}
|
|
|
|
|
boolean newsFeedAppProfileUpdated = false;
|
|
|
|
|
try {
|
|
|
|
|
newsFeedAppProfileUpdated = updateApplicationProfile(NEWS_FEED_APPID, vreScope, vreUrl); //assumes it is deployed in the home of the VRE
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
log.error("Something wrong in updateApplicationProfile for " + NEWS_FEED_APPID);
|
|
|
|
|
}
|
|
|
|
|
log.info("updateApplicationProfile for " + CALENDAR_APPID + "="+calandarAppProfileUpdated);
|
|
|
|
|
log.info("updateApplicationProfile for " + NEWS_FEED_APPID + "="+newsFeedAppProfileUpdated);
|
|
|
|
|
|
|
|
|
|
log.info("--- creating VRE Group Folder");
|
|
|
|
|
createVRESharedGroupFolder(vreCreated, designer, manager, description);
|
|
|
|
|
|
|
|
|
|
log.info("Trying to create VRE Group Folder through HomeLibrary ...");
|
|
|
|
|
createVRESharedGroupFolder(vreCreated, designer, manager, description);
|
|
|
|
|
|
|
|
|
|
log.info("--- createVRESharedGroupFolder OK, sending Message to designer.");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UserManager um = new LiferayUserManager();
|
|
|
|
|
UserModel userDesigner = um.getUserByScreenName(designer);
|
|
|
|
|
UserModel userManager = um.getUserByScreenName(manager);
|
|
|
|
@ -758,9 +773,9 @@ public class VREDeployerServiceImpl extends RemoteServiceServlet implements Vre
|
|
|
|
|
if (nnm.notifyMessageReceived(designer, subject))
|
|
|
|
|
log.trace("Sending Definition create notification: " + subject + " OK");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
log.info("--- Trying to share a news for this VRE");
|
|
|
|
|
//log.info("--- Trying to share a news for this VRE");
|
|
|
|
|
//shareCreatedVRENews(designer, manager, name, description);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -786,7 +801,7 @@ public class VREDeployerServiceImpl extends RemoteServiceServlet implements Vre
|
|
|
|
|
* @param vreScope the scope to add
|
|
|
|
|
* @param vreURL the absolute URL of the portlet
|
|
|
|
|
*/
|
|
|
|
|
private void updateApplicationProfile(String appId, String vreScope, String vreURL) {
|
|
|
|
|
private boolean updateApplicationProfile(String appId, String vreScope, String vreURL) {
|
|
|
|
|
|
|
|
|
|
String currScope = ScopeProvider.instance.get();
|
|
|
|
|
String scopeToQuery = PortalContext.getConfiguration().getInfrastructureName();
|
|
|
|
@ -799,10 +814,10 @@ public class VREDeployerServiceImpl extends RemoteServiceServlet implements Vre
|
|
|
|
|
query.addCondition("$resource/Profile/Body/AppId/text() eq '" + appId + "'");
|
|
|
|
|
|
|
|
|
|
DiscoveryClient<GenericResource> client = clientFor(GenericResource.class);
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
List<GenericResource> list = client.submit(query);
|
|
|
|
|
if (list == null || list.isEmpty()) {
|
|
|
|
|
log.warn("Cannot retrieve the ApplicationProfile from IS for generic resource havin <Body><AppId> = " + appId);
|
|
|
|
|
log.warn("Cannot retrieve the ApplicationProfile from IS for generic resource having <Body><AppId> = " + appId);
|
|
|
|
|
log.info("Triggering Creation of ApplicationProfile for " + appId);
|
|
|
|
|
GenericResource toCreate = new GenericResource();
|
|
|
|
|
toCreate.newProfile().name("Application Profile for " + appId);
|
|
|
|
@ -812,9 +827,9 @@ public class VREDeployerServiceImpl extends RemoteServiceServlet implements Vre
|
|
|
|
|
RegistryPublisher rp=RegistryPublisherFactory.create();
|
|
|
|
|
rp.create(toCreate);
|
|
|
|
|
log.info("Creation of ApplicationProfile for " + appId + " OK!");
|
|
|
|
|
return;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GenericResource gr = list.get(0);
|
|
|
|
|
log.debug("updating ApplicationProfile for " + gr.profile().name());
|
|
|
|
|
|
|
|
|
@ -827,12 +842,12 @@ public class VREDeployerServiceImpl extends RemoteServiceServlet implements Vre
|
|
|
|
|
elem.appendChild(fragmentNode);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
//in case no xml is entered, just text
|
|
|
|
|
log.error("errore");
|
|
|
|
|
log.error("error");
|
|
|
|
|
}
|
|
|
|
|
RegistryPublisher rp=RegistryPublisherFactory.create();
|
|
|
|
|
rp.update(gr);
|
|
|
|
|
ScopeProvider.instance.set(currScope);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -1213,7 +1228,7 @@ public class VREDeployerServiceImpl extends RemoteServiceServlet implements Vre
|
|
|
|
|
//however the VRE-Designer and the VRE-Manager persons of the VRE could be different and need to be created too
|
|
|
|
|
UserManager uman = new LiferayUserManager();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if the manager is not the one who triggered the creation
|
|
|
|
|
if (manager.compareTo(getASLSession().getUsername()) != 0) {
|
|
|
|
|