}
public static Session getCurSession() {
- // -----------------------------------
return getInstance().getSession();
}
public Database getCheckedDB() {
- // -------------------------------
if (my == null)
try {
my = this;
// ==============================================================================================================================
public boolean isInitialized() {
- // -------------------------------
return (uplevel >= 0);
}
public void initialize() throws IOException, SQLException {
- // -------------------------
logger.info("Creation of the database.");
// Creation of the Lucene index
// ==============================================================================================================================
public void configure(Properties reprop) throws IOException {
- // --------------------------------------------
String basepath = reprop.getProperty("repository");
getRepositoryService().setBasepath(basepath);
getIndexService().configure();
}
protected void populate() {
- // --------------------------
try {
// Initialization of the schema version
this.setSchemaVersion("D0.3"); // TODO: Get the version name from the configuration file
package org.splat.service;
import java.util.List;
-
import org.splat.dal.bo.som.KnowledgeElement;
import org.splat.dal.bo.som.Study;
+import org.splat.service.dto.ImportedStudyDTO;
import org.splat.service.dto.Proxy;
/**
* Search service interface.
+ *
* @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
*/
public interface SearchService {
+ /**
+ * Get a list of studies which are currently not presented in the lucene index.
+ *
+ * @return list of ImportedStudy DTO
+ */
+ public List<ImportedStudyDTO> selectStudies();
+
/**
* Refresh lucene index for studies.
*
/**
* Find knowledge elements with given properties.
- * @param kprop search filter parameters
+ *
+ * @param kprop
+ * search filter parameters
* @return the list of found knowledge elements as proxiy results of lucene search
*/
public List<Proxy> selectKnowledgeElementsWhere(
/**
* Find studies with given properties.
- * @param sprop search filter parameters
+ *
+ * @param sprop
+ * search filter parameters
* @return the list of found studies as proxiy results of lucene search
*/
public List<Proxy> selectStudiesWhere(Study.Properties... sprop);
/**
* Refresh lucene index for a study.
- * @param study the study to reindex
+ *
+ * @param study
+ * the study to reindex
*/
public void indexStudy(Study study);
}
import org.splat.dal.bo.som.SimulationContext;
import org.splat.dal.bo.som.Study;
import org.splat.dal.bo.som.Visibility;
+import org.splat.dal.dao.som.StudyDAO;
import org.splat.service.dto.Proxy;
import org.splat.service.technical.IndexService;
import org.splat.service.technical.IndexServiceImpl;
import org.splat.service.technical.RepositoryService;
+import org.splat.service.dto.ImportedStudyDTO;
+import org.splat.util.BeanHelper;
import org.springframework.transaction.annotation.Transactional;
/**
* Injected index service.
*/
private IndexService _indexService;
-
/**
* Injected study service.
*/
private StudyService _studyService;
+ /**
+ * Injected study DAO.
+ */
+ private StudyDAO _studyDAO;
+
+ /**
+ * Get a list of studies which are currently not presented in the lucene index.
+ * @return list of ImportedStudy DTO
+ */
+ @Transactional(readOnly=true)
+ public List<ImportedStudyDTO> selectStudies() {
+ List<ImportedStudyDTO> table = new ArrayList<ImportedStudyDTO>();
+ Study.Properties sprop = new Study.Properties();
+ List<Study> dbStudies = getStudyDAO().getAll();
+
+ for (Study aStudy : dbStudies) {
+ try {
+ sprop.clear();
+ if (selectStudiesWhere(
+ sprop.setReference(aStudy.getReference())).size() != 0) {
+ // If this study was already indexed and found in the lucene index
+ // then skip it to avoid adding to the index it again.
+ continue;
+ }
+ } catch (Exception error) {
+ continue;
+ }
+ // Add the study to the list of studies which are
+ // currently not presented in the lucene index.
+ table.add(BeanHelper.copyBean(aStudy, ImportedStudyDTO.class));
+ }
+ return table;
+ }
/**
* Refresh lucene index for studies.
* @see org.splat.service.SearchService#indexStudy(org.splat.dal.bo.som.Study)
*/
public void indexStudy(Study study) {
- logger.debug("Index study: id=" + study.getRid() + "; reference=" + study.getReference());
+ logger.debug("Index study: id=" + study.getRid() + "; reference="
+ + study.getReference());
try {
Study.Properties sprop = new Study.Properties();
List<Proxy> index = selectStudiesWhere(sprop.setReference(study
IndexService lucin = getIndex();
Scenario[] scenes = study.getScenarii();
- logger.debug("Number of study " + study.getReference() + " actors: " + study.getActor().size());
+ logger.debug("Number of study " + study.getReference()
+ + " actors: " + study.getActor().size());
lucin.add(study);
if (study.getProgressState() != ProgressState.inWORK)
for (int i = 0; i < scenes.length; i++) {
for (Iterator<KnowledgeElement> j = list.iterator(); j
.hasNext();) {
lucin.add(j.next());
- logger.debug("Knowlegge added: id=" + j.next().getIndex());
+ logger.debug("Knowlegge added: id="
+ + j.next().getIndex());
}
}
} catch (Exception error) {
- logger.error("Unable to index the study '"
- + study.getIndex() + "', reason:", error);
+ logger.error("Unable to index the study '" + study.getIndex()
+ + "', reason:", error);
}
}
/**
* Get the studyService.
+ *
* @return the studyService
*/
public StudyService getStudyService() {
/**
* Set the studyService.
- * @param studyService the studyService to set
+ *
+ * @param studyService
+ * the studyService to set
*/
public void setStudyService(StudyService studyService) {
_studyService = studyService;
}
+
+ /**
+ * Get the studyDAO.
+ *
+ * @return the studyDAO
+ */
+ public StudyDAO getStudyDAO() {
+ return _studyDAO;
+ }
+
+ /**
+ * Set the studyDAO.
+ *
+ * @param studyDAO
+ * the studyDAO to set
+ */
+ public void setStudyDAO(StudyDAO studyDAO) {
+ _studyDAO = studyDAO;
+ }
}
--- /dev/null
+package org.splat.service.dto;
+
+/**
+ * DTO for a study in the reindexing form.
+ *
+ * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
+ */
+public class ImportedStudyDTO {
+
+ /**
+ * DB primary key.
+ */
+ private long rid;
+ /**
+ * Study reference.
+ */
+ private String sid;
+ /**
+ * Study title.
+ */
+ private String title;
+
+ /**
+ * Get the rid.
+ * @return the rid
+ */
+ public long getIndex() {
+ return rid;
+ }
+
+ /**
+ * Get the rid.
+ * @return the rid
+ */
+ public long getRid() {
+ return rid;
+ }
+
+ /**
+ * Set the rid.
+ * @param rid the rid to set
+ */
+ public void setRid(long rid) {
+ this.rid = rid;
+ }
+
+ /**
+ * Get the sid.
+ * @return the sid
+ */
+ public String getReference() {
+ return sid;
+ }
+
+ /**
+ * Set the sid.
+ * @param sid the sid to set
+ */
+ public void setReference(String sid) {
+ this.sid = sid;
+ }
+
+ /**
+ * Get the title.
+ * @return the title
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * Set the title.
+ * @param title the title to set
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+}
\ No newline at end of file
<property name="indexService" ref="indexService" />
<property name="repositoryService" ref="repositoryService" />
<property name="studyService" ref="studyService" />
+ <property name="studyDAO" ref="studyDAO" />
</bean>
<bean id="stepService" class="org.splat.service.StepServiceImpl">
// ==============================================================================================================================
private void setupDefaultUses(DocumentType type) {
- // -------------------------------------------------
Set<DocumentType> uses = type.getDefaultUses();
for (Iterator<DocumentType> i = uses.iterator(); i.hasNext();) {
import java.util.List;
-import org.hibernate.Session;
-import org.hibernate.Transaction;
-import org.splat.dal.dao.som.Database;
import org.splat.dal.bo.som.KnowledgeElement;
import org.splat.service.KnowledgeElementService;
import org.splat.som.Step;
-
public class DisplayKnowledgeAction extends DisplayBaseAction {
- protected OpenKnowledge myknelm = null; // Knowledge Element details
+ /**
+ * Serial version ID.
+ */
+ private static final long serialVersionUID = 8473504456981431762L;
+
+ /**
+ * Current knowledge element details.
+ */
+ protected OpenKnowledge myknelm = null;
+ /**
+ * Injected knowledge element service.
+ */
private KnowledgeElementService _knowledgeElementService;
-
- private static final long serialVersionUID = 8473504456981431762L;
-// ==============================================================================================================================
-// Action methods
-// ==============================================================================================================================
-
- public String doOpen () {
-// -----------------------
- Session connex = Database.getCurSession();
- Transaction transax = connex.beginTransaction();
-
- myknelm = getOpenKnowledge();
- if (myindex != null) try { // Opening a knowledge from the search result
- int index = Integer.valueOf(myindex);
- if (myknelm != null && myknelm.getIndex() == index) { // - The selected knowledge is currently open
- selection = myknelm.getSelection(); // Current selection
- } else { // - The selected knowledge is new
- KnowledgeElement kelm = getKnowledgeElementService().selectKnowledgeElement(index);
- myknelm = open(kelm);
- selection = myknelm.getSelection(); // Default selection
- }
- }
- catch (Exception error) {
- logger.error("Reason:", error);
- return ERROR;
- }
- else if (selection != null) { // Re-opening (refreshing) the currently open knowledge
- KnowledgeElement kelm = getKnowledgeElementService().selectKnowledgeElement(myknelm.getIndex());
- myknelm = open(kelm); // Closes the previously open knowledge
- myknelm.setSelection(selection);
- }
- getSession().put("menu.knowledge", myknelm.getMenu());
-
- transax.commit();
- return SUCCESS;
- }
-
- public String doSelectStep () {
-// -----------------------------
- Session connex = Database.getCurSession();
- Transaction transax = connex.beginTransaction();
-
- myknelm = getOpenKnowledge();
-
- if (selection == null) { // Switch back to the current study
- selection = myknelm.getSelection();
- } else { // Selection of a step of current study
- myknelm.setSelection(selection);
- }
- transax.commit();
- return SUCCESS;
- }
-
- public String doSelectDocument () {
-// ---------------------------------
- Execute todo = Execute.valueOf(action);
- myknelm = getOpenKnowledge();
- if (todo == Execute.develop) myknelm.developDocument(myindex);
- else if (todo == Execute.reduce) myknelm.reduceHistory(myindex);
- else if (todo == Execute.reduceall) myknelm.reduceDocument(myindex);
- return SUCCESS;
- }
-
- public String doSelectKnowledge () {
-// ----------------------------------
- Execute todo = Execute.valueOf(action);
- myknelm = getOpenKnowledge();
- if (todo == Execute.develop) myknelm.developKnowledge(myindex);
- else if (todo == Execute.reduce) myknelm.reduceKnowledge(myindex);
- return SUCCESS;
- }
-
- public String doClose () {
-// ------------------------
- closeKnowledge();
- return SUCCESS;
- }
-// ==============================================================================================================================
-// Getters
-// ==============================================================================================================================
-
- public List<DocumentFacade> getDocuments () {
-// --------------------------------------------
- return myknelm.getDisplayedDocuments();
- }
- public List<OpenObject.KnowledgeIterator> getKnowledges () {
-// ----------------------------------------------------------
- return myknelm.getDisplayedKnowledges();
- }
- public List<SimulationContextFacade> getSimulationContexts () {
-// -------------------------------------------------------------
- return myknelm.getDisplayedSimulationContexts();
- }
- public Step getSelectedStep () {
-// ------------------------------
- return myknelm.getSelectedStep();
- }
- public String getWriteAccess () {
-// -------------------------------
- return "false";
- }
+ // ==============================================================================================================================
+ // Action methods
+ // ==============================================================================================================================
+
+ public String doOpen() {
+ myknelm = getOpenKnowledge();
+ if (myindex != null)
+ try { // Opening a knowledge from the search result
+ int index = Integer.valueOf(myindex);
+ if (myknelm != null && myknelm.getIndex() == index) { // - The selected knowledge is currently open
+ selection = myknelm.getSelection(); // Current selection
+ } else { // - The selected knowledge is new
+ KnowledgeElement kelm = getKnowledgeElementService()
+ .selectKnowledgeElement(index);
+ myknelm = open(kelm);
+ selection = myknelm.getSelection(); // Default selection
+ }
+ } catch (Exception error) {
+ logger.error("Reason:", error);
+ return ERROR;
+ }
+ else if (selection != null) { // Re-opening (refreshing) the currently open knowledge
+ KnowledgeElement kelm = getKnowledgeElementService()
+ .selectKnowledgeElement(myknelm.getIndex());
+ myknelm = open(kelm); // Closes the previously open knowledge
+ myknelm.setSelection(selection);
+ }
+ getSession().put("menu.knowledge", myknelm.getMenu());
+
+ return SUCCESS;
+ }
+
+ public String doSelectStep() {
+ myknelm = getOpenKnowledge();
+
+ if (selection == null) { // Switch back to the current study
+ selection = myknelm.getSelection();
+ } else { // Selection of a step of current study
+ myknelm.setSelection(selection);
+ }
+ return SUCCESS;
+ }
+
+ public String doSelectDocument() {
+ Execute todo = Execute.valueOf(action);
+ myknelm = getOpenKnowledge();
+ if (todo == Execute.develop)
+ myknelm.developDocument(myindex);
+ else if (todo == Execute.reduce)
+ myknelm.reduceHistory(myindex);
+ else if (todo == Execute.reduceall)
+ myknelm.reduceDocument(myindex);
+ return SUCCESS;
+ }
+
+ public String doSelectKnowledge() {
+ Execute todo = Execute.valueOf(action);
+ myknelm = getOpenKnowledge();
+ if (todo == Execute.develop)
+ myknelm.developKnowledge(myindex);
+ else if (todo == Execute.reduce)
+ myknelm.reduceKnowledge(myindex);
+ return SUCCESS;
+ }
+
+ public String doClose() {
+ closeKnowledge();
+ return SUCCESS;
+ }
+
+ // ==============================================================================================================================
+ // Getters
+ // ==============================================================================================================================
+
+ public List<DocumentFacade> getDocuments() {
+ return myknelm.getDisplayedDocuments();
+ }
+
+ public List<OpenObject.KnowledgeIterator> getKnowledges() {
+ return myknelm.getDisplayedKnowledges();
+ }
+
+ public List<SimulationContextFacade> getSimulationContexts() {
+ return myknelm.getDisplayedSimulationContexts();
+ }
+
+ public Step getSelectedStep() {
+ return myknelm.getSelectedStep();
+ }
+
+ public String getWriteAccess() {
+ return "false";
+ }
/**
* Get the knowledgeElementService.
+ *
* @return the knowledgeElementService
*/
public KnowledgeElementService getKnowledgeElementService() {
/**
* Set the knowledgeElementService.
- * @param knowledgeElementService the knowledgeElementService to set
+ *
+ * @param knowledgeElementService
+ * the knowledgeElementService to set
*/
public void setKnowledgeElementService(
KnowledgeElementService knowledgeElementService) {
import java.util.List;
-import org.hibernate.Session;
-import org.hibernate.Transaction;
-import org.splat.dal.dao.som.Database;
import org.splat.dal.bo.som.ProjectElement;
import org.splat.dal.bo.som.Scenario;
import org.splat.service.StudyService;
import org.splat.wapp.PopupMenu;
import org.splat.wapp.SimpleMenu;
-
public class DisplayStudyStepAction extends DisplayBaseAction {
- protected OpenStudy mystudy = null; // Presented study
+ /**
+ * Serial version ID.
+ */
+ private static final long serialVersionUID = 6467920934724352021L;
+
+ /**
+ * Presented study.
+ */
+ protected OpenStudy mystudy = null;
+ /**
+ * Injected study service.
+ */
private StudyService _studyService;
- private static final long serialVersionUID = 6467920934724352021L;
+ // ==============================================================================================================================
+ // Action methods
+ // ==============================================================================================================================
+
+ public String doOpen() {
+ Study study;
+ mystudy = getOpenStudy();
+ if (myindex != null)
+ try { // Opening a study from the search result
+ int index = Integer.valueOf(myindex);
+ if (mystudy != null && mystudy.getStudyObject() != null
+ && mystudy.getIndex() == index) { // - The selected study is currently open
+ selection = mystudy.getSelection(); // Current selection
+ study = mystudy.getStudyObject(); // Current Study object
+ // RKV:BEGIN: put in session if necessary
+ if (!getSession().containsKey("study.open")) {
+ open(study);
+ }
+ // RKV:END
+ } else { // - The selected study is new
+ study = getStudyService().selectStudy(index);
+ mystudy = open(study);
+ selection = mystudy.getSelection(); // Default selection
+ }
+ } catch (Exception error) {
+ logger.error("Reason:", error);
+ return ERROR;
+ }
+ else if (selection == null) { // Opening a study just newed
+ selection = mystudy.getSelection(); // Default selection
+ study = mystudy.getStudyObject();
+ } else { // Re-opening (refreshing) the currently open study
+ study = getStudyService().selectStudy(mystudy.getIndex());
+ mystudy = open(study); // Closes the previously open study
+ mystudy.setSelection(selection);
+ }
+ // Initialization of menus
+ ProjectElement owner = mystudy.getSelectedStep().getOwner();
+ SimpleMenu menu = ApplicationSettings.getMenu("configuration");
+ if (owner instanceof Scenario) {
+ menu.enables("prop-scenario");
+ menu.selects("prop-scenario");
+ } else {
+ menu.disables("prop-scenario");
+ menu.selects("prop-general");
+ }
+ getSession().put("menu.study", mystudy.getMenu());
+
+ return SUCCESS;
+ }
+
+ public String doSelectStep() {
+
+ mystudy = getOpenStudy();
+ if (selection == null) { // Switch back to the current study
+ selection = mystudy.getSelection();
+ } else { // Selection of a step of current study
+ mystudy.setSelection(selection);
+ }
+ // Re-initialization of the properties menu according to the selected step
+ ProjectElement owner = mystudy.getSelectedStep().getOwner();
+ SimpleMenu menu = ApplicationSettings.getMenu("configuration");
+ if (owner instanceof Scenario) {
+ menu.enables("prop-scenario");
+ menu.selects("prop-scenario");
+ } else {
+ menu.disables("prop-scenario");
+ menu.selects("prop-general");
+ }
+ return SUCCESS;
+ }
+
+ public String doSelectDocument() {
+ mystudy = getOpenStudy();
+ Execute todo = Execute.valueOf(action);
+ if (todo == Execute.develop)
+ mystudy.developDocument(myindex);
+ else if (todo == Execute.reduce)
+ mystudy.reduceHistory(myindex);
+ else if (todo == Execute.reduceall)
+ mystudy.reduceDocument(myindex);
+ return SUCCESS;
+ }
-// ==============================================================================================================================
-// Action methods
-// ==============================================================================================================================
-
- public String doOpen () {
-// -----------------------
- Session connex = Database.getCurSession();
- Transaction transax = connex.beginTransaction();
- Study study;
-
- mystudy = getOpenStudy();
- if (myindex != null) try { // Opening a study from the search result
- int index = Integer.valueOf(myindex);
- if (mystudy != null && mystudy.getStudyObject() != null && mystudy.getIndex() == index) { // - The selected study is currently open
- selection = mystudy.getSelection(); // Current selection
- study = mystudy.getStudyObject(); // Current Study object
- //RKV:BEGIN: put in session if necessary
- if (!getSession().containsKey("study.open")) {
- open(study);
- }
- //RKV:END
- } else { // - The selected study is new
- study = getStudyService().selectStudy(index);
- mystudy = open(study);
- selection = mystudy.getSelection(); // Default selection
- }
- }
- catch (Exception error) {
- logger.error("Reason:", error);
- return ERROR;
- }
- else if (selection == null) { // Opening a study just newed
- selection = mystudy.getSelection(); // Default selection
- study = mystudy.getStudyObject();
- }
- else { // Re-opening (refreshing) the currently open study
- study = getStudyService().selectStudy(mystudy.getIndex());
- mystudy = open(study); // Closes the previously open study
- mystudy.setSelection(selection);
- }
-// Initialization of menus
- ProjectElement owner = mystudy.getSelectedStep().getOwner();
- SimpleMenu menu = ApplicationSettings.getMenu("configuration");
- if (owner instanceof Scenario) {
- menu.enables("prop-scenario");
- menu.selects("prop-scenario");
- } else {
- menu.disables("prop-scenario");
- menu.selects("prop-general");
- }
- getSession().put("menu.study", mystudy.getMenu());
-
- transax.commit();
- return SUCCESS;
- }
-
- public String doSelectStep () {
-// -----------------------------
- Session connex = Database.getCurSession();
- Transaction transax = connex.beginTransaction();
-
- mystudy = getOpenStudy();
- if (selection == null) { // Switch back to the current study
- selection = mystudy.getSelection();
- } else { // Selection of a step of current study
- mystudy.setSelection(selection);
- }
-// Re-initialization of the properties menu according to the selected step
- ProjectElement owner = mystudy.getSelectedStep().getOwner();
- SimpleMenu menu = ApplicationSettings.getMenu("configuration");
- if (owner instanceof Scenario) {
- menu.enables("prop-scenario");
- menu.selects("prop-scenario");
- } else {
- menu.disables("prop-scenario");
- menu.selects("prop-general");
- }
- transax.commit();
- return SUCCESS;
- }
-
- public String doSelectDocument () {
-// ---------------------------------
- mystudy = getOpenStudy();
-
- Execute todo = Execute.valueOf(action);
- if (todo == Execute.develop) mystudy.developDocument(myindex);
- else if (todo == Execute.reduce) mystudy.reduceHistory(myindex);
- else if (todo == Execute.reduceall) mystudy.reduceDocument(myindex);
- return SUCCESS;
- }
-
- public String doSelectKnowledge () {
-// ----------------------------------
- mystudy = getOpenStudy();
-
- Execute todo = Execute.valueOf(action);
- if (todo == Execute.develop) mystudy.developKnowledge(myindex);
- else if (todo == Execute.reduce) mystudy.reduceKnowledge(myindex);
- return SUCCESS;
- }
-
- public String doClose () {
-// ------------------------
- closeStudy();
- return SUCCESS;
- }
-// ==============================================================================================================================
-// Getters
-// ==============================================================================================================================
-
- public String getAction () {
-// --------------------------
- return action;
- }
- public List<DocumentFacade> getDocuments () {
-// -------------------------------------------
- return mystudy.getDisplayedDocuments();
- }
- public List<OpenObject.KnowledgeIterator> getKnowledges () {
-// ----------------------------------------------------------
- return mystudy.getDisplayedKnowledges();
- }
- public List<SimulationContextFacade> getSimulationContexts () {
-// -------------------------------------------------------------
- return mystudy.getDisplayedSimulationContexts();
- }
- public PopupMenu getPopup () {
-// ----------------------------
- return mystudy.getPopup();
- }
- public int getStepNumber () {
-// ---------------------------
- return mystudy.getSelectedStep().getNumber();
- }
- public String getStepEnabled () {
-// -------------------------------
- return String.valueOf(mystudy.isStepEnabled());
- }
- public StepRights getUserRights () {
-// ----------------------------------
- return mystudy.getSelectedStepRights();
- }
- public String getWriteAccess () {
-// -------------------------------
- return String.valueOf(mystudy.isOpenForWriting());
- }
+ public String doSelectKnowledge() {
+ mystudy = getOpenStudy();
+ Execute todo = Execute.valueOf(action);
+ if (todo == Execute.develop)
+ mystudy.developKnowledge(myindex);
+ else if (todo == Execute.reduce)
+ mystudy.reduceKnowledge(myindex);
+ return SUCCESS;
+ }
+
+ public String doClose() {
+ closeStudy();
+ return SUCCESS;
+ }
+
+ // ==============================================================================================================================
+ // Getters
+ // ==============================================================================================================================
+
+ public String getAction() {
+ return action;
+ }
+
+ public List<DocumentFacade> getDocuments() {
+ return mystudy.getDisplayedDocuments();
+ }
+
+ public List<OpenObject.KnowledgeIterator> getKnowledges() {
+ return mystudy.getDisplayedKnowledges();
+ }
+
+ public List<SimulationContextFacade> getSimulationContexts() {
+ return mystudy.getDisplayedSimulationContexts();
+ }
+
+ public PopupMenu getPopup() {
+ return mystudy.getPopup();
+ }
+
+ public int getStepNumber() {
+ return mystudy.getSelectedStep().getNumber();
+ }
+
+ public String getStepEnabled() {
+ return String.valueOf(mystudy.isStepEnabled());
+ }
+
+ public StepRights getUserRights() {
+ return mystudy.getSelectedStepRights();
+ }
+
+ public String getWriteAccess() {
+ return String.valueOf(mystudy.isOpenForWriting());
+ }
/**
* Get the studyService.
_studyService = studyService;
}
- /**
+ /**
* {@inheritDoc}
+ *
* @see org.splat.simer.Action#setOpenStudy(org.splat.simer.OpenStudy)
*/
@Override
import java.util.Map;
import org.splat.service.SearchService;
+import org.splat.service.dto.ImportedStudyDTO;
import org.splat.simer.Action;
/**
*/
private static final long serialVersionUID = 4194268823457749655L;
- private List<ImportedStudy> newstudies;
+ /**
+ * New studies which are not yet indexed by lucene.
+ */
+ private List<ImportedStudyDTO> newstudies;
+ /**
+ * Id's of studies to reindex.
+ */
private String indices;
- private ImportedStudy _importedStudy;
/**
* Injected search service.
*/
* @return SUCCESS
*/
public String doInitialize() {
- newstudies = getImportedStudy().selectAll();
+ newstudies = getSearchService().selectStudies();
indices = "";
return SUCCESS;
}
*
* @return the new studies
*/
- public List<ImportedStudy> getNewStudies() {
- // -------------------------------------------
+ public List<ImportedStudyDTO> getNewStudies() {
return newstudies;
}
- /**
- * Get the importedStudy.
- *
- * @return the importedStudy
- */
- public ImportedStudy getImportedStudy() {
- return _importedStudy;
- }
-
- /**
- * Set the importedStudy.
- *
- * @param importedStudy
- * the importedStudy to set
- */
- public void setImportedStudy(ImportedStudy importedStudy) {
- _importedStudy = importedStudy;
- }
-
/**
* Get the indices.
* @return the indices
// ==============================================================================================================================
public String doImport () {
-// -------------------------
- Session connex = Database.getCurSession();
- Transaction transax = connex.beginTransaction();
try {
User user = getConnectedUser(); // The database administrator
File updir = getRepositoryService().getDownloadDirectory(user);
i.remove(); // Just for not showing the corresponding reserved username
break;
}
- transax.commit();
return SUCCESS;
}
catch (Exception error) {
+++ /dev/null
-package org.splat.simer.admin;
-
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.Session;
-import org.hibernate.jdbc.Work;
-import org.splat.dal.dao.som.Database;
-import org.splat.dal.bo.som.Study;
-import org.splat.service.SearchService;
-
-
-public class ImportedStudy {
-
- private SearchService _searchService;
- private int rid;
- private String sid;
- private String title;
-
- protected class SelectStudies implements Work {
-// ----------------------------------------------------
-
- private List<ImportedStudy> table = new ArrayList<ImportedStudy>();
-
- protected SelectStudies(SearchService searchService) {
- }
-
- public void execute (Connection connex) throws SQLException
- {
- Statement request = connex.createStatement();
- String select = "SELECT rid,sid,title FROM study";
- ResultSet result = request.executeQuery(select);
- Study.Properties sprop = new Study.Properties();
-
- while (result.next()) {
- int rid = result.getInt("rid");
- String sid = result.getString("sid");
- String title = result.getString("title");
- try {
- sprop.clear();
- if (getSearchService().selectStudiesWhere(sprop.setReference(sid)).size() != 0) continue;
- } catch (Exception error) {
- continue;
- }
- table.add( new ImportedStudy(rid, sid, title) );
- }
- }
-
- public List<ImportedStudy> getResult ()
- {
- return table;
- }
- }
-
-// ==============================================================================================================================
-// Constructor
-// ==============================================================================================================================
-
- public ImportedStudy () {
- }
-
- public ImportedStudy (int rid, String sid, String title) {
- // --------------------------------------------------------
- this.rid = rid;
- this.sid = sid;
- this.title = title;
- }
-
-// ==============================================================================================================================
-// Public member functions
-// ==============================================================================================================================
-
- public int getIndex () {
-// ----------------------
- return rid;
- }
- public String getReference () {
-// -----------------------------
- return sid;
- }
- public String getTitle () {
-// -------------------------
- return title;
- }
-
-// ==============================================================================================================================
-// Public services
-// ==============================================================================================================================
-
- public List<ImportedStudy> selectAll () {
-// ----------------------------------------------
- Session session = Database.getCurSession();
- SelectStudies query = new SelectStudies(getSearchService());
- session.doWork(query);
-
- return query.getResult();
- }
-
- public org.splat.service.SearchService getSearchService() {
- return _searchService;
- }
-
- public void setSearchService(SearchService searchService) {
- _searchService = searchService;
- }
-}
\ No newline at end of file
<property name="documentTypeService" ref="documentTypeService" />
</bean>
- <bean id="importedStudy" class="org.splat.simer.admin.ImportedStudy"
- scope="prototype">
- <property name="searchService" ref="searchService" />
- </bean>
-
<bean id="slidMenu" scope="session" abstract="true">
<property name="projectElementService"
ref="projectElementService" />
<bean id="databaseIndexingAction"
class="org.splat.simer.admin.DatabaseIndexingAction"
scope="prototype">
- <property name="importedStudy" ref="importedStudy" />
<property name="searchService" ref="searchService" />
</bean>