Fixed Array parameter for workflow
This commit is contained in:
parent
e9782d0801
commit
f6a73ea2b5
3
pom.xml
3
pom.xml
|
@ -231,7 +231,6 @@
|
|||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!--
|
||||
<plugin>
|
||||
<groupId>com.liferay.maven.plugins</groupId>
|
||||
<artifactId>liferay-maven-plugin</artifactId>
|
||||
|
@ -253,7 +252,7 @@
|
|||
<pluginType>portlet</pluginType>
|
||||
</configuration>
|
||||
</plugin>
|
||||
-->
|
||||
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
|
|
|
@ -386,6 +386,7 @@ public class SystemWorkspaceClientDefinition extends MVCPortlet {
|
|||
String secret = UUID.randomUUID().toString();
|
||||
List<String> scopes=retrieveScopes(userCredentials);
|
||||
DefinitionItem definitionItem = new DefinitionItem(clientId, description, username, secret,scopes);
|
||||
logger.debug("DefinitionItem: {}",definitionItem);
|
||||
InformationSystemUtils.publishSD(definitionItem, Constants.SYSTEM_WORKSPACE_CLIENT_CATEGORY,
|
||||
userCredentials.getCurrentScope());
|
||||
publishCreateSDEvent(definitionItem);
|
||||
|
@ -530,11 +531,11 @@ public class SystemWorkspaceClientDefinition extends MVCPortlet {
|
|||
* }
|
||||
*/
|
||||
|
||||
private void publishCreateSDEvent(DefinitionItem definitionItem) {
|
||||
logger.debug("Trying to send the event to create System Definition");
|
||||
private void publishCreateSDEvent(DefinitionItem definitionItem) throws Exception {
|
||||
logger.debug("Trying to send the event to create System Definition: {}",definitionItem);
|
||||
CreateSDEvent toCreate = new CreateSDEvent(definitionItem);
|
||||
toCreate.publisher.publish(toCreate);
|
||||
logger.info("Done send create event " + toCreate.getName() + " for " + toCreate.getUser());
|
||||
logger.info("Done send create event for: {}", toCreate);
|
||||
try {
|
||||
Thread.sleep(Constants.SLEEP_TIME);
|
||||
} catch (InterruptedException e) {
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
package org.gcube.portlets.admin.systemworkspaceclientdefinition.event;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portal.event.publisher.lr62.AbstractLR62EventPublisher;
|
||||
import org.gcube.portal.event.publisher.lr62.PortalEvent;
|
||||
import org.gcube.portlets.admin.systemworkspaceclientdefinition.definition.DefinitionItem;
|
||||
import org.json.simple.JSONArray;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -23,17 +27,17 @@ public class CreateSDEvent extends PortalEvent {
|
|||
|
||||
public CreateSDEventPublisher publisher;
|
||||
|
||||
public static final String NAME = "create_system_workspaceClient";
|
||||
public static final String NAME = "create_workspace_client";// "create_system_workspaceClient";
|
||||
public static final String CLIENT_ID_ENTRY = "client_id";
|
||||
//public static final String DESCRIPTION_ENTRY = "description";
|
||||
// public static final String DESCRIPTION_ENTRY = "description";
|
||||
public static final String CLIENT_SECRET_ENTRY = "client_sercret";
|
||||
public static final String CLIENT_CONTEXT_LIST = "context_list";
|
||||
|
||||
public CreateSDEvent(DefinitionItem definitionItem) {
|
||||
public CreateSDEvent(DefinitionItem definitionItem) throws Exception {
|
||||
super(NAME);
|
||||
publisher = new CreateSDEventPublisher();
|
||||
setClientId(definitionItem.getClientId());
|
||||
//setDescription(definitionItem.getDescription());
|
||||
// setDescription(definitionItem.getDescription());
|
||||
setClientSecret(definitionItem.getSecret());
|
||||
setClientContextList(definitionItem.getContextList());
|
||||
}
|
||||
|
@ -46,29 +50,35 @@ public class CreateSDEvent extends PortalEvent {
|
|||
return (String) get(CLIENT_ID_ENTRY);
|
||||
}
|
||||
|
||||
/*public void setDescription(String description) {
|
||||
set(DESCRIPTION_ENTRY, description);
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return (String) get(DESCRIPTION_ENTRY);
|
||||
}*/
|
||||
/*
|
||||
* public void setDescription(String description) { set(DESCRIPTION_ENTRY,
|
||||
* description); }
|
||||
*
|
||||
* public String getDescription() { return (String) get(DESCRIPTION_ENTRY); }
|
||||
*/
|
||||
|
||||
public void setClientSecret(String clientSecret) {
|
||||
|
||||
set(CLIENT_SECRET_ENTRY, clientSecret);
|
||||
}
|
||||
|
||||
public String getClientSecret() {
|
||||
return (String) get(CLIENT_SECRET_ENTRY);
|
||||
}
|
||||
|
||||
public void setClientContextList(List<String> clientContextList) {
|
||||
set(CLIENT_CONTEXT_LIST, clientContextList.toString());
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setClientContextList(List<String> clientContextList) throws Exception {
|
||||
if (clientContextList != null) {
|
||||
JSONArray contexts= new JSONArray();
|
||||
contexts.addAll(clientContextList);
|
||||
put(CLIENT_CONTEXT_LIST, clientContextList);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getClientContextList() {
|
||||
return (String) get(CLIENT_SECRET_ENTRY);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -93,8 +93,8 @@ public class InformationSystemUtils {
|
|||
|
||||
List<ServiceEndpoint> resources = client.submit(query);
|
||||
|
||||
for (ServiceEndpoint ssd : resources) {
|
||||
if (definitionItem.getClientId().compareTo(ssd.profile().name()) == 0) {
|
||||
for (ServiceEndpoint se : resources) {
|
||||
if (definitionItem.getClientId().compareTo(se.profile().name()) == 0) {
|
||||
StringBuilder error = new StringBuilder();
|
||||
error.append("Definition ");
|
||||
error.append(definitionItem.getClientId());
|
||||
|
@ -141,7 +141,7 @@ public class InformationSystemUtils {
|
|||
|
||||
logger.debug("Retrieved: " + resources);
|
||||
|
||||
ArrayList<DefinitionItem> ssdList = new ArrayList<DefinitionItem>();
|
||||
ArrayList<DefinitionItem> sdList = new ArrayList<DefinitionItem>();
|
||||
|
||||
for (ServiceEndpoint se : resources) {
|
||||
String username = null;
|
||||
|
@ -154,11 +154,11 @@ public class InformationSystemUtils {
|
|||
}
|
||||
DefinitionItem definitionItem = new DefinitionItem(se.profile().name(), se.profile().description(),
|
||||
username, password);
|
||||
ssdList.add(definitionItem);
|
||||
sdList.add(definitionItem);
|
||||
}
|
||||
|
||||
logger.debug("SSDList: {}", ssdList);
|
||||
return ssdList;
|
||||
logger.debug("SDList: {}", sdList);
|
||||
return sdList;
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error in discovery Endpoint in scope: " + scope);
|
||||
|
@ -232,13 +232,14 @@ public class InformationSystemUtils {
|
|||
// SecurityTokenProvider.instance.set(token);
|
||||
ScopeProvider.instance.set(rootScope);
|
||||
|
||||
// RegistryPublisher publisher = RegistryPublisherFactory.create();
|
||||
// String id = publisher.create(toPublish).id();
|
||||
RegistryPublisher publisher = RegistryPublisherFactory.create();
|
||||
//String id = publisher.create(toPublish).id();
|
||||
// logger.debug("Created new RR sent, Got from publisher: id=" + id);
|
||||
|
||||
ScopedPublisher sp = RegistryPublisherFactory.scopedPublisher();
|
||||
toPublish = sp.create(toPublish, definitionItem.getContextList());
|
||||
logger.debug("Created new RR sent, Got from publisher: id=" + toPublish.id());
|
||||
toPublish=publisher.vosCreate(toPublish, definitionItem.getContextList());
|
||||
|
||||
//ScopedPublisher sp = RegistryPublisherFactory.scopedPublisher();
|
||||
//toPublish = sp.create(toPublish, definitionItem.getContextList());
|
||||
logger.debug("Created new RR sent, Got from publisher: id=" + toPublish);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error publishing the definition on IS: {}", e.getLocalizedMessage(), e);
|
||||
|
|
Loading…
Reference in New Issue