ref 8819: Extend The Algorithms Importer to Manage Many Processes as Black Boxes
https://support.d4science.org/issues/8819 Updated the support for Processes as Black Boxes git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@150987 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
25f7b58415
commit
942471cd66
|
@ -49,7 +49,7 @@ public class StatAlgoImporterController {
|
||||||
|
|
||||||
private SimpleEventBus eventBus;
|
private SimpleEventBus eventBus;
|
||||||
private UserInfo userInfo;
|
private UserInfo userInfo;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private BorderLayoutContainer mainPanel;
|
private BorderLayoutContainer mainPanel;
|
||||||
private ProjectManager pm;
|
private ProjectManager pm;
|
||||||
|
@ -72,18 +72,17 @@ public class StatAlgoImporterController {
|
||||||
callHello();
|
callHello();
|
||||||
checkSession();
|
checkSession();
|
||||||
pm = new ProjectManager(eventBus);
|
pm = new ProjectManager(eventBus);
|
||||||
//pm.startProjectManager();
|
// pm.startProjectManager();
|
||||||
bindToEvents();
|
bindToEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void checkSession() {
|
private void checkSession() {
|
||||||
// if you do not need to something when the session expire
|
// if you do not need to something when the session expire
|
||||||
//CheckSession.getInstance().startPolling();
|
// CheckSession.getInstance().startPolling();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sessionExpiredShow() {
|
private void sessionExpiredShow() {
|
||||||
//CheckSession.showLogoutDialog();
|
// CheckSession.showLogoutDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -98,31 +97,27 @@ public class StatAlgoImporterController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void callHello() {
|
private void callHello() {
|
||||||
StatAlgoImporterServiceAsync.INSTANCE
|
StatAlgoImporterServiceAsync.INSTANCE.hello(new AsyncCallback<UserInfo>() {
|
||||||
.hello(new AsyncCallback<UserInfo>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
Log.info("No valid user found: " + caught.getMessage());
|
Log.info("No valid user found: " + caught.getMessage());
|
||||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||||
UtilsGXT3.alert("Error", "Expired Session");
|
UtilsGXT3.alert("Error", "Expired Session");
|
||||||
sessionExpiredShowDelayed();
|
sessionExpiredShowDelayed();
|
||||||
} else {
|
} else {
|
||||||
UtilsGXT3.alert(
|
UtilsGXT3.alert("Error", "No user found: " + caught.getLocalizedMessage());
|
||||||
"Error",
|
}
|
||||||
"No user found: "
|
}
|
||||||
+ caught.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(UserInfo result) {
|
public void onSuccess(UserInfo result) {
|
||||||
userInfo = result;
|
userInfo = result;
|
||||||
Log.info("Hello: " + userInfo.getUsername());
|
Log.info("Hello: " + userInfo.getUsername());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,10 +141,8 @@ public class StatAlgoImporterController {
|
||||||
Log.debug("Locale avaible:" + locale);
|
Log.debug("Locale avaible:" + locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
String currentLocaleCookie = Cookies.getCookie(LocaleInfo
|
String currentLocaleCookie = Cookies.getCookie(LocaleInfo.getLocaleCookieName());
|
||||||
.getLocaleCookieName());
|
Log.debug(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE + ":" + currentLocaleCookie);
|
||||||
Log.debug(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE + ":"
|
|
||||||
+ currentLocaleCookie);
|
|
||||||
|
|
||||||
LocaleInfo currentLocaleInfo = LocaleInfo.getCurrentLocale();
|
LocaleInfo currentLocaleInfo = LocaleInfo.getCurrentLocale();
|
||||||
Log.debug("Current Locale:" + currentLocaleInfo.getLocaleName());
|
Log.debug("Current Locale:" + currentLocaleInfo.getLocaleName());
|
||||||
|
@ -161,13 +154,11 @@ public class StatAlgoImporterController {
|
||||||
long nowLong = now.getTime();
|
long nowLong = now.getTime();
|
||||||
nowLong = nowLong + (1000 * 60 * 60 * 24 * 21);
|
nowLong = nowLong + (1000 * 60 * 60 * 24 * 21);
|
||||||
now.setTime(nowLong);
|
now.setTime(nowLong);
|
||||||
String cookieLang = Cookies
|
String cookieLang = Cookies.getCookie(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE);
|
||||||
.getCookie(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE);
|
|
||||||
if (cookieLang != null) {
|
if (cookieLang != null) {
|
||||||
Cookies.removeCookie(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE);
|
Cookies.removeCookie(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE);
|
||||||
}
|
}
|
||||||
Cookies.setCookie(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE,
|
Cookies.setCookie(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE, localeName, now);
|
||||||
localeName, now);
|
|
||||||
com.google.gwt.user.client.Window.Location.reload();
|
com.google.gwt.user.client.Window.Location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,21 +173,17 @@ public class StatAlgoImporterController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Bind Controller to events on bus
|
// Bind Controller to events on bus
|
||||||
private void bindToEvents() {
|
private void bindToEvents() {
|
||||||
eventBus.addHandler(SessionExpiredEvent.TYPE,
|
eventBus.addHandler(SessionExpiredEvent.TYPE, new SessionExpiredEvent.SessionExpiredEventHandler() {
|
||||||
new SessionExpiredEvent.SessionExpiredEventHandler() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSessionExpired(SessionExpiredEvent event) {
|
public void onSessionExpired(SessionExpiredEvent event) {
|
||||||
Log.debug("Catch Event SessionExpiredEvent");
|
Log.debug("Catch Event SessionExpiredEvent");
|
||||||
doSessionExpiredCommand(event);
|
doSessionExpiredCommand(event);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
eventBus.addHandler(StatAlgoImporterRibbonEvent.TYPE,
|
eventBus.addHandler(StatAlgoImporterRibbonEvent.TYPE,
|
||||||
new StatAlgoImporterRibbonEvent.StatRunnerRibbonEventHandler() {
|
new StatAlgoImporterRibbonEvent.StatRunnerRibbonEventHandler() {
|
||||||
|
@ -209,74 +196,61 @@ public class StatAlgoImporterController {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
eventBus.addHandler(MainCodeSetEvent.TYPE,
|
eventBus.addHandler(MainCodeSetEvent.TYPE, new MainCodeSetEvent.MainCodeSetEventHandler() {
|
||||||
new MainCodeSetEvent.MainCodeSetEventHandler() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMainCodeSet(MainCodeSetEvent event) {
|
public void onMainCodeSet(MainCodeSetEvent event) {
|
||||||
Log.debug("Catch MainCodeSetEvent");
|
Log.debug("Catch MainCodeSetEvent");
|
||||||
doMainCodeSetCommand(event);
|
doMainCodeSetCommand(event);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
eventBus.addHandler(BinaryCodeSetEvent.TYPE,
|
eventBus.addHandler(BinaryCodeSetEvent.TYPE, new BinaryCodeSetEvent.BinaryCodeSetEventHandler() {
|
||||||
new BinaryCodeSetEvent.BinaryCodeSetEventHandler() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBinaryCodeSet(BinaryCodeSetEvent event) {
|
public void onBinaryCodeSet(BinaryCodeSetEvent event) {
|
||||||
Log.debug("Catch BinaryCodeSetEvent");
|
Log.debug("Catch BinaryCodeSetEvent");
|
||||||
doBinaryCodeSetCommand(event);
|
doBinaryCodeSetCommand(event);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
eventBus.addHandler(DeleteItemEvent.TYPE, new DeleteItemEvent.DeleteItemEventHandler() {
|
||||||
eventBus.addHandler(DeleteItemEvent.TYPE,
|
|
||||||
new DeleteItemEvent.DeleteItemEventHandler() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDelete(DeleteItemEvent event) {
|
public void onDelete(DeleteItemEvent event) {
|
||||||
Log.debug("Catch DeleteItemEvent");
|
Log.debug("Catch DeleteItemEvent");
|
||||||
doDeleteItemCommand(event);
|
doDeleteItemCommand(event);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
eventBus.addHandler(InputReadyEvent.TYPE,
|
eventBus.addHandler(InputReadyEvent.TYPE, new InputReadyEvent.InputReadyEventHandler() {
|
||||||
new InputReadyEvent.InputReadyEventHandler() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInputReady(InputReadyEvent event) {
|
public void onInputReady(InputReadyEvent event) {
|
||||||
Log.debug("Catch InputReadyEvent");
|
Log.debug("Catch InputReadyEvent");
|
||||||
doInputReadyCommand(event);
|
doInputReadyCommand(event);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
eventBus.addHandler(NewCodeEvent.TYPE,
|
eventBus.addHandler(NewCodeEvent.TYPE, new NewCodeEvent.NewCodeEventHandler() {
|
||||||
new NewCodeEvent.NewCodeEventHandler() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSet(NewCodeEvent event) {
|
public void onSet(NewCodeEvent event) {
|
||||||
Log.debug("Catch SaveNewMainCodeEvent");
|
Log.debug("Catch SaveNewMainCodeEvent");
|
||||||
doSetNewMainCodeEvent(event);
|
doSetNewMainCodeEvent(event);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void doMenuCommand(StatAlgoImporterRibbonEvent event) {
|
private void doMenuCommand(StatAlgoImporterRibbonEvent event) {
|
||||||
StatAlgoImporterRibbonType eventType = event.getStatRunnerRibbonType();
|
StatAlgoImporterRibbonType eventType = event.getStatRunnerRibbonType();
|
||||||
|
@ -300,7 +274,7 @@ public class StatAlgoImporterController {
|
||||||
break;
|
break;
|
||||||
case RESOURCE_GITHUB:
|
case RESOURCE_GITHUB:
|
||||||
showGitHubWizard();
|
showGitHubWizard();
|
||||||
break;
|
break;
|
||||||
case SOFTWARE_CREATE:
|
case SOFTWARE_CREATE:
|
||||||
softwareCreateRequest();
|
softwareCreateRequest();
|
||||||
break;
|
break;
|
||||||
|
@ -322,21 +296,17 @@ public class StatAlgoImporterController {
|
||||||
private void showHelp() {
|
private void showHelp() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
StatAlgoImporterResources.INSTANCE.wikiLink().getText(
|
StatAlgoImporterResources.INSTANCE.wikiLink().getText(new ResourceCallback<TextResource>() {
|
||||||
new ResourceCallback<TextResource>() {
|
public void onError(ResourceException e) {
|
||||||
public void onError(ResourceException e) {
|
Log.error("Error retrieving wiki link!: " + e.getLocalizedMessage());
|
||||||
Log.error("Error retrieving wiki link!: "
|
UtilsGXT3.alert("Error", "Error retrieving wiki link!");
|
||||||
+ e.getLocalizedMessage());
|
}
|
||||||
UtilsGXT3.alert("Error",
|
|
||||||
"Error retrieving wiki link!");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onSuccess(TextResource r) {
|
public void onSuccess(TextResource r) {
|
||||||
String s = r.getText();
|
String s = r.getText();
|
||||||
Window.open(s,
|
Window.open(s, "Statistical Algorithms Importer Wiki", "");
|
||||||
"Statistical Algorithms Importer Wiki", "");
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
} catch (ResourceException e) {
|
} catch (ResourceException e) {
|
||||||
Log.error("Error retrieving wiki link!: " + e.getLocalizedMessage());
|
Log.error("Error retrieving wiki link!: " + e.getLocalizedMessage());
|
||||||
UtilsGXT3.alert("Error", "Error retrieving wiki link!");
|
UtilsGXT3.alert("Error", "Error retrieving wiki link!");
|
||||||
|
@ -347,6 +317,13 @@ public class StatAlgoImporterController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doInputReadyCommand(InputReadyEvent event) {
|
private void doInputReadyCommand(InputReadyEvent event) {
|
||||||
|
if (!event.isValidData()) {
|
||||||
|
if (monitor != null) {
|
||||||
|
monitor.hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (inputRequestType) {
|
switch (inputRequestType) {
|
||||||
case Save:
|
case Save:
|
||||||
pm.saveProject(event.getInputData(), monitor);
|
pm.saveProject(event.getInputData(), monitor);
|
||||||
|
@ -377,11 +354,9 @@ public class StatAlgoImporterController {
|
||||||
|
|
||||||
private void softwareCreateRequest() {
|
private void softwareCreateRequest() {
|
||||||
|
|
||||||
final ConfirmMessageBox mb = new ConfirmMessageBox(
|
final ConfirmMessageBox mb = new ConfirmMessageBox("Warning",
|
||||||
"Warning",
|
|
||||||
"The creation of new software will overwrite the possible"
|
"The creation of new software will overwrite the possible"
|
||||||
+ " previous version and will require publication again."
|
+ " previous version and will require publication again." + " Do you want to proceed anyway?");
|
||||||
+ " Do you want to proceed anyway?");
|
|
||||||
mb.addDialogHideHandler(new DialogHideHandler() {
|
mb.addDialogHideHandler(new DialogHideHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -410,7 +385,7 @@ public class StatAlgoImporterController {
|
||||||
pm.softwarePublish();
|
pm.softwarePublish();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void softwareRepackage() {
|
private void softwareRepackage() {
|
||||||
pm.softwareRepackage();
|
pm.softwareRepackage();
|
||||||
|
|
||||||
|
@ -426,10 +401,10 @@ public class StatAlgoImporterController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showGitHubWizard(){
|
private void showGitHubWizard() {
|
||||||
pm.addGitHubProject();
|
pm.addGitHubProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showAddResourceDialog() {
|
private void showAddResourceDialog() {
|
||||||
pm.addResource();
|
pm.addResource();
|
||||||
}
|
}
|
||||||
|
@ -437,20 +412,20 @@ public class StatAlgoImporterController {
|
||||||
private void doMainCodeSetCommand(MainCodeSetEvent event) {
|
private void doMainCodeSetCommand(MainCodeSetEvent event) {
|
||||||
ItemDescription mainCodeItemDesc = event.getItemDescription();
|
ItemDescription mainCodeItemDesc = event.getItemDescription();
|
||||||
if (mainCodeItemDesc != null && mainCodeItemDesc.getId() != null) {
|
if (mainCodeItemDesc != null && mainCodeItemDesc.getId() != null) {
|
||||||
mainCodeItemDescription=mainCodeItemDesc;
|
mainCodeItemDescription = mainCodeItemDesc;
|
||||||
inputRequestType = InputRequestType.MainCodeSet;
|
inputRequestType = InputRequestType.MainCodeSet;
|
||||||
InputRequestEvent inputRequestEvent = new InputRequestEvent();
|
InputRequestEvent inputRequestEvent = new InputRequestEvent();
|
||||||
eventBus.fireEvent(inputRequestEvent);
|
eventBus.fireEvent(inputRequestEvent);
|
||||||
Log.debug("ProjectMainCodeSetRequest: " + inputRequestEvent);
|
Log.debug("ProjectMainCodeSetRequest: " + inputRequestEvent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doBinaryCodeSetCommand(BinaryCodeSetEvent event) {
|
private void doBinaryCodeSetCommand(BinaryCodeSetEvent event) {
|
||||||
ItemDescription binaryCodeItemDesc = event.getItemDescription();
|
ItemDescription binaryCodeItemDesc = event.getItemDescription();
|
||||||
if (binaryCodeItemDesc != null && binaryCodeItemDesc.getId() != null) {
|
if (binaryCodeItemDesc != null && binaryCodeItemDesc.getId() != null) {
|
||||||
binaryCodeItemDescription=binaryCodeItemDesc;
|
binaryCodeItemDescription = binaryCodeItemDesc;
|
||||||
inputRequestType = InputRequestType.BinaryCodeSet;
|
inputRequestType = InputRequestType.BinaryCodeSet;
|
||||||
InputRequestEvent inputRequestEvent = new InputRequestEvent();
|
InputRequestEvent inputRequestEvent = new InputRequestEvent();
|
||||||
eventBus.fireEvent(inputRequestEvent);
|
eventBus.fireEvent(inputRequestEvent);
|
||||||
|
@ -458,7 +433,6 @@ public class StatAlgoImporterController {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void doSetNewMainCodeEvent(NewCodeEvent event) {
|
private void doSetNewMainCodeEvent(NewCodeEvent event) {
|
||||||
monitor = new StatAlgoImporterMonitor();
|
monitor = new StatAlgoImporterMonitor();
|
||||||
|
@ -489,8 +463,7 @@ public class StatAlgoImporterController {
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private void asyncCodeLoadingFailed(Throwable reason) {
|
private void asyncCodeLoadingFailed(Throwable reason) {
|
||||||
Log.error("Async code loading failed", reason);
|
Log.error("Async code loading failed", reason);
|
||||||
eventBus.fireEvent(new SessionExpiredEvent(
|
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,17 +36,14 @@ public class CodeParser {
|
||||||
String[] varDescription = parameter.split("<-");
|
String[] varDescription = parameter.split("<-");
|
||||||
String checkDataTypeValue = varDescription[1].trim();
|
String checkDataTypeValue = varDescription[1].trim();
|
||||||
if (checkDataTypeValue.endsWith(";"))
|
if (checkDataTypeValue.endsWith(";"))
|
||||||
checkDataTypeValue = checkDataTypeValue.substring(0,
|
checkDataTypeValue = checkDataTypeValue.substring(0, checkDataTypeValue.length() - 1);
|
||||||
checkDataTypeValue.length() - 1);
|
|
||||||
String defaultValue = varDescription[1].trim();
|
String defaultValue = varDescription[1].trim();
|
||||||
if (defaultValue.endsWith(";"))
|
if (defaultValue.endsWith(";"))
|
||||||
defaultValue = defaultValue.substring(0,
|
defaultValue = defaultValue.substring(0, defaultValue.length() - 1);
|
||||||
defaultValue.length() - 1);
|
|
||||||
if (defaultValue.startsWith("\""))
|
if (defaultValue.startsWith("\""))
|
||||||
defaultValue = defaultValue.substring(1);
|
defaultValue = defaultValue.substring(1);
|
||||||
if (defaultValue.endsWith("\""))
|
if (defaultValue.endsWith("\""))
|
||||||
defaultValue = defaultValue.substring(0,
|
defaultValue = defaultValue.substring(0, defaultValue.length() - 1);
|
||||||
defaultValue.length() - 1);
|
|
||||||
String[] def = defaultValue.split("\"");
|
String[] def = defaultValue.split("\"");
|
||||||
if (def.length > 2) {
|
if (def.length > 2) {
|
||||||
defaultValue = def[0];
|
defaultValue = def[0];
|
||||||
|
@ -55,31 +52,25 @@ public class CodeParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ioType.compareTo(IOType.OUTPUT) == 0) {
|
if (ioType.compareTo(IOType.OUTPUT) == 0) {
|
||||||
selectedRowsVariables = new InputOutputVariables(
|
selectedRowsVariables = new InputOutputVariables(varDescription[0].trim(), varDescription[0].trim(),
|
||||||
varDescription[0].trim(), varDescription[0].trim(),
|
|
||||||
defaultValue, DataType.FILE, ioType, parameter);
|
defaultValue, DataType.FILE, ioType, parameter);
|
||||||
} else {
|
} else {
|
||||||
selectedRowsVariables = new InputOutputVariables(
|
selectedRowsVariables = new InputOutputVariables(varDescription[0].trim(), varDescription[0].trim(),
|
||||||
varDescription[0].trim(), varDescription[0].trim(),
|
defaultValue, checkDataType(checkDataTypeValue), ioType, parameter);
|
||||||
defaultValue, checkDataType(checkDataTypeValue),
|
|
||||||
ioType, parameter);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (parameter.contains("=")) {
|
if (parameter.contains("=")) {
|
||||||
String[] varDescription = parameter.split("=");
|
String[] varDescription = parameter.split("=");
|
||||||
String checkDataTypeValue = varDescription[1].trim();
|
String checkDataTypeValue = varDescription[1].trim();
|
||||||
if (checkDataTypeValue.endsWith(";"))
|
if (checkDataTypeValue.endsWith(";"))
|
||||||
checkDataTypeValue = checkDataTypeValue.substring(0,
|
checkDataTypeValue = checkDataTypeValue.substring(0, checkDataTypeValue.length() - 1);
|
||||||
checkDataTypeValue.length() - 1);
|
|
||||||
String defaultValue = varDescription[1].trim();
|
String defaultValue = varDescription[1].trim();
|
||||||
if (defaultValue.endsWith(";"))
|
if (defaultValue.endsWith(";"))
|
||||||
defaultValue = defaultValue.substring(0,
|
defaultValue = defaultValue.substring(0, defaultValue.length() - 1);
|
||||||
defaultValue.length() - 1);
|
|
||||||
if (defaultValue.startsWith("\""))
|
if (defaultValue.startsWith("\""))
|
||||||
defaultValue = defaultValue.substring(1);
|
defaultValue = defaultValue.substring(1);
|
||||||
if (defaultValue.endsWith("\""))
|
if (defaultValue.endsWith("\""))
|
||||||
defaultValue = defaultValue.substring(0,
|
defaultValue = defaultValue.substring(0, defaultValue.length() - 1);
|
||||||
defaultValue.length() - 1);
|
|
||||||
String[] def = defaultValue.split("\"");
|
String[] def = defaultValue.split("\"");
|
||||||
if (def.length > 2) {
|
if (def.length > 2) {
|
||||||
defaultValue = def[0];
|
defaultValue = def[0];
|
||||||
|
@ -89,14 +80,11 @@ public class CodeParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ioType.compareTo(IOType.OUTPUT) == 0) {
|
if (ioType.compareTo(IOType.OUTPUT) == 0) {
|
||||||
selectedRowsVariables = new InputOutputVariables(
|
selectedRowsVariables = new InputOutputVariables(varDescription[0].trim(), varDescription[0].trim(),
|
||||||
varDescription[0].trim(), varDescription[0].trim(),
|
|
||||||
defaultValue, DataType.FILE, ioType, parameter);
|
defaultValue, DataType.FILE, ioType, parameter);
|
||||||
} else {
|
} else {
|
||||||
selectedRowsVariables = new InputOutputVariables(
|
selectedRowsVariables = new InputOutputVariables(varDescription[0].trim(), varDescription[0].trim(),
|
||||||
varDescription[0].trim(), varDescription[0].trim(),
|
defaultValue, checkDataType(checkDataTypeValue), ioType, parameter);
|
||||||
defaultValue, checkDataType(checkDataTypeValue),
|
|
||||||
ioType, parameter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -104,6 +92,13 @@ public class CodeParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*if (selectedRowsVariables != null) {
|
||||||
|
if (selectedRowsVariables.getName() != null && !selectedRowsVariables.getName().isEmpty()
|
||||||
|
&& selectedRowsVariables.getName().length() > 32) {
|
||||||
|
String nameLimited = selectedRowsVariables.getName().substring(0, 33);
|
||||||
|
selectedRowsVariables.setName(nameLimited);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
Log.debug("CodeParser: " + selectedRowsVariables);
|
Log.debug("CodeParser: " + selectedRowsVariables);
|
||||||
return selectedRowsVariables;
|
return selectedRowsVariables;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,23 +15,23 @@ import com.google.gwt.event.shared.HasHandlers;
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class InputReadyEvent extends
|
public class InputReadyEvent extends GwtEvent<InputReadyEvent.InputReadyEventHandler> {
|
||||||
GwtEvent<InputReadyEvent.InputReadyEventHandler> {
|
|
||||||
|
|
||||||
public static Type<InputReadyEventHandler> TYPE = new Type<InputReadyEventHandler>();
|
public static Type<InputReadyEventHandler> TYPE = new Type<InputReadyEventHandler>();
|
||||||
private InputData inputData;
|
private InputData inputData;
|
||||||
|
private boolean validData;
|
||||||
|
|
||||||
public interface InputReadyEventHandler extends EventHandler {
|
public interface InputReadyEventHandler extends EventHandler {
|
||||||
void onInputReady(InputReadyEvent event);
|
void onInputReady(InputReadyEvent event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface HasInputReadyEventHandler extends HasHandlers {
|
public interface HasInputReadyEventHandler extends HasHandlers {
|
||||||
public HandlerRegistration addInputReadyEventHandler(
|
public HandlerRegistration addInputReadyEventHandler(InputReadyEventHandler handler);
|
||||||
InputReadyEventHandler handler);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputReadyEvent(InputData inputData) {
|
public InputReadyEvent(InputData inputData, boolean validData) {
|
||||||
this.inputData = inputData;
|
this.inputData = inputData;
|
||||||
|
this.validData = validData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -48,8 +48,7 @@ public class InputReadyEvent extends
|
||||||
return TYPE;
|
return TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void fire(HasHandlers source,
|
public static void fire(HasHandlers source, InputReadyEvent inputSaveReadyEvent) {
|
||||||
InputReadyEvent inputSaveReadyEvent) {
|
|
||||||
source.fireEvent(inputSaveReadyEvent);
|
source.fireEvent(inputSaveReadyEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,10 +56,13 @@ public class InputReadyEvent extends
|
||||||
return inputData;
|
return inputData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public boolean isValidData() {
|
||||||
public String toString() {
|
return validData;
|
||||||
return "InputReadyEvent [inputData=" + inputData + "]";
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "InputReadyEvent [inputData=" + inputData + ", validData=" + validData + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputReadyEvent;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputReadyEvent;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.utils.UtilsGXT3;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputData;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputData;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
|
@ -27,8 +28,7 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
private InterpreterInfoPanel interpreterInfoPanel;
|
private InterpreterInfoPanel interpreterInfoPanel;
|
||||||
private ProjectInfoPanel projectInfoPanel;
|
private ProjectInfoPanel projectInfoPanel;
|
||||||
|
|
||||||
public InputVariableTabPanel(EventBus eventBus,
|
public InputVariableTabPanel(EventBus eventBus, InputVariablePanel toolBoxPanel) {
|
||||||
InputVariablePanel toolBoxPanel) {
|
|
||||||
super();
|
super();
|
||||||
Log.debug("Create InpuntVariableTabPanel");
|
Log.debug("Create InpuntVariableTabPanel");
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
@ -83,13 +83,12 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
interpreterInfoPanel.update(project);
|
interpreterInfoPanel.update(project);
|
||||||
forceLayout();
|
forceLayout();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.error("Error in InputVariableTabPanel: "
|
Log.error("Error in InputVariableTabPanel: " + e.getLocalizedMessage());
|
||||||
+ e.getLocalizedMessage());
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBinaryCode(Project project) {
|
public void setBinaryCode(Project project) {
|
||||||
try {
|
try {
|
||||||
globalVariablesPanel.update(project);
|
globalVariablesPanel.update(project);
|
||||||
|
@ -98,13 +97,11 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
interpreterInfoPanel.update(project);
|
interpreterInfoPanel.update(project);
|
||||||
forceLayout();
|
forceLayout();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.error("Error in InputVariableTabPanel: "
|
Log.error("Error in InputVariableTabPanel: " + e.getLocalizedMessage());
|
||||||
+ e.getLocalizedMessage());
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updateTabs(Project project) {
|
public void updateTabs(Project project) {
|
||||||
try {
|
try {
|
||||||
|
@ -114,37 +111,39 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
projectInfoPanel.update(project);
|
projectInfoPanel.update(project);
|
||||||
forceLayout();
|
forceLayout();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.error("Error in InputVariableTabPanel: "
|
Log.error("Error in InputVariableTabPanel: " + e.getLocalizedMessage());
|
||||||
+ e.getLocalizedMessage());
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void requestInput() {
|
public void requestInput() {
|
||||||
|
|
||||||
InputData inputData = new InputData();
|
InputData inputData = new InputData();
|
||||||
|
boolean valid=true;
|
||||||
|
|
||||||
if (globalVariablesPanel != null) {
|
if (globalVariablesPanel != null) {
|
||||||
inputData.setListGlobalVariables(globalVariablesPanel
|
inputData.setListGlobalVariables(globalVariablesPanel.getGlobalVariables());
|
||||||
.getGlobalVariables());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inputOutputVariablesPanel != null) {
|
if (inputOutputVariablesPanel != null) {
|
||||||
inputData.setListInputOutputVariables(inputOutputVariablesPanel
|
inputData.setListInputOutputVariables(inputOutputVariablesPanel.getInputOutputVariables());
|
||||||
.getInputOutputVariables());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interpreterInfoPanel != null) {
|
if (interpreterInfoPanel != null) {
|
||||||
inputData.setInterpreterInfo(interpreterInfoPanel
|
inputData.setInterpreterInfo(interpreterInfoPanel.getInterpreterInfo());
|
||||||
.getInterpreterInfo());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (projectInfoPanel != null) {
|
|
||||||
inputData.setProjectInfo(projectInfoPanel
|
|
||||||
.getProjectInfo());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
InputReadyEvent inputReadyEvent = new InputReadyEvent(
|
try {
|
||||||
inputData);
|
if (projectInfoPanel != null) {
|
||||||
|
inputData.setProjectInfo(projectInfoPanel.getProjectInfo());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.error("Attention invalid project info: " + e.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Attention", e.getLocalizedMessage());
|
||||||
|
valid=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
InputReadyEvent inputReadyEvent = new InputReadyEvent(inputData,valid);
|
||||||
eventBus.fireEvent(inputReadyEvent);
|
eventBus.fireEvent(inputReadyEvent);
|
||||||
Log.debug("Fired InputReadyEvent");
|
Log.debug("Fired InputReadyEvent");
|
||||||
|
|
||||||
|
@ -152,8 +151,7 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
|
|
||||||
// Add
|
// Add
|
||||||
private void addInputOutputVariablesPanel(Project project) {
|
private void addInputOutputVariablesPanel(Project project) {
|
||||||
TabItemConfig inputOutputPanelItemConf = new TabItemConfig(
|
TabItemConfig inputOutputPanelItemConf = new TabItemConfig(msgs.inputOutputVariables(), false);
|
||||||
msgs.inputOutputVariables(), false);
|
|
||||||
|
|
||||||
inputOutputVariablesPanel = new InputOutputVariablesPanel(project, eventBus);
|
inputOutputVariablesPanel = new InputOutputVariablesPanel(project, eventBus);
|
||||||
inputOutputVariablesPanel.setHeaderVisible(false);
|
inputOutputVariablesPanel.setHeaderVisible(false);
|
||||||
|
@ -162,38 +160,32 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addGlobalVariablesPanel(Project project) {
|
private void addGlobalVariablesPanel(Project project) {
|
||||||
TabItemConfig globalVariablePanelItemConf = new TabItemConfig(
|
TabItemConfig globalVariablePanelItemConf = new TabItemConfig(msgs.globalVariables(), false);
|
||||||
msgs.globalVariables(), false);
|
|
||||||
|
|
||||||
globalVariablesPanel = new GlobalVariablesPanel(project,
|
globalVariablesPanel = new GlobalVariablesPanel(project, eventBus);
|
||||||
eventBus);
|
|
||||||
globalVariablesPanel.setHeaderVisible(false);
|
globalVariablesPanel.setHeaderVisible(false);
|
||||||
add(globalVariablesPanel, globalVariablePanelItemConf);
|
add(globalVariablesPanel, globalVariablePanelItemConf);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addInterpreterInfoPanel(Project project) {
|
private void addInterpreterInfoPanel(Project project) {
|
||||||
TabItemConfig interpreterInfoPanelItemConf = new TabItemConfig(
|
TabItemConfig interpreterInfoPanelItemConf = new TabItemConfig(msgs.interpreterInfo(), false);
|
||||||
msgs.interpreterInfo(), false);
|
|
||||||
|
|
||||||
interpreterInfoPanel = new InterpreterInfoPanel(project, eventBus);
|
interpreterInfoPanel = new InterpreterInfoPanel(project, eventBus);
|
||||||
interpreterInfoPanel.setHeaderVisible(false);
|
interpreterInfoPanel.setHeaderVisible(false);
|
||||||
add(interpreterInfoPanel, interpreterInfoPanelItemConf);
|
add(interpreterInfoPanel, interpreterInfoPanelItemConf);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addProjectInfoPanel(Project project) {
|
private void addProjectInfoPanel(Project project) {
|
||||||
TabItemConfig projectInfoPanelItemConf = new TabItemConfig(
|
TabItemConfig projectInfoPanelItemConf = new TabItemConfig(msgs.projectInfo(), false);
|
||||||
msgs.projectInfo(), false);
|
|
||||||
|
|
||||||
projectInfoPanel = new ProjectInfoPanel(project, eventBus);
|
projectInfoPanel = new ProjectInfoPanel(project, eventBus);
|
||||||
projectInfoPanel.setHeaderVisible(false);
|
projectInfoPanel.setHeaderVisible(false);
|
||||||
add(projectInfoPanel, projectInfoPanelItemConf);
|
add(projectInfoPanel, projectInfoPanelItemConf);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addSelectedRowsVariable(
|
public void addSelectedRowsVariable(InputOutputVariables inputOutputVariable) {
|
||||||
InputOutputVariables inputOutputVariable) {
|
|
||||||
setActiveWidget(inputOutputVariablesPanel);
|
setActiveWidget(inputOutputVariablesPanel);
|
||||||
inputOutputVariablesPanel.addNewInputOutputVariables(inputOutputVariable);
|
inputOutputVariablesPanel.addNewInputOutputVariables(inputOutputVariable);
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||||
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||||
import com.sencha.gxt.widget.core.client.form.TextField;
|
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.validator.MaxLengthValidator;
|
||||||
import com.sencha.gxt.widget.core.client.form.validator.RegExValidator;
|
import com.sencha.gxt.widget.core.client.form.validator.RegExValidator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,19 +32,12 @@ public class ProjectInfoPanel extends ContentPanel {
|
||||||
private TextField algorithmName;
|
private TextField algorithmName;
|
||||||
private TextField algorithmDescription;
|
private TextField algorithmDescription;
|
||||||
private TextField algorithmCategory;
|
private TextField algorithmCategory;
|
||||||
//private ListStore<RequestedVRE> storeRequestedVRE;
|
|
||||||
//private Grid<RequestedVRE> gridRequestedVRE;
|
|
||||||
//private GridRowEditing<RequestedVRE> gridRequestedVREEditing;
|
|
||||||
//private TextButton btnAdd;
|
|
||||||
//private boolean addStatus;
|
|
||||||
//private int seq = 0;
|
|
||||||
|
|
||||||
public ProjectInfoPanel(Project project, EventBus eventBus) {
|
public ProjectInfoPanel(Project project, EventBus eventBus) {
|
||||||
super();
|
super();
|
||||||
Log.debug("ProjectInfoPanel");
|
Log.debug("ProjectInfoPanel");
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
|
||||||
// msgs = GWT.create(ServiceCategoryMessages.class);
|
|
||||||
try {
|
try {
|
||||||
init();
|
init();
|
||||||
create(project);
|
create(project);
|
||||||
|
@ -65,8 +59,8 @@ public class ProjectInfoPanel extends ContentPanel {
|
||||||
//
|
//
|
||||||
algorithmName = new TextField();
|
algorithmName = new TextField();
|
||||||
algorithmName.setAllowBlank(false);
|
algorithmName.setAllowBlank(false);
|
||||||
algorithmName.addValidator(new RegExValidator("^[a-zA-Z0-9_]*$",
|
algorithmName.addValidator(
|
||||||
"Attention only characters a-z,A-Z,0-9 are allowed"));
|
new RegExValidator("^[a-zA-Z0-9_]*$", "Attention only characters a-z,A-Z,0-9 are allowed"));
|
||||||
algorithmName.setEmptyText("Enter name...");
|
algorithmName.setEmptyText("Enter name...");
|
||||||
algorithmName.addChangeHandler(new ChangeHandler() {
|
algorithmName.addChangeHandler(new ChangeHandler() {
|
||||||
|
|
||||||
|
@ -84,224 +78,34 @@ public class ProjectInfoPanel extends ContentPanel {
|
||||||
algorithmDescription = new TextField();
|
algorithmDescription = new TextField();
|
||||||
algorithmDescription.setAllowBlank(false);
|
algorithmDescription.setAllowBlank(false);
|
||||||
algorithmDescription.setEmptyText("Enter description...");
|
algorithmDescription.setEmptyText("Enter description...");
|
||||||
algorithmDescription.addValidator(new RegExValidator("^[^\"]*$",
|
algorithmDescription.addValidator(new RegExValidator("^[^\"]*$", "Attention character \" is not allowed"));
|
||||||
"Attention character \" is not allowed"));
|
FieldLabel descriptionLabel = new FieldLabel(algorithmDescription, "Description");
|
||||||
FieldLabel descriptionLabel = new FieldLabel(algorithmDescription,
|
|
||||||
"Description");
|
|
||||||
descriptionLabel.setLabelWidth(LABAEL_WIDTH);
|
descriptionLabel.setLabelWidth(LABAEL_WIDTH);
|
||||||
|
|
||||||
//
|
//
|
||||||
algorithmCategory = new TextField();
|
algorithmCategory = new TextField();
|
||||||
algorithmCategory.setAllowBlank(false);
|
algorithmCategory.setAllowBlank(false);
|
||||||
algorithmCategory.setEmptyText("Enter description...");
|
algorithmCategory.setEmptyText("Enter description...");
|
||||||
algorithmCategory.addValidator(new RegExValidator("^[^\"]*$",
|
algorithmCategory.addValidator(new RegExValidator("^[^\"]*$", "Attention character \" is not allowed"));
|
||||||
"Attention character \" is not allowed"));
|
algorithmCategory.addValidator(new MaxLengthValidator(32));
|
||||||
FieldLabel categoryLabel = new FieldLabel(algorithmCategory, "Category");
|
FieldLabel categoryLabel = new FieldLabel(algorithmCategory, "Category");
|
||||||
categoryLabel.setLabelWidth(LABAEL_WIDTH);
|
categoryLabel.setLabelWidth(LABAEL_WIDTH);
|
||||||
|
|
||||||
// Grid
|
if (project != null && project.getInputData() != null && project.getInputData().getProjectInfo() != null) {
|
||||||
/*
|
|
||||||
RequestedVREProperties props = GWT.create(RequestedVREProperties.class);
|
|
||||||
|
|
||||||
ColumnConfig<RequestedVRE, String> nameColumn = new ColumnConfig<RequestedVRE, String>(
|
|
||||||
props.name(), 100, "Name");
|
|
||||||
// nameColumn.setMenuDisabled(true);
|
|
||||||
|
|
||||||
ColumnConfig<RequestedVRE, String> descriptionColumn = new ColumnConfig<RequestedVRE, String>(
|
|
||||||
props.description(), 100, "Description");
|
|
||||||
// descriptionColumn.setMenuDisabled(true);
|
|
||||||
|
|
||||||
ArrayList<ColumnConfig<RequestedVRE, ?>> l = new ArrayList<ColumnConfig<RequestedVRE, ?>>();
|
|
||||||
l.add(nameColumn);
|
|
||||||
l.add(descriptionColumn);
|
|
||||||
|
|
||||||
ColumnModel<RequestedVRE> columns = new ColumnModel<RequestedVRE>(l);
|
|
||||||
|
|
||||||
storeRequestedVRE = new ListStore<RequestedVRE>(props.id());*/
|
|
||||||
|
|
||||||
if (project != null && project.getInputData() != null
|
|
||||||
&& project.getInputData().getProjectInfo() != null) {
|
|
||||||
|
|
||||||
if (project.getInputData().getProjectInfo().getAlgorithmName() != null) {
|
if (project.getInputData().getProjectInfo().getAlgorithmName() != null) {
|
||||||
algorithmName.setValue(project.getInputData().getProjectInfo()
|
algorithmName.setValue(project.getInputData().getProjectInfo().getAlgorithmName());
|
||||||
.getAlgorithmName());
|
|
||||||
}
|
}
|
||||||
if (project.getInputData().getProjectInfo()
|
if (project.getInputData().getProjectInfo().getAlgorithmDescription() != null) {
|
||||||
.getAlgorithmDescription() != null) {
|
algorithmDescription.setValue(project.getInputData().getProjectInfo().getAlgorithmDescription());
|
||||||
algorithmDescription.setValue(project.getInputData()
|
|
||||||
.getProjectInfo().getAlgorithmDescription());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (project.getInputData().getProjectInfo()
|
if (project.getInputData().getProjectInfo().getAlgorithmCategory() != null) {
|
||||||
.getAlgorithmCategory() != null) {
|
algorithmCategory.setValue(project.getInputData().getProjectInfo().getAlgorithmCategory());
|
||||||
algorithmCategory.setValue(project.getInputData()
|
|
||||||
.getProjectInfo().getAlgorithmCategory());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*if (project.getInputData().getProjectInfo().getListRequestedVRE() != null) {
|
|
||||||
storeRequestedVRE.addAll(project.getInputData()
|
|
||||||
.getProjectInfo().getListRequestedVRE());
|
|
||||||
seq = project.getInputData().getProjectInfo()
|
|
||||||
.getListRequestedVRE().size();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
final GridSelectionModel<RequestedVRE> sm = new GridSelectionModel<RequestedVRE>();
|
|
||||||
sm.setSelectionMode(SelectionMode.SINGLE);
|
|
||||||
|
|
||||||
gridRequestedVRE = new Grid<RequestedVRE>(storeRequestedVRE, columns);
|
|
||||||
gridRequestedVRE.setSelectionModel(sm);
|
|
||||||
gridRequestedVRE.getView().setStripeRows(true);
|
|
||||||
gridRequestedVRE.getView().setColumnLines(true);
|
|
||||||
gridRequestedVRE.getView().setAutoExpandColumn(nameColumn);
|
|
||||||
gridRequestedVRE.getView().setAutoFill(true);
|
|
||||||
gridRequestedVRE.setBorders(false);
|
|
||||||
gridRequestedVRE.setColumnReordering(false);
|
|
||||||
|
|
||||||
// DND
|
|
||||||
GridDragSource<RequestedVRE> ds = new GridDragSource<RequestedVRE>(
|
|
||||||
gridRequestedVRE);
|
|
||||||
ds.addDragStartHandler(new DndDragStartEvent.DndDragStartHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDragStart(DndDragStartEvent event) {
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
ArrayList<RequestedVRE> draggingSelection = (ArrayList<RequestedVRE>) event
|
|
||||||
.getData();
|
|
||||||
Log.debug("Start Drag: " + draggingSelection);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
GridDropTarget<RequestedVRE> dt = new GridDropTarget<RequestedVRE>(
|
|
||||||
gridRequestedVRE);
|
|
||||||
dt.setFeedback(Feedback.BOTH);
|
|
||||||
dt.setAllowSelfAsSource(true);
|
|
||||||
|
|
||||||
// EDITING //
|
|
||||||
TextField nameColumnEditing = new TextField();
|
|
||||||
nameColumnEditing.addValidator(new RegExValidator("^[^\"]*$",
|
|
||||||
"Attention character \" is not allowed"));
|
|
||||||
TextField descriptionColumnEditing = new TextField();
|
|
||||||
descriptionColumnEditing.addValidator(new RegExValidator("^[^\"]*$",
|
|
||||||
"Attention character \" is not allowed"));
|
|
||||||
|
|
||||||
gridRequestedVREEditing = new GridRowEditing<RequestedVRE>(
|
|
||||||
gridRequestedVRE);
|
|
||||||
gridRequestedVREEditing.addEditor(nameColumn, nameColumnEditing);
|
|
||||||
gridRequestedVREEditing.addEditor(descriptionColumn,
|
|
||||||
descriptionColumnEditing);
|
|
||||||
|
|
||||||
btnAdd = new TextButton("Add");
|
|
||||||
btnAdd.setIcon(StatAlgoImporterResources.INSTANCE.add16());
|
|
||||||
btnAdd.setScale(ButtonScale.SMALL);
|
|
||||||
btnAdd.setIconAlign(IconAlign.LEFT);
|
|
||||||
btnAdd.setToolTip("Add VRE");
|
|
||||||
btnAdd.addSelectHandler(new SelectHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSelect(SelectEvent event) {
|
|
||||||
addRequestedVRE(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
TextButton btnDelete = new TextButton("Delete");
|
|
||||||
btnDelete.addSelectHandler(new SelectEvent.SelectHandler() {
|
|
||||||
public void onSelect(SelectEvent event) {
|
|
||||||
GridCell cell = gridRequestedVREEditing.getActiveCell();
|
|
||||||
int rowIndex = cell.getRow();
|
|
||||||
|
|
||||||
gridRequestedVREEditing.cancelEditing();
|
|
||||||
|
|
||||||
storeRequestedVRE.remove(rowIndex);
|
|
||||||
storeRequestedVRE.commitChanges();
|
|
||||||
|
|
||||||
gridRequestedVREEditing.getCancelButton().setVisible(true);
|
|
||||||
btnAdd.setEnabled(true);
|
|
||||||
if (addStatus) {
|
|
||||||
addStatus = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<RequestedVRE> listSelected = storeRequestedVRE.getAll();
|
|
||||||
List<RequestedVRE> listNewSelected = new ArrayList<RequestedVRE>();
|
|
||||||
for (int i = 0; i < listSelected.size(); i++) {
|
|
||||||
RequestedVRE var = listSelected.get(i);
|
|
||||||
var.setId(i);
|
|
||||||
listNewSelected.add(var);
|
|
||||||
}
|
|
||||||
|
|
||||||
storeRequestedVRE.clear();
|
|
||||||
storeRequestedVRE.addAll(listNewSelected);
|
|
||||||
storeRequestedVRE.commitChanges();
|
|
||||||
|
|
||||||
seq = listNewSelected.size();
|
|
||||||
Log.debug("Current Seq: " + seq);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
ButtonBar buttonBar = gridRequestedVREEditing.getButtonBar();
|
|
||||||
buttonBar.add(btnDelete);
|
|
||||||
|
|
||||||
gridRequestedVREEditing
|
|
||||||
.addBeforeStartEditHandler(new BeforeStartEditHandler<RequestedVRE>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBeforeStartEdit(
|
|
||||||
BeforeStartEditEvent<RequestedVRE> event) {
|
|
||||||
editingBeforeStart(event);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
gridRequestedVREEditing
|
|
||||||
.addCancelEditHandler(new CancelEditHandler<RequestedVRE>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCancelEdit(CancelEditEvent<RequestedVRE> event) {
|
|
||||||
storeRequestedVRE.rejectChanges();
|
|
||||||
btnAdd.setEnabled(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
gridRequestedVREEditing
|
|
||||||
.addCompleteEditHandler(new CompleteEditHandler<RequestedVRE>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCompleteEdit(
|
|
||||||
CompleteEditEvent<RequestedVRE> event) {
|
|
||||||
try {
|
|
||||||
if (addStatus) {
|
|
||||||
addStatus = false;
|
|
||||||
}
|
|
||||||
storeRequestedVRE.commitChanges();
|
|
||||||
|
|
||||||
gridRequestedVREEditing.getCancelButton()
|
|
||||||
.setVisible(true);
|
|
||||||
btnAdd.setEnabled(true);
|
|
||||||
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Log.error("Error: " + e.getLocalizedMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
*/
|
|
||||||
// /
|
|
||||||
|
|
||||||
|
|
||||||
//ToolBar toolBar = new ToolBar();
|
|
||||||
//toolBar.add(btnAdd, new BoxLayoutData(new Margins(0)));
|
|
||||||
|
|
||||||
//FieldLabel requestedVRELabel = new FieldLabel(toolBar, "Requested VREs");
|
|
||||||
//requestedVRELabel.setLabelWidth(LABAEL_WIDTH);
|
|
||||||
|
|
||||||
VerticalLayoutContainer vlc = new VerticalLayoutContainer();
|
VerticalLayoutContainer vlc = new VerticalLayoutContainer();
|
||||||
vlc.setAdjustForScroll(false);
|
vlc.setAdjustForScroll(false);
|
||||||
vlc.setScrollMode(ScrollMode.NONE);
|
vlc.setScrollMode(ScrollMode.NONE);
|
||||||
|
@ -309,95 +113,57 @@ public class ProjectInfoPanel extends ContentPanel {
|
||||||
vlc.add(nameLabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
vlc.add(nameLabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
vlc.add(descriptionLabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
vlc.add(descriptionLabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
vlc.add(categoryLabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
vlc.add(categoryLabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
//vlc.add(requestedVRELabel,
|
|
||||||
// new VerticalLayoutData(1, -1, new Margins(0)));
|
|
||||||
//vlc.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
|
||||||
//vlc.add(gridRequestedVRE, new VerticalLayoutData(1, 1, new Margins(0)));
|
|
||||||
|
|
||||||
add(vlc, new MarginData(new Margins(0)));
|
add(vlc, new MarginData(new Margins(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(Project project) {
|
public void update(Project project) {
|
||||||
Log.debug("Update Project Info: " + project);
|
Log.debug("Update Project Info: " + project);
|
||||||
if (project != null && project.getInputData() != null
|
if (project != null && project.getInputData() != null && project.getInputData().getProjectInfo() != null) {
|
||||||
&& project.getInputData().getProjectInfo() != null) {
|
|
||||||
|
|
||||||
if (project.getInputData().getProjectInfo().getAlgorithmName() != null) {
|
if (project.getInputData().getProjectInfo().getAlgorithmName() != null) {
|
||||||
algorithmName.setValue(project.getInputData().getProjectInfo()
|
algorithmName.setValue(project.getInputData().getProjectInfo().getAlgorithmName());
|
||||||
.getAlgorithmName());
|
|
||||||
} else {
|
} else {
|
||||||
algorithmName.clear();
|
algorithmName.clear();
|
||||||
}
|
}
|
||||||
if (project.getInputData().getProjectInfo()
|
if (project.getInputData().getProjectInfo().getAlgorithmDescription() != null) {
|
||||||
.getAlgorithmDescription() != null) {
|
algorithmDescription.setValue(project.getInputData().getProjectInfo().getAlgorithmDescription());
|
||||||
algorithmDescription.setValue(project.getInputData()
|
|
||||||
.getProjectInfo().getAlgorithmDescription());
|
|
||||||
} else {
|
} else {
|
||||||
algorithmDescription.clear();
|
algorithmDescription.clear();
|
||||||
}
|
}
|
||||||
if (project.getInputData().getProjectInfo().getAlgorithmCategory() != null) {
|
if (project.getInputData().getProjectInfo().getAlgorithmCategory() != null) {
|
||||||
algorithmCategory.setValue(project.getInputData()
|
algorithmCategory.setValue(project.getInputData().getProjectInfo().getAlgorithmCategory());
|
||||||
.getProjectInfo().getAlgorithmCategory());
|
|
||||||
} else {
|
} else {
|
||||||
algorithmCategory.clear();
|
algorithmCategory.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if (project.getInputData().getProjectInfo().getListRequestedVRE() != null) {
|
|
||||||
storeRequestedVRE.clear();
|
|
||||||
storeRequestedVRE.addAll(project.getInputData()
|
|
||||||
.getProjectInfo().getListRequestedVRE());
|
|
||||||
storeRequestedVRE.commitChanges();
|
|
||||||
seq = project.getInputData().getProjectInfo()
|
|
||||||
.getListRequestedVRE().size();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
storeRequestedVRE.clear();
|
|
||||||
storeRequestedVRE.commitChanges();
|
|
||||||
seq = 0;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
algorithmName.clear();
|
algorithmName.clear();
|
||||||
algorithmDescription.clear();
|
algorithmDescription.clear();
|
||||||
algorithmCategory.clear();
|
algorithmCategory.clear();
|
||||||
//storeRequestedVRE.clear();
|
|
||||||
//storeRequestedVRE.commitChanges();
|
|
||||||
//seq = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
public ProjectInfo getProjectInfo() throws Exception {
|
||||||
|
if(!algorithmName.validate()){
|
||||||
private void editingBeforeStart(BeforeStartEditEvent<RequestedVRE> event) {
|
throw new Exception("Invalid algorithm name");
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addRequestedVRE(SelectEvent event) {
|
|
||||||
try {
|
|
||||||
seq++;
|
|
||||||
RequestedVRE newRequestedVRE = new RequestedVRE(seq, "", "");
|
|
||||||
Log.debug("New RequestedVRE: " + newRequestedVRE);
|
|
||||||
gridRequestedVREEditing.cancelEditing();
|
|
||||||
addStatus = true;
|
|
||||||
gridRequestedVREEditing.getCancelButton().setVisible(false);
|
|
||||||
storeRequestedVRE.add(newRequestedVRE);
|
|
||||||
int row = storeRequestedVRE.indexOf(newRequestedVRE);
|
|
||||||
|
|
||||||
gridRequestedVREEditing.startEditing(new GridCell(row, 0));
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}*/
|
|
||||||
|
if(!algorithmDescription.validate()){
|
||||||
public ProjectInfo getProjectInfo() {
|
throw new Exception("Invalid algorithm description");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!algorithmCategory.validate()){
|
||||||
|
throw new Exception("Invalid algorithm category");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
String name = algorithmName.getCurrentValue();
|
String name = algorithmName.getCurrentValue();
|
||||||
String description = algorithmDescription.getCurrentValue();
|
String description = algorithmDescription.getCurrentValue();
|
||||||
String category = algorithmCategory.getCurrentValue();
|
String category = algorithmCategory.getCurrentValue();
|
||||||
//ArrayList<RequestedVRE> listRequestedVRE = new ArrayList<>(
|
|
||||||
// gridRequestedVRE.getStore().getAll());
|
|
||||||
return new ProjectInfo(name, description, category);
|
return new ProjectInfo(name, description, category);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgo
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.annotation.WPS4RParser;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.annotation.WPS4RParser;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.file.CodeReader;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.file.CodeReader;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.generator.ProjectBuilder;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.generator.ProjectBuilder;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.generator.ProjectDeploy;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.is.BuildSAIDescriptor;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.is.BuildSAIDescriptor;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.social.AlgorithmNotification;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.social.AlgorithmNotification;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.social.Recipient;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.social.Recipient;
|
||||||
|
@ -704,9 +705,8 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
||||||
project = projectBuilder.buildDeploy();
|
project = projectBuilder.buildDeploy();
|
||||||
SessionUtil.setProjectSession(httpRequest, serviceCredentials, project);
|
SessionUtil.setProjectSession(httpRequest, serviceCredentials, project);
|
||||||
ProjectArchiver.archive(project, serviceCredentials);
|
ProjectArchiver.archive(project, serviceCredentials);
|
||||||
AlgorithmNotification notify = new AlgorithmNotification(this.getThreadLocalRequest(),
|
ProjectDeploy projectDeploy=new ProjectDeploy(httpRequest, serviceCredentials, project, recipients);
|
||||||
serviceCredentials, project, recipients);
|
projectDeploy.deploy();
|
||||||
notify.run();
|
|
||||||
} else {
|
} else {
|
||||||
throw new StatAlgoImporterServiceException(
|
throw new StatAlgoImporterServiceException(
|
||||||
"The software was not created correctly try to recreate it!");
|
"The software was not created correctly try to recreate it!");
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package org.gcube.portlets.user.statisticalalgorithmsimporter.server.generator;
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.server.generator;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.Reader;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
@ -8,10 +12,13 @@ import java.nio.file.StandardOpenOption;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage.FilesStorage;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.util.ServiceCredentials;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.util.ServiceCredentials;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.info.InfoData;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InterpreterPackageInfo;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InterpreterPackageInfo;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -137,7 +144,7 @@ public class InfoGenerator {
|
||||||
if (project.getInputData().getInterpreterInfo().getVersion() != null) {
|
if (project.getInputData().getInterpreterInfo().getVersion() != null) {
|
||||||
infos.add("Interpreter Version: " + project.getInputData().getInterpreterInfo().getVersion());
|
infos.add("Interpreter Version: " + project.getInputData().getInterpreterInfo().getVersion());
|
||||||
} else {
|
} else {
|
||||||
infos.add("Interpreter Version: Any");
|
infos.add("Interpreter Version: ");
|
||||||
}
|
}
|
||||||
infos.add("");
|
infos.add("");
|
||||||
if (project.getInputData().getInterpreterInfo().getInterpreterPackagesInfo() != null
|
if (project.getInputData().getInterpreterInfo().getInterpreterPackagesInfo() != null
|
||||||
|
@ -146,7 +153,6 @@ public class InfoGenerator {
|
||||||
for (InterpreterPackageInfo info : project.getInputData().getInterpreterInfo()
|
for (InterpreterPackageInfo info : project.getInputData().getInterpreterInfo()
|
||||||
.getInterpreterPackagesInfo()) {
|
.getInterpreterPackagesInfo()) {
|
||||||
infos.add("Package Name: " + info.getName());
|
infos.add("Package Name: " + info.getName());
|
||||||
infos.add("Package Details: " + info.getDetails());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,4 +162,65 @@ public class InfoGenerator {
|
||||||
return infos;
|
return infos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InfoData readInfo() throws StatAlgoImporterServiceException {
|
||||||
|
ItemDescription infoItem = project.getProjectTarget().getProjectCompile().getIntegrationInfo();
|
||||||
|
FilesStorage filesStorage = new FilesStorage();
|
||||||
|
InputStream inputStream = filesStorage.retrieveItemOnWorkspace(serviceCredentials.getUserName(),
|
||||||
|
infoItem.getId());
|
||||||
|
Reader inputReader = new InputStreamReader(inputStream);
|
||||||
|
BufferedReader br = new BufferedReader(inputReader);
|
||||||
|
|
||||||
|
String thisLine = null;
|
||||||
|
InfoData infoData = new InfoData();
|
||||||
|
try {
|
||||||
|
while ((thisLine = br.readLine()) != null) {
|
||||||
|
if (!thisLine.isEmpty()) {
|
||||||
|
if (thisLine.startsWith("Username: ")) {
|
||||||
|
infoData.setUsername(thisLine.substring(10));
|
||||||
|
} else {
|
||||||
|
if (thisLine.startsWith("Full Name: ")) {
|
||||||
|
infoData.setFullname(thisLine.substring(11));
|
||||||
|
} else {
|
||||||
|
if (thisLine.startsWith("Email: ")) {
|
||||||
|
infoData.setEmail(thisLine.substring(7));
|
||||||
|
} else {
|
||||||
|
if (thisLine.startsWith("Language: ")) {
|
||||||
|
infoData.setLanguage(thisLine.substring(10));
|
||||||
|
} else {
|
||||||
|
if (thisLine.startsWith("Algorithm Name: ")) {
|
||||||
|
infoData.setAlgorithmName(thisLine.substring(16));
|
||||||
|
} else {
|
||||||
|
if (thisLine.startsWith("Class Name: ")) {
|
||||||
|
infoData.setClassName(thisLine.substring(12));
|
||||||
|
} else {
|
||||||
|
if (thisLine.startsWith("Algorithm Description: ")) {
|
||||||
|
infoData.setAlgorithmDescription(thisLine.substring(23));
|
||||||
|
} else {
|
||||||
|
if (thisLine.startsWith("Algorithm Category: ")) {
|
||||||
|
infoData.setAlgorithmCategory(thisLine.substring(20));
|
||||||
|
} else {
|
||||||
|
if (thisLine.startsWith("Interpreter Version: ")) {
|
||||||
|
infoData.setInterpreterVersion(thisLine.substring(21));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error("Error reading info.txt file: " + e.getLocalizedMessage(), e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return infoData;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.server.generator;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.social.AlgorithmNotification;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.social.Recipient;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.util.ServiceCredentials;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.info.InfoData;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Giancarlo Panichi
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ProjectDeploy {
|
||||||
|
private static Logger logger = LoggerFactory.getLogger(ProjectDeploy.class);
|
||||||
|
|
||||||
|
|
||||||
|
private ServiceCredentials serviceCredentials;
|
||||||
|
private Project project;
|
||||||
|
private ArrayList<Recipient> recipients;
|
||||||
|
private HttpServletRequest httpServletRequest;
|
||||||
|
|
||||||
|
public ProjectDeploy(HttpServletRequest httpServletRequest,
|
||||||
|
ServiceCredentials serviceCredentials, Project project,
|
||||||
|
ArrayList<Recipient> recipients) {
|
||||||
|
this.serviceCredentials = serviceCredentials;
|
||||||
|
this.project = project;
|
||||||
|
this.recipients = recipients;
|
||||||
|
this.httpServletRequest = httpServletRequest;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deploy() throws StatAlgoImporterServiceException{
|
||||||
|
InfoGenerator infoGenerator=new InfoGenerator(project, serviceCredentials);
|
||||||
|
InfoData infoData=infoGenerator.readInfo();
|
||||||
|
logger.debug("Send notify");
|
||||||
|
sendNotify(infoData);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendNotify(InfoData infoData){
|
||||||
|
AlgorithmNotification notify = new AlgorithmNotification(httpServletRequest,
|
||||||
|
serviceCredentials, project, recipients, infoData);
|
||||||
|
notify.run();
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,9 +2,13 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.server.is;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.gcube.common.resources.gcore.GCoreEndpoint;
|
||||||
|
import org.gcube.common.resources.gcore.GCoreEndpoint.Profile.Endpoint;
|
||||||
import org.gcube.common.resources.gcore.GenericResource;
|
import org.gcube.common.resources.gcore.GenericResource;
|
||||||
import org.gcube.common.resources.gcore.ScopeGroup;
|
import org.gcube.common.resources.gcore.ScopeGroup;
|
||||||
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.Constants;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.Constants;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
||||||
|
@ -40,12 +44,12 @@ public class InformationSystemUtils {
|
||||||
.setResult("$resource");
|
.setResult("$resource");
|
||||||
|
|
||||||
DiscoveryClient<GenericResource> client = ICFactory.clientFor(GenericResource.class);
|
DiscoveryClient<GenericResource> client = ICFactory.clientFor(GenericResource.class);
|
||||||
List<GenericResource> accountingResources = client.submit(query);
|
List<GenericResource> saiProfileResources = client.submit(query);
|
||||||
logger.debug("Resources: " + accountingResources);
|
logger.debug("Resources: " + saiProfileResources);
|
||||||
|
|
||||||
SAIDescriptorJAXB saiDescriptorJaxB = null;
|
SAIDescriptorJAXB saiDescriptorJaxB = null;
|
||||||
|
|
||||||
for (GenericResource genericResource : accountingResources) {
|
for (GenericResource genericResource : saiProfileResources) {
|
||||||
if (genericResource.scopes() != null) {
|
if (genericResource.scopes() != null) {
|
||||||
ScopeGroup<String> scopes = genericResource.scopes();
|
ScopeGroup<String> scopes = genericResource.scopes();
|
||||||
Iterator<String> iterator = scopes.iterator();
|
Iterator<String> iterator = scopes.iterator();
|
||||||
|
@ -62,11 +66,12 @@ public class InformationSystemUtils {
|
||||||
JAXBParser<SAIDescriptorJAXB> parser = new JAXBParser<SAIDescriptorJAXB>(
|
JAXBParser<SAIDescriptorJAXB> parser = new JAXBParser<SAIDescriptorJAXB>(
|
||||||
SAIDescriptorJAXB.class);
|
SAIDescriptorJAXB.class);
|
||||||
logger.debug("Body: " + genericResource.profile().bodyAsString());
|
logger.debug("Body: " + genericResource.profile().bodyAsString());
|
||||||
saiDescriptorJaxB = (SAIDescriptorJAXB) parser.parse(genericResource.profile().bodyAsString());
|
saiDescriptorJaxB = (SAIDescriptorJAXB) parser
|
||||||
|
.parse(genericResource.profile().bodyAsString());
|
||||||
logger.debug("Enable: " + saiDescriptorJaxB);
|
logger.debug("Enable: " + saiDescriptorJaxB);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
String error = "Error in discovery SAI profile generic resource on IS in scope " + scope + ". "
|
String error = "Error in discovery SAI profile generic resource on IS in scope " + scope
|
||||||
+ "Resource parsing failed!";
|
+ ". " + "Resource parsing failed!";
|
||||||
logger.error(error);
|
logger.error(error);
|
||||||
logger.error(
|
logger.error(
|
||||||
"Error {resource=" + genericResource + ", error=" + e.getLocalizedMessage() + "}");
|
"Error {resource=" + genericResource + ", error=" + e.getLocalizedMessage() + "}");
|
||||||
|
@ -87,7 +92,81 @@ public class InformationSystemUtils {
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
String error = "Error in discovery SAI profile generic resource on IS in scope : " + scope;
|
String error = "Error in discovery SAI profile generic resource on IS in scope : " + scope;
|
||||||
logger.error(error);
|
logger.error(error);
|
||||||
logger.error("Error: " + e.getLocalizedMessage(),e);
|
logger.error("Error: " + e.getLocalizedMessage(), e);
|
||||||
|
throw new StatAlgoImporterServiceException(error, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String retrieveDataMinerPoolManager(String scope) throws StatAlgoImporterServiceException {
|
||||||
|
try {
|
||||||
|
logger.debug("Retrieve dataminer-pool-manager");
|
||||||
|
if (scope == null || scope.length() == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
ScopeProvider.instance.set(scope);
|
||||||
|
logger.debug("Retrieve DataMiner Pool Manager resource in scope: " + scope);
|
||||||
|
|
||||||
|
SimpleQuery query = ICFactory.queryFor(GCoreEndpoint.class);
|
||||||
|
query.addCondition("$resource/Profile/SecondaryType/text() eq '" + Constants.POOL_MANAGER_CATEGORY + "'")
|
||||||
|
.addCondition("$resource/Profile/Name/text() eq '" + Constants.POOL_MANAGER_NAME + "'")
|
||||||
|
.setResult("$resource");
|
||||||
|
|
||||||
|
DiscoveryClient<GCoreEndpoint> client = ICFactory.clientFor(GCoreEndpoint.class);
|
||||||
|
List<GCoreEndpoint> dataMinerPoolManagerResources = client.submit(query);
|
||||||
|
logger.debug("Resources: " + dataMinerPoolManagerResources);
|
||||||
|
|
||||||
|
String poolManagerURI=null;
|
||||||
|
|
||||||
|
for (GCoreEndpoint gCoreEndpoint : dataMinerPoolManagerResources) {
|
||||||
|
if (gCoreEndpoint.scopes() != null) {
|
||||||
|
ScopeGroup<String> scopes = gCoreEndpoint.scopes();
|
||||||
|
Iterator<String> iterator = scopes.iterator();
|
||||||
|
String scopeFound = null;
|
||||||
|
boolean found = false;
|
||||||
|
while (iterator.hasNext() && !found) {
|
||||||
|
scopeFound = iterator.next();
|
||||||
|
if (scopeFound.compareTo(scope) == 0) {
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (found) {
|
||||||
|
try {
|
||||||
|
logger.debug(
|
||||||
|
"DataMiner PoolManager Endpoints map: " + gCoreEndpoint.profile().endpointMap());
|
||||||
|
Map<String, Endpoint> endpointMap = gCoreEndpoint.profile().endpointMap();
|
||||||
|
Endpoint dataMinerEndpoint = endpointMap.get("REST-API");
|
||||||
|
logger.debug("DataMiner PoolManager Endpoint: " + dataMinerEndpoint);
|
||||||
|
|
||||||
|
if (dataMinerEndpoint != null && dataMinerEndpoint.uri() != null) {
|
||||||
|
poolManagerURI=dataMinerEndpoint.uri().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Throwable e) {
|
||||||
|
String error = "Error in discovery DataMiner PoolManager gCubeEndpoint resource on IS in scope: "
|
||||||
|
+ scope;
|
||||||
|
logger.error(error);
|
||||||
|
logger.error(
|
||||||
|
"Error {resource=" + gCoreEndpoint + ", error=" + e.getLocalizedMessage() + "}");
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new StatAlgoImporterServiceException(error, e);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
logger.debug("DataMiner PoolManager URI: " + poolManagerURI);
|
||||||
|
return poolManagerURI;
|
||||||
|
|
||||||
|
} catch (StatAlgoImporterServiceException e) {
|
||||||
|
throw e;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
String error = "Error in discovery DataMiner PoolManager gCubeEndpoint resource on IS in scope : " + scope;
|
||||||
|
logger.error(error);
|
||||||
|
logger.error("Error: " + e.getLocalizedMessage(), e);
|
||||||
throw new StatAlgoImporterServiceException(error, e);
|
throw new StatAlgoImporterServiceException(error, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.server.poolmanager;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.is.InformationSystemUtils;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.util.ServiceCredentials;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Giancarlo Panichi
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class PoolManager {
|
||||||
|
private static Logger logger = LoggerFactory.getLogger(PoolManager.class);
|
||||||
|
|
||||||
|
private ServiceCredentials serviceCredentials;
|
||||||
|
|
||||||
|
public PoolManager(ServiceCredentials serviceCredentials) {
|
||||||
|
this.serviceCredentials=serviceCredentials;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deployAlgorithm() throws StatAlgoImporterServiceException{
|
||||||
|
retrievePoolManagerURI();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String retrievePoolManagerURI() throws StatAlgoImporterServiceException {
|
||||||
|
String poolManagerURI=InformationSystemUtils.retrieveDataMinerPoolManager(serviceCredentials.getScope());
|
||||||
|
logger.debug("PoolManagerURI: "+poolManagerURI);
|
||||||
|
return poolManagerURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNot
|
||||||
import org.gcube.portal.notifications.bean.GenericItemBean;
|
import org.gcube.portal.notifications.bean.GenericItemBean;
|
||||||
import org.gcube.portal.notifications.thread.MessageNotificationsThread;
|
import org.gcube.portal.notifications.thread.MessageNotificationsThread;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.util.ServiceCredentials;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.util.ServiceCredentials;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.info.InfoData;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -29,23 +30,20 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class AlgorithmNotification extends Thread {
|
public class AlgorithmNotification extends Thread {
|
||||||
private static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory.getLogger(AlgorithmNotification.class);
|
||||||
.getLogger(AlgorithmNotification.class);
|
|
||||||
private HttpServletRequest httpServletRequest;
|
private HttpServletRequest httpServletRequest;
|
||||||
private ServiceCredentials serviceCredentials;
|
private ServiceCredentials serviceCredentials;
|
||||||
|
|
||||||
// private NotificationType notificationType;
|
|
||||||
private Project project;
|
private Project project;
|
||||||
private ArrayList<Recipient> recipients;
|
private ArrayList<Recipient> recipients;
|
||||||
|
private InfoData infoData;
|
||||||
|
|
||||||
public AlgorithmNotification(HttpServletRequest httpServletRequest,
|
public AlgorithmNotification(HttpServletRequest httpServletRequest, ServiceCredentials serviceCredentials,
|
||||||
ServiceCredentials serviceCredentials, Project project,
|
Project project, ArrayList<Recipient> recipients, InfoData infoData) {
|
||||||
ArrayList<Recipient> recipients) {
|
|
||||||
this.serviceCredentials = serviceCredentials;
|
this.serviceCredentials = serviceCredentials;
|
||||||
this.project = project;
|
this.project = project;
|
||||||
this.recipients = recipients;
|
this.recipients = recipients;
|
||||||
this.httpServletRequest = httpServletRequest;
|
this.httpServletRequest = httpServletRequest;
|
||||||
// this.notificationType = NotificationType.SAI_ALGORITHM_PUBLICATION;
|
this.infoData = infoData;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,52 +53,45 @@ public class AlgorithmNotification extends Thread {
|
||||||
|
|
||||||
private void algorithmPublicationEmail() {
|
private void algorithmPublicationEmail() {
|
||||||
try {
|
try {
|
||||||
Workspace workspace = HomeLibrary
|
Workspace workspace = HomeLibrary.getUserWorkspace(serviceCredentials.getUserName());
|
||||||
.getUserWorkspace(serviceCredentials.getUserName());
|
|
||||||
|
|
||||||
List<String> recipientIds = retrieveListAddressee();
|
List<String> recipientIds = retrieveListAddressee();
|
||||||
|
|
||||||
List<GenericItemBean> recipients = retrieveRecipients();
|
List<GenericItemBean> recipients = retrieveRecipients();
|
||||||
|
|
||||||
String subject = "[SAI] New software publication requested";
|
String subject = "[SAI] New software publication requested";
|
||||||
String body = "The user: "
|
String body = "Username: " + serviceCredentials.getUserName() + "\nFull Name: "
|
||||||
+ serviceCredentials.getFullName()
|
+ serviceCredentials.getFullName() + "\nEmail: " + serviceCredentials.getEmail() + "\n\nin VRE: "
|
||||||
+ "\nin VRE: "
|
+ serviceCredentials.getScope() + "\n\nhas requested to publish the algorithm: " + "\nLanguage: "
|
||||||
+ serviceCredentials.getScope()
|
+ infoData.getLanguage() + "\nAlgorithm Name: " + infoData.getAlgorithmName() + "\nClass Name: "
|
||||||
+ "\n\nhas requested to publish the algorithm: "
|
+ infoData.getClassName() + "\nAlgorithm Description: " + infoData.getAlgorithmDescription()
|
||||||
+ project.getInputData().getProjectInfo()
|
+ "\nAlgorithm Category: " + infoData.getAlgorithmCategory() + "\n\nInterpreter Version: "
|
||||||
.getAlgorithmName()
|
+ infoData.getInterpreterVersion() + "\n\nwith the following jar: "
|
||||||
+ "\nwith the following jar: "
|
+ project.getProjectTarget().getProjectDeploy().getCodeJar().getPublicLink() + "\n\nInstaller: "
|
||||||
+ project.getProjectTarget().getProjectDeploy()
|
+ "\n./addAlgorithm.sh " + infoData.getAlgorithmName() + " " + infoData.getAlgorithmCategory() + " "
|
||||||
.getCodeJar().getPublicLink();
|
+ infoData.getClassName() + " " + serviceCredentials.getScope() + " transducerers N "
|
||||||
|
+ project.getProjectTarget().getProjectDeploy().getCodeJar().getPublicLink() + " \""
|
||||||
|
+ infoData.getAlgorithmDescription() + "\"";
|
||||||
|
|
||||||
|
|
||||||
String messageId;
|
String messageId;
|
||||||
|
|
||||||
messageId = workspace.getWorkspaceMessageManager()
|
messageId = workspace.getWorkspaceMessageManager().sendMessageToPortalLogins(subject, body,
|
||||||
.sendMessageToPortalLogins(subject, body,
|
new ArrayList<String>(), recipientIds);
|
||||||
new ArrayList<String>(), recipientIds);
|
|
||||||
|
|
||||||
logger.debug("Sending message notification to: "
|
logger.debug("Sending message notification to: " + recipientIds.toString());
|
||||||
+ recipientIds.toString());
|
|
||||||
|
|
||||||
SocialNetworkingSite site = new SocialNetworkingSite(
|
SocialNetworkingSite site = new SocialNetworkingSite(httpServletRequest);
|
||||||
httpServletRequest);
|
SocialNetworkingUser user = new SocialNetworkingUser(serviceCredentials.getUserName(),
|
||||||
SocialNetworkingUser user = new SocialNetworkingUser(
|
serviceCredentials.getEmail(), serviceCredentials.getFullName(),
|
||||||
serviceCredentials.getUserName(),
|
|
||||||
serviceCredentials.getEmail(),
|
|
||||||
serviceCredentials.getFullName(),
|
|
||||||
serviceCredentials.getUserAvatarURL());
|
serviceCredentials.getUserAvatarURL());
|
||||||
NotificationsManager nm = new ApplicationNotificationsManager(site,
|
NotificationsManager nm = new ApplicationNotificationsManager(site, serviceCredentials.getScope(), user);
|
||||||
serviceCredentials.getScope(), user);
|
|
||||||
|
|
||||||
Thread thread = new Thread(new MessageNotificationsThread(
|
Thread thread = new Thread(new MessageNotificationsThread(recipients, messageId, subject, body, nm));
|
||||||
recipients, messageId, subject, body, nm));
|
|
||||||
thread.start();
|
thread.start();
|
||||||
|
|
||||||
} catch (InternalErrorException | WorkspaceFolderNotFoundException
|
} catch (InternalErrorException | WorkspaceFolderNotFoundException | HomeNotFoundException e) {
|
||||||
| HomeNotFoundException e) {
|
logger.error("AlgorithmPublicationEmail(): " + e.getLocalizedMessage());
|
||||||
logger.error("AlgorithmPublicationEmail(): "
|
|
||||||
+ e.getLocalizedMessage());
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -110,9 +101,8 @@ public class AlgorithmNotification extends Thread {
|
||||||
private List<GenericItemBean> retrieveRecipients() {
|
private List<GenericItemBean> retrieveRecipients() {
|
||||||
List<GenericItemBean> genericItemBeanRecipients = new ArrayList<GenericItemBean>();
|
List<GenericItemBean> genericItemBeanRecipients = new ArrayList<GenericItemBean>();
|
||||||
for (Recipient recipient : recipients) {
|
for (Recipient recipient : recipients) {
|
||||||
genericItemBeanRecipients.add(new GenericItemBean(recipient
|
genericItemBeanRecipients.add(new GenericItemBean(recipient.getUser(), recipient.getUser(),
|
||||||
.getUser(), recipient.getUser(), recipient.getName() + " "
|
recipient.getName() + " " + recipient.getSurname(), ""));
|
||||||
+ recipient.getSurname(), ""));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return genericItemBeanRecipients;
|
return genericItemBeanRecipients;
|
||||||
|
|
|
@ -34,6 +34,9 @@ public class Constants {
|
||||||
// IS Resource
|
// IS Resource
|
||||||
public static final String SAI_NAME = "SAIProfile";
|
public static final String SAI_NAME = "SAIProfile";
|
||||||
public static final String SAI_CATEGORY = "SAI";
|
public static final String SAI_CATEGORY = "SAI";
|
||||||
|
|
||||||
|
public static final String POOL_MANAGER_NAME = "dataminer-pool-manager";
|
||||||
|
public static final String POOL_MANAGER_CATEGORY = "DataAnalysis";
|
||||||
|
|
||||||
// Main Generator
|
// Main Generator
|
||||||
public static final String PRE_INSTALLED = "Pre-Installed";
|
public static final String PRE_INSTALLED = "Pre-Installed";
|
||||||
|
|
|
@ -0,0 +1,136 @@
|
||||||
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.info;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InterpreterPackageInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Giancarlo Panichi
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class InfoData implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 6804461443058040026L;
|
||||||
|
private String username;
|
||||||
|
private String fullname;
|
||||||
|
private String email;
|
||||||
|
private String language;
|
||||||
|
private String algorithmName;
|
||||||
|
private String className;
|
||||||
|
private String algorithmDescription;
|
||||||
|
private String algorithmCategory;
|
||||||
|
private String interpreterVersion;
|
||||||
|
private ArrayList<InterpreterPackageInfo> packagesInfo;
|
||||||
|
|
||||||
|
public InfoData() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public InfoData(String username, String fullname, String email, String language, String algorithmName,
|
||||||
|
String className, String algorithmDescription, String algorithmCategory, String interpreterVersion,
|
||||||
|
ArrayList<InterpreterPackageInfo> packagesInfo) {
|
||||||
|
super();
|
||||||
|
this.username = username;
|
||||||
|
this.fullname = fullname;
|
||||||
|
this.email = email;
|
||||||
|
this.language = language;
|
||||||
|
this.algorithmName = algorithmName;
|
||||||
|
this.className = className;
|
||||||
|
this.algorithmDescription = algorithmDescription;
|
||||||
|
this.algorithmCategory = algorithmCategory;
|
||||||
|
this.interpreterVersion = interpreterVersion;
|
||||||
|
this.packagesInfo = packagesInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFullname() {
|
||||||
|
return fullname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFullname(String fullname) {
|
||||||
|
this.fullname = fullname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLanguage() {
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLanguage(String language) {
|
||||||
|
this.language = language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAlgorithmName() {
|
||||||
|
return algorithmName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAlgorithmName(String algorithmName) {
|
||||||
|
this.algorithmName = algorithmName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClassName() {
|
||||||
|
return className;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClassName(String className) {
|
||||||
|
this.className = className;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAlgorithmDescription() {
|
||||||
|
return algorithmDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAlgorithmDescription(String algorithmDescription) {
|
||||||
|
this.algorithmDescription = algorithmDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAlgorithmCategory() {
|
||||||
|
return algorithmCategory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAlgorithmCategory(String algorithmCategory) {
|
||||||
|
this.algorithmCategory = algorithmCategory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInterpreterVersion() {
|
||||||
|
return interpreterVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInterpreterVersion(String interpreterVersion) {
|
||||||
|
this.interpreterVersion = interpreterVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<InterpreterPackageInfo> getPackagesInfo() {
|
||||||
|
return packagesInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPackagesInfo(ArrayList<InterpreterPackageInfo> packagesInfo) {
|
||||||
|
this.packagesInfo = packagesInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "InfoData [username=" + username + ", fullname=" + fullname + ", email=" + email + ", language="
|
||||||
|
+ language + ", algorithmName=" + algorithmName + ", className=" + className + ", algorithmDescription="
|
||||||
|
+ algorithmDescription + ", algorithmCategory=" + algorithmCategory + ", interpreterVersion="
|
||||||
|
+ interpreterVersion + ", packagesInfo=" + packagesInfo + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue