1832: Accounting Manager - On Storage Accounting filters values must not have the popup validation
Task-Url: https://support.d4science.org/issues/1832 Fixed Main Code delete git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@122449 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
bfb2a97bf1
commit
65c6329f7b
7
pom.xml
7
pom.xml
|
@ -98,6 +98,13 @@
|
|||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.thoughtworks.xstream</groupId>
|
||||
<artifactId>xstream</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
|
|
@ -62,6 +62,7 @@ public class MainDataPanel extends SimpleContainer {
|
|||
break;
|
||||
case DELETE_RESOURCE:
|
||||
break;
|
||||
case DELETE_MAIN_CODE:
|
||||
case MAIN_CODE_SET:
|
||||
codeEditPanel.codeUpdate(event.getProject());
|
||||
break;
|
||||
|
|
|
@ -450,9 +450,45 @@ public class ProjectManager {
|
|||
});
|
||||
}
|
||||
|
||||
public void deleteItem(ItemDescription itemDescription) {
|
||||
public void deleteItem(final ItemDescription itemDescription) {
|
||||
if (project != null
|
||||
&& project.getMainCode() != null
|
||||
&& project.getMainCode().getItemDescription() != null
|
||||
&& itemDescription.getId().compareTo(
|
||||
project.getMainCode().getItemDescription().getId()) == 0) {
|
||||
final ConfirmMessageBox mb = new ConfirmMessageBox("Attention",
|
||||
"All previous configurations will be lost. Would you like to delete main code?");
|
||||
mb.addDialogHideHandler(new DialogHideHandler() {
|
||||
|
||||
@Override
|
||||
public void onDialogHide(DialogHideEvent event) {
|
||||
switch (event.getHideButton()) {
|
||||
case NO:
|
||||
break;
|
||||
case YES:
|
||||
deleteItemOnServer(itemDescription,true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
mb.setWidth(300);
|
||||
mb.show();
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
deleteItemOnServer(itemDescription, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void deleteItemOnServer(ItemDescription itemDescription, final boolean mainCode){
|
||||
|
||||
StatAlgoImporterServiceAsync.INSTANCE.deleteResourceOnProject(
|
||||
itemDescription, new AsyncCallback<Void>() {
|
||||
itemDescription, new AsyncCallback<Project>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -470,8 +506,13 @@ public class ProjectManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
fireProjectStatusDeleteEvent();
|
||||
public void onSuccess(Project result) {
|
||||
project=result;
|
||||
if(mainCode){
|
||||
fireProjectStatusDeleteMainCodeEvent();
|
||||
} else {
|
||||
fireProjectStatusDeleteEvent();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -510,6 +551,13 @@ public class ProjectManager {
|
|||
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
||||
}
|
||||
|
||||
protected void fireProjectStatusDeleteMainCodeEvent() {
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||
ProjectStatusEventType.DELETE_MAIN_CODE, project);
|
||||
eventBus.fireEvent(projectStatusEvent);
|
||||
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
||||
}
|
||||
|
||||
protected void fireProjectStatusUpdateEvent() {
|
||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||
ProjectStatusEventType.UPDATE, project);
|
||||
|
@ -590,10 +638,8 @@ public class ProjectManager {
|
|||
mb.show();
|
||||
|
||||
} else {
|
||||
Log.error("Project not open: "+project);
|
||||
UtilsGXT3
|
||||
.alert("Error",
|
||||
"Project not open!");
|
||||
Log.error("Project not open: " + project);
|
||||
UtilsGXT3.alert("Error", "Project not open!");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -617,7 +663,8 @@ public class ProjectManager {
|
|||
|
||||
public void onSuccess(Void result) {
|
||||
monitor.hide();
|
||||
UtilsGXT3.info("Publish", "The software has been published!");
|
||||
UtilsGXT3.info("Publish",
|
||||
"The software has been published!");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public interface StatAlgoImporterService extends RemoteService {
|
|||
public void addResourceToProject(ItemDescription itemDescription)
|
||||
throws StatAlgoImporterServiceException;
|
||||
|
||||
public void deleteResourceOnProject(ItemDescription itemDescription)
|
||||
public Project deleteResourceOnProject(ItemDescription itemDescription)
|
||||
throws StatAlgoImporterServiceException;
|
||||
|
||||
public void saveProject(InputData inputData)
|
||||
|
|
|
@ -48,7 +48,7 @@ public interface StatAlgoImporterServiceAsync {
|
|||
AsyncCallback<Void> asyncCallback);
|
||||
|
||||
void deleteResourceOnProject(ItemDescription itemDescription,
|
||||
AsyncCallback<Void> asyncCallback);
|
||||
AsyncCallback<Project> asyncCallback);
|
||||
|
||||
void openProjectOnWorkspace(ItemDescription newProjectFolder,
|
||||
AsyncCallback<Project> asyncCallback);
|
||||
|
|
|
@ -115,6 +115,7 @@ public class ExplorerProjectPanel extends ContentPanel {
|
|||
case UPDATE:
|
||||
case ADD_RESOURCE:
|
||||
case DELETE_RESOURCE:
|
||||
case DELETE_MAIN_CODE:
|
||||
create(event);
|
||||
break;
|
||||
case SAVE:
|
||||
|
|
|
@ -21,7 +21,8 @@ public class InputVariablePanel extends ContentPanel {
|
|||
|
||||
private EventBus eventBus;
|
||||
private InputVariableTabPanel inputVariableTabPanel;
|
||||
//private InputVariablePanelState state;
|
||||
|
||||
// private InputVariablePanelState state;
|
||||
|
||||
public InputVariablePanel(EventBus eventBus) {
|
||||
super();
|
||||
|
@ -78,21 +79,18 @@ public class InputVariablePanel extends ContentPanel {
|
|||
}
|
||||
});
|
||||
|
||||
eventBus.addHandler(
|
||||
NewSelectedRowsVariableEvent.TYPE,
|
||||
new NewSelectedRowsVariableEvent.NewSelectedRowsVariableEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onNewVariable(NewSelectedRowsVariableEvent event) {
|
||||
addNewSelectedRowsVariable(event
|
||||
.getSelectedRowsVariable());
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
eventBus.addHandler(
|
||||
NewSelectedRowsVariableEvent.TYPE,
|
||||
new NewSelectedRowsVariableEvent.NewSelectedRowsVariableEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onNewVariable(NewSelectedRowsVariableEvent event) {
|
||||
addNewSelectedRowsVariable(event
|
||||
.getSelectedRowsVariable());
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
@ -106,12 +104,14 @@ public class InputVariablePanel extends ContentPanel {
|
|||
inputVariableTabPanel.requestInput();
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void manageProjectStatusEvents(ProjectStatusEvent event) {
|
||||
Log.debug("InputVariablePanel recieved event ProjectStatus: "
|
||||
+ event.toString());
|
||||
switch (event.getProjectStatusEventType()) {
|
||||
case SAVE:
|
||||
break;
|
||||
case SOFTWARE_CREATED:
|
||||
break;
|
||||
case START:
|
||||
break;
|
||||
case OPEN:
|
||||
|
@ -122,12 +122,18 @@ public class InputVariablePanel extends ContentPanel {
|
|||
break;
|
||||
case ADD_RESOURCE:
|
||||
break;
|
||||
case DELETE_RESOURCE:
|
||||
break;
|
||||
case DELETE_MAIN_CODE:
|
||||
setMainCode(event.getProject());
|
||||
break;
|
||||
case MAIN_CODE_SET:
|
||||
setMainCode(event.getProject());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void create(Project project) {
|
||||
|
@ -145,20 +151,20 @@ public class InputVariablePanel extends ContentPanel {
|
|||
private void startPanel(Project project) {
|
||||
enable();
|
||||
expand();
|
||||
//state = InputVariablePanelState.OPENED;
|
||||
// state = InputVariablePanelState.OPENED;
|
||||
inputVariableTabPanel.startTabs(project);
|
||||
|
||||
}
|
||||
|
||||
private void updatePanel(Project project) {
|
||||
inputVariableTabPanel.updateTabs(project);
|
||||
Log.debug("ToolBoxPanel Updated");
|
||||
inputVariableTabPanel.updateTabs(project);
|
||||
Log.debug("ToolBoxPanel Updated");
|
||||
|
||||
}
|
||||
|
||||
private void setMainCode(Project project) {
|
||||
inputVariableTabPanel.setMainCode(project);
|
||||
Log.debug("ToolBoxPanel Updated");
|
||||
inputVariableTabPanel.setMainCode(project);
|
||||
Log.debug("ToolBoxPanel Updated");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ public enum ProjectStatusEventType {
|
|||
UPDATE,
|
||||
ADD_RESOURCE,
|
||||
DELETE_RESOURCE,
|
||||
DELETE_MAIN_CODE,
|
||||
SOFTWARE_CREATED,
|
||||
SAVE;
|
||||
|
||||
|
|
|
@ -57,8 +57,9 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
System.out.println("initializing StatAlgoImporterService");
|
||||
String notificationRecipientsFile = "/statalgoimporter/properties/NotificationRecipients.txt";
|
||||
InputStream notificationRecipientsInputStream = this.getServletContext()
|
||||
.getResourceAsStream(notificationRecipientsFile);
|
||||
InputStream notificationRecipientsInputStream = this
|
||||
.getServletContext().getResourceAsStream(
|
||||
notificationRecipientsFile);
|
||||
String text = null;
|
||||
try {
|
||||
text = IOUtils.toString(notificationRecipientsInputStream,
|
||||
|
@ -70,7 +71,7 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
|||
ArrayList<Recipient> recipients = new ArrayList<Recipient>();
|
||||
|
||||
JSONObject obj = new JSONObject(text);
|
||||
System.out.println(""+obj);
|
||||
System.out.println("" + obj);
|
||||
JSONArray arr = obj.getJSONArray("recipients");
|
||||
for (int i = 0; i < arr.length(); i++) {
|
||||
JSONObject dest = arr.getJSONObject(i);
|
||||
|
@ -82,7 +83,7 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
|||
recipients.add(rec);
|
||||
|
||||
}
|
||||
System.out.println("Recipients: "+recipients);
|
||||
System.out.println("Recipients: " + recipients);
|
||||
SessionUtil.setRecipients(this.getServletContext(), recipients);
|
||||
|
||||
}
|
||||
|
@ -208,12 +209,18 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
|||
throws StatAlgoImporterServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
SessionUtil.getAslSession(session);
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
logger.debug("createProjectOnWorkspace()");
|
||||
ProjectFolder projectFolder = new ProjectFolder(newProjectFolder);
|
||||
Project projectSession = new Project(projectFolder);
|
||||
SessionUtil.setProjectSession(session, projectSession);
|
||||
|
||||
if (ProjectArchiver.existProjectInFolder(newProjectFolder,
|
||||
aslSession)) {
|
||||
throw new StatAlgoImporterServiceException(
|
||||
"Attention a project is present in this folder, use open or another folder!");
|
||||
} else {
|
||||
ProjectFolder projectFolder = new ProjectFolder(
|
||||
newProjectFolder);
|
||||
Project projectSession = new Project(projectFolder);
|
||||
SessionUtil.setProjectSession(session, projectSession);
|
||||
}
|
||||
return;
|
||||
} catch (StatAlgoImporterServiceException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -316,7 +323,7 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void deleteResourceOnProject(ItemDescription itemDescription)
|
||||
public Project deleteResourceOnProject(ItemDescription itemDescription)
|
||||
throws StatAlgoImporterServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
|
@ -330,14 +337,27 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
Project project = SessionUtil.getProjectSession(session);
|
||||
if (project != null) {
|
||||
FilesStorage fileStorage = new FilesStorage();
|
||||
fileStorage.deleteItemOnFolder(aslSession.getUsername(),
|
||||
itemDescription.getId());
|
||||
if (project.getMainCode() != null
|
||||
&& project.getMainCode().getItemDescription() != null
|
||||
&& project.getMainCode().getItemDescription().getId()
|
||||
.compareTo(itemDescription.getId()) == 0) {
|
||||
project.setMainCode(null);
|
||||
project.setInputData(null);
|
||||
project.setProjectTarget(null);
|
||||
FilesStorage fileStorage = new FilesStorage();
|
||||
fileStorage.deleteItemOnFolder(aslSession.getUsername(),
|
||||
itemDescription.getId());
|
||||
SessionUtil.setProjectSession(session, project);
|
||||
} else {
|
||||
FilesStorage fileStorage = new FilesStorage();
|
||||
fileStorage.deleteItemOnFolder(aslSession.getUsername(),
|
||||
itemDescription.getId());
|
||||
}
|
||||
return project;
|
||||
} else {
|
||||
throw new StatAlgoImporterServiceException("No project open!");
|
||||
}
|
||||
|
||||
return;
|
||||
} catch (StatAlgoImporterServiceException e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
|
@ -391,9 +411,9 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
|||
throw new StatAlgoImporterServiceException(
|
||||
"No main code set!");
|
||||
} else {
|
||||
FilesStorage filesStorage = new FilesStorage();
|
||||
filesStorage.saveItem(aslSession.getUsername(), mainCode
|
||||
.getItemDescription().getId(), code);
|
||||
MainCodeSave mainCodeSave = new MainCodeSave();
|
||||
mainCodeSave.save(aslSession,
|
||||
mainCode.getItemDescription(), code, project);
|
||||
}
|
||||
} else {
|
||||
throw new StatAlgoImporterServiceException("No project open!");
|
||||
|
@ -423,7 +443,7 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
|||
if (project != null && project.getProjectFolder() != null
|
||||
&& project.getProjectFolder().getItemDescription() != null) {
|
||||
MainCodeSave mainCodeSave = new MainCodeSave();
|
||||
ItemDescription mainCodeItemDescription = mainCodeSave.save(
|
||||
ItemDescription mainCodeItemDescription = mainCodeSave.saveNew(
|
||||
aslSession, fileDescription, code, project);
|
||||
MainCode mainCode = new MainCode(mainCodeItemDescription);
|
||||
project.setMainCode(mainCode);
|
||||
|
@ -504,7 +524,8 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
|||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
logger.debug("PublishSoftware()");
|
||||
ArrayList<Recipient> recipients=SessionUtil.getRecipients(session.getServletContext());
|
||||
ArrayList<Recipient> recipients = SessionUtil.getRecipients(session
|
||||
.getServletContext());
|
||||
Project project = SessionUtil.getProjectSession(session);
|
||||
if (project != null && project.getProjectTarget() != null
|
||||
&& project.getProjectTarget().getTargetFolder() != null
|
||||
|
|
|
@ -398,6 +398,67 @@ public class FilesStorage {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
* @param folderId
|
||||
* @return
|
||||
* @throws StatAlgoImporterServiceException
|
||||
*/
|
||||
public boolean existProjectItemOnWorkspace(String user,
|
||||
String folderId) throws StatAlgoImporterServiceException {
|
||||
Workspace ws;
|
||||
try {
|
||||
ws = HomeLibrary.getUserWorkspace(user);
|
||||
|
||||
WorkspaceItem workSpaceItem = ws.getItem(folderId);
|
||||
if (!workSpaceItem.isFolder()) {
|
||||
throw new StatAlgoImporterServiceException(
|
||||
"Item is not valid folder!");
|
||||
}
|
||||
|
||||
WorkspaceItem projectItem = ws.find(
|
||||
STATISTICAL_ALGORITHM_PROJECT_FILE_NAME, folderId);
|
||||
|
||||
if (projectItem == null) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
} catch (WorkspaceFolderNotFoundException | InternalErrorException
|
||||
| HomeNotFoundException | ItemNotFoundException
|
||||
| WrongItemTypeException e) {
|
||||
e.printStackTrace();
|
||||
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
* @param itemId
|
||||
* @return
|
||||
* @throws StatAlgoImporterServiceException
|
||||
*/
|
||||
public WorkspaceItem retrieveItemInfoOnWorkspace(String user, String itemId)
|
||||
throws StatAlgoImporterServiceException {
|
||||
Workspace ws;
|
||||
try {
|
||||
ws = HomeLibrary.getUserWorkspace(user);
|
||||
|
||||
WorkspaceItem workSpaceItem = ws.getItem(itemId);
|
||||
return workSpaceItem;
|
||||
|
||||
} catch (WorkspaceFolderNotFoundException | InternalErrorException
|
||||
| HomeNotFoundException | ItemNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
|
|
|
@ -31,6 +31,21 @@ public class MainCodeSave {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param aslSession
|
||||
* @param file
|
||||
* @param code
|
||||
* @param project
|
||||
* @throws StatAlgoImporterServiceException
|
||||
*/
|
||||
public void save(ASLSession aslSession, ItemDescription file,
|
||||
String code, Project project) throws StatAlgoImporterServiceException{
|
||||
FilesStorage filesStorage = new FilesStorage();
|
||||
filesStorage.saveItem(aslSession.getUsername(), file.getId(), code);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param aslSession
|
||||
|
@ -40,7 +55,7 @@ public class MainCodeSave {
|
|||
* @return
|
||||
* @throws StatAlgoImporterServiceException
|
||||
*/
|
||||
public ItemDescription save(ASLSession aslSession, ItemDescription file,
|
||||
public ItemDescription saveNew(ASLSession aslSession, ItemDescription file,
|
||||
String code, Project project)
|
||||
throws StatAlgoImporterServiceException {
|
||||
Path tempFile = createTempFile(file, code);
|
||||
|
@ -49,6 +64,7 @@ public class MainCodeSave {
|
|||
return mainCode;
|
||||
}
|
||||
|
||||
|
||||
private Path createTempFile(ItemDescription file, String code)
|
||||
throws StatAlgoImporterServiceException {
|
||||
try {
|
||||
|
|
|
@ -7,12 +7,17 @@ import java.io.ByteArrayOutputStream;
|
|||
import java.io.InputStream;
|
||||
|
||||
import org.gcube.application.framework.core.session.ASLSession;
|
||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.ProjectFolder;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.javascript.host.Storage;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
|
@ -42,6 +47,14 @@ public class ProjectArchiver {
|
|||
|
||||
}
|
||||
|
||||
public static boolean existProjectInFolder(ItemDescription newProjectFolder,
|
||||
ASLSession aslSession) throws StatAlgoImporterServiceException {
|
||||
FilesStorage filesStorage = new FilesStorage();
|
||||
return filesStorage.existProjectItemOnWorkspace(aslSession.getUsername(), newProjectFolder.getId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static Project readProject(ItemDescription newProjectFolder,
|
||||
ASLSession aslSession) throws StatAlgoImporterServiceException {
|
||||
FilesStorage filesStorage = new FilesStorage();
|
||||
|
@ -51,6 +64,30 @@ public class ProjectArchiver {
|
|||
XMLDecoder xmlDecoder = new XMLDecoder(inputStream);
|
||||
Project project = (Project) xmlDecoder.readObject();
|
||||
xmlDecoder.close();
|
||||
|
||||
WorkspaceItem projectFolderItem=filesStorage.retrieveItemInfoOnWorkspace(aslSession.getUsername(), newProjectFolder.getId());
|
||||
try {
|
||||
newProjectFolder.setId(projectFolderItem.getId());
|
||||
newProjectFolder.setName(projectFolderItem.getName());
|
||||
newProjectFolder.setOwner(projectFolderItem.getOwner().getPortalLogin());
|
||||
newProjectFolder.setPath(projectFolderItem.getPath());
|
||||
newProjectFolder.setType(projectFolderItem.getType().name());
|
||||
} catch (InternalErrorException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
|
||||
|
||||
}
|
||||
|
||||
if(project!=null && project.getProjectFolder()!=null &&
|
||||
newProjectFolder.compareInfo(project.getProjectFolder().getItemDescription())){
|
||||
|
||||
} else {
|
||||
project.setProjectFolder(new ProjectFolder(newProjectFolder));
|
||||
archive(project, aslSession);
|
||||
}
|
||||
return project;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public class ItemDescription implements Serializable {
|
|||
private String type;
|
||||
private String publicLink;
|
||||
|
||||
public ItemDescription(){
|
||||
public ItemDescription() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
@ -81,6 +81,26 @@ public class ItemDescription implements Serializable {
|
|||
this.publicLink = publicLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare basic information with another ItemDescription not null
|
||||
*
|
||||
* @param itemDescription
|
||||
* @return
|
||||
*/
|
||||
public boolean compareInfo(ItemDescription itemDescription){
|
||||
if(itemDescription!=null && id.compareTo(itemDescription.getId())==0 &&
|
||||
name.compareTo(itemDescription.getName())==0 &&
|
||||
owner.compareTo(itemDescription.getOwner())==0 &&
|
||||
path.compareTo(itemDescription.getPath())==0 &&
|
||||
type.compareTo(itemDescription.getType())==0
|
||||
){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ItemDescription [id=" + id + ", name=" + name + ", owner="
|
||||
|
@ -88,10 +108,4 @@ public class ItemDescription implements Serializable {
|
|||
+ publicLink + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue