*/
Study selectStudy(long index);
+ /**
+ * Delete the study.
+ *
+ * @param index
+ * the study id
+ */
+ public void removeStudy(final long index);
+
/**
* Create a new study.
*
return result;
}
+ /**
+ * {@inheritDoc}
+ * @see org.splat.service.StudyService#removeStudy(long)
+ */
+ @Transactional
+ public void removeStudy(final long index) {
+ Study study = getStudyDAO().get(index);
+ if (study != null) {
+ getStudyDAO().delete(study);
+ }
+ }
+
/**
* Get study by its reference.
*
* addItem(MNU_PURGE, new PopupItem(MNU_NAME_PURGE) .confirmation("message.purge.study")); addItem("export", new
* PopupItem("menu.export") .icon("image.export.png")); // For future needs
*/addItem(MNU_REMOVE, new PopupItem(MNU_NAME_REMOVE).icon(
- IMG_DELETE).action(ACT_NOT_YET_IMPLEMENTED).confirmation(
+ IMG_DELETE).action("remove-study").confirmation(
"message.delete.study"));
}
package org.splat.simer;
import org.splat.dal.bo.som.Study;
-import org.splat.service.StudyService;
public class EditStudyAction extends DisplayStudyStepAction {
* Serial version ID.
*/
private static final long serialVersionUID = -4865668290514118396L;
-
- /**
- * Injected study service.
- */
- private StudyService _studyService;
private enum Execute {
publish, protect, promote
_openStudy = getOpenStudy();
Study study = _openStudy.getStudyObject();
- _studyService.markStudyAsReference(study);
+ getStudyService().markStudyAsReference(study);
return SUCCESS;
}
_openStudy = getOpenStudy();
Study study = _openStudy.getStudyObject();
- _studyService.removeStudyAsReference(study);
+ getStudyService().removeStudyAsReference(study);
return SUCCESS;
}
-
- /**
- * Get the studyService.
- *
- * @return the studyService
- */
- @Override
- public StudyService getStudyService() {
- return _studyService;
- }
-
- /**
- * Set the studyService.
- *
- * @param studyService
- * the studyService to set
- */
- @Override
- public void setStudyService(final StudyService studyService) {
- _studyService = studyService;
- }
-
}
\ No newline at end of file
--- /dev/null
+/*****************************************************************************
+ * Company OPEN CASCADE
+ * Application SIMAN
+ * File $Id$
+ * Creation date 11.03.2013
+ * @author $Author$
+ * @version $Revision$
+ * @copyright OPEN CASCADE 2012
+ *****************************************************************************/
+
+package org.splat.simer;
+
+import org.splat.service.StudyService;
+
+/**
+ * The action for removing a study.
+ *
+ * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
+ */
+public class RemoveStudyAction extends Action {
+ /**
+ * Serialization version UID.
+ */
+ private static final long serialVersionUID = -6914581042309013794L;
+ /**
+ * Injected study service.
+ */
+ private StudyService _studyService;
+
+ /**
+ * Remove the selected study.
+ *
+ * @return SUCCESS
+ */
+ public String doRemove() {
+ OpenStudy openStudy = getOpenStudy();
+ if (openStudy != null && openStudy.isOpenForWriting()) {
+ long id = openStudy.getIndex();
+ getStudyService().removeStudy(id);
+ }
+ closeStudy();
+ initializationScreenContext("none");
+ return SUCCESS;
+ }
+
+ /**
+ * Get the studyService.
+ *
+ * @return the studyService
+ */
+ public StudyService getStudyService() {
+ return _studyService;
+ }
+
+ /**
+ * Set the studyService.
+ *
+ * @param studyService
+ * the studyService to set
+ */
+ public void setStudyService(final StudyService studyService) {
+ _studyService = studyService;
+ }
+}
<property name="studyService" ref="studyService" />
</bean>
+ <bean id="removeStudyAction" class="org.splat.simer.RemoveStudyAction"
+ scope="prototype" parent="baseAction">
+ <property name="studyService" ref="studyService" />
+ </bean>
+
<!--========= Inherited from displayStudyStepAction ========= -->
<bean id="studyPropertiesAction"
<property name="userService" ref="userService" />
</bean>
- <bean id="editStudyAction" class="org.splat.simer.EditStudyAction"
- scope="prototype" parent="displayStudyStepAction">
- <property name="studyService" ref="studyService" />
- </bean>
-
+ <bean id="editStudyAction" class="org.splat.simer.EditStudyAction"
+ scope="prototype" parent="displayStudyStepAction">
+ </bean>
+
<bean id="editScenarioPropertiesAction"
class="org.splat.simer.EditScenarioPropertiesAction" scope="prototype"
parent="displayStudyStepAction">
<property name="projectSettings" ref="projectSettings" />
<property name="publicationService" ref="publicationService" />
<property name="stepService" ref="stepService" />
+ <property name="studyService" ref="studyService" />
<property name="repositoryService" ref="repositoryService" />
</bean>
page.displaystudy
</result>
</action>
- <action name="close-study" class="displayStudyStepAction"
- method="close">
- <result name="success" type="tiles">page.home</result>
- </action>
+ <action name="close-study" class="displayStudyStepAction"
+ method="close">
+ <result name="success" type="tiles">page.home</result>
+ </action>
+ <action name="remove-study" class="removeStudyAction"
+ method="remove">
+ <result name="success" type="tiles">page.home</result>
+ </action>
<action name="prop-study" class="studyPropertiesAction"
method="initialize">
<result name="display" type="tiles">