Updated call to workflow
This commit is contained in:
parent
a33f85e84b
commit
219f049581
|
@ -384,10 +384,10 @@ public class SystemWorkspaceClientDefinition extends MVCPortlet {
|
|||
try {
|
||||
String username = clientId;
|
||||
String secret = UUID.randomUUID().toString();
|
||||
DefinitionItem definitionItem = new DefinitionItem(clientId, description, username, secret);
|
||||
List<String> scopes=retrieveScopes(userCredentials);
|
||||
DefinitionItem definitionItem = new DefinitionItem(clientId, description, username, secret,scopes);
|
||||
InformationSystemUtils.publishSD(definitionItem, Constants.SYSTEM_WORKSPACE_CLIENT_CATEGORY,
|
||||
userCredentials.getCurrentScope(),scopes);
|
||||
userCredentials.getCurrentScope());
|
||||
publishCreateSDEvent(definitionItem);
|
||||
SessionMessages.add(actionRequest, "success-definition-created");
|
||||
actionResponse.setRenderParameter("jspPage", "/html/systemworkspaceclientdefinition/view.jsp");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.gcube.portlets.admin.systemworkspaceclientdefinition.definition;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -15,12 +16,23 @@ public class DefinitionItem implements Serializable {
|
|||
private String description;
|
||||
private String username;
|
||||
private String secret;
|
||||
private List<String> contextList;
|
||||
|
||||
public DefinitionItem(String clientId) {
|
||||
super();
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public DefinitionItem(String clientId, String description, String username, String secret,
|
||||
List<String> contextList) {
|
||||
super();
|
||||
this.clientId = clientId;
|
||||
this.description = description;
|
||||
this.username = username;
|
||||
this.secret = secret;
|
||||
this.contextList = contextList;
|
||||
}
|
||||
|
||||
public DefinitionItem(String clientId, String description, String username, String secret) {
|
||||
super();
|
||||
this.clientId = clientId;
|
||||
|
@ -61,6 +73,14 @@ public class DefinitionItem implements Serializable {
|
|||
this.secret = secret;
|
||||
}
|
||||
|
||||
public List<String> getContextList() {
|
||||
return contextList;
|
||||
}
|
||||
|
||||
public void setContextList(List<String> contextList) {
|
||||
this.contextList = contextList;
|
||||
}
|
||||
|
||||
public static long getSerialversionuid() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
@ -68,6 +88,7 @@ public class DefinitionItem implements Serializable {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "DefinitionItem [clientId=" + clientId + ", description=" + description + ", username=" + username
|
||||
+ ", secret=" + secret + "]";
|
||||
+ ", secret=" + secret + ", contextList=" + contextList + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.gcube.portlets.admin.systemworkspaceclientdefinition.event;
|
||||
|
||||
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;
|
||||
|
@ -23,15 +25,17 @@ public class CreateSDEvent extends PortalEvent {
|
|||
|
||||
public static final String NAME = "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) {
|
||||
super(NAME);
|
||||
publisher = new CreateSDEventPublisher();
|
||||
setClientId(definitionItem.getClientId());
|
||||
setDescription(definitionItem.getDescription());
|
||||
//setDescription(definitionItem.getDescription());
|
||||
setClientSecret(definitionItem.getSecret());
|
||||
setClientContextList(definitionItem.getContextList());
|
||||
}
|
||||
|
||||
public void setClientId(String clientId) {
|
||||
|
@ -42,13 +46,13 @@ public class CreateSDEvent extends PortalEvent {
|
|||
return (String) get(CLIENT_ID_ENTRY);
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
/*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);
|
||||
|
@ -57,5 +61,14 @@ public class CreateSDEvent extends PortalEvent {
|
|||
public String getClientSecret() {
|
||||
return (String) get(CLIENT_SECRET_ENTRY);
|
||||
}
|
||||
|
||||
public void setClientContextList(List<String> clientContextList) {
|
||||
set(CLIENT_CONTEXT_LIST, clientContextList.toString());
|
||||
}
|
||||
|
||||
public String getClientContextList() {
|
||||
return (String) get(CLIENT_SECRET_ENTRY);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ public class InformationSystemUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static void publishSD(DefinitionItem definitionItem, String category, String rootScope, List<String> scopes) throws Exception {
|
||||
public static void publishSD(DefinitionItem definitionItem, String category, String rootScope) throws Exception {
|
||||
if (definitionItem == null)
|
||||
throw new Exception("Invalid definition: " + definitionItem);
|
||||
|
||||
|
@ -177,6 +177,9 @@ public class InformationSystemUtils {
|
|||
if (rootScope == null || rootScope.isEmpty())
|
||||
throw new Exception("Invalid scope: " + rootScope);
|
||||
|
||||
if (definitionItem == null || definitionItem.getContextList()==null||definitionItem.getContextList().isEmpty())
|
||||
throw new Exception("Invalid list of scope: " + definitionItem);
|
||||
|
||||
/*
|
||||
* if (token == null || token.isEmpty()) throw new Exception("Invalid token: " +
|
||||
* token);
|
||||
|
@ -234,7 +237,7 @@ public class InformationSystemUtils {
|
|||
// logger.debug("Created new RR sent, Got from publisher: id=" + id);
|
||||
|
||||
ScopedPublisher sp = RegistryPublisherFactory.scopedPublisher();
|
||||
toPublish = sp.create(toPublish, scopes);
|
||||
toPublish = sp.create(toPublish, definitionItem.getContextList());
|
||||
logger.debug("Created new RR sent, Got from publisher: id=" + toPublish.id());
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -48,7 +48,7 @@ public class ISTest {
|
|||
scopes.add(Constants.DEFAULT_SCOPE);
|
||||
|
||||
InformationSystemUtils.publishSD(definitionItem, Constants.SYSTEM_WORKSPACE_CLIENT_CATEGORY,
|
||||
Constants.DEFAULT_SCOPE,scopes);
|
||||
Constants.DEFAULT_SCOPE);
|
||||
assertTrue(true);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
Loading…
Reference in New Issue