import org.splat.dal.bo.som.Scenario;
import org.splat.dal.bo.som.SimulationContext;
import org.splat.dal.bo.som.Study;
+import org.splat.dal.bo.som.UsesRelation;
import org.splat.kernel.Do;
import org.splat.log.AppLogger;
import org.splat.manox.Toolbox;
* User rights on the selected step.
*/
private transient StepRights _urightstep;
+ /**
+ * The study version.
+ */
private transient String _version;
+ /**
+ * The study creation date.
+ */
private transient String _credate;
+ /**
+ * The study modification date.
+ */
private transient String _lasdate;
+ /**
+ * The selected document publication.
+ */
private transient Publication _selecdoc;
/**
* Injected step service.
*/
private StudyService _studyService;
- // ==============================================================================================================================
+ // =========================================================================
// Constructor
- // ==============================================================================================================================
+ // =========================================================================
/**
* Open the given study in the current http session.
return this;
}
- // ==============================================================================================================================
+ // =========================================================================
// Getters
- // ==============================================================================================================================
+ // =========================================================================
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.splat.service.dto.Proxy#getAuthorName()
+ */
@Override
public String getAuthorName() {
return _mystudy.getAuthor().toString();
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.splat.service.dto.Proxy#getIndex()
+ */
@Override
public Long getIndex() {
return _mystudy.getIndex();
}
+ /**
+ * Get creation date.
+ *
+ * @return the date
+ */
public String getDate() {
return _credate;
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.splat.simer.AbstractOpenObject#getMenu()
+ */
@Override
public StudyMenu getMenu() {
return (StudyMenu) _menu;
}
+ /**
+ * Set study menu.
+ *
+ * @param aMenu
+ * the study menu
+ */
public void setMenu(final StudyMenu aMenu) {
_menu = aMenu;
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.splat.service.dto.Proxy#getProgressState()
+ */
@Override
public ProgressState getProgressState() {
return _mystudy.getProgressState();
}
+ /**
+ * Get last modification date.
+ *
+ * @return the date
+ */
public String getLastModificationDate() {
return _lasdate;
}
+ /**
+ * Get the toolbar with buttons of available modules.
+ *
+ * @return the toolbar
+ */
public ToolBar getModuleBar() {
return getApplicationSettings().getModuleBar(getSelectedStep());
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.splat.service.dto.Proxy#getReference()
+ */
@Override
public String getReference() {
return _mystudy.getReference();
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.splat.simer.OpenStudyServices#getSelectedDocument()
+ */
@Override
public Publication getSelectedDocument() {
return _selecdoc;
}
+ /**
+ * Get user rights for the selected step.
+ *
+ * @return user step rights
+ */
public StepRights getSelectedStepRights() {
return _urightstep;
}
+ /**
+ * Get user rights for the study.
+ *
+ * @return user study rights
+ */
public StudyRights getStudyRights() {
return _urightstudy;
}
+ /**
+ * Get the detached study object.
+ *
+ * @return the detached study object
+ */
public Study getStudyObject() {
return _mystudy;
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.splat.service.dto.Proxy#getTitle()
+ */
@Override
public String getTitle() {
return _mystudy.getTitle();
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.splat.service.dto.Proxy#getType()
+ */
@Override
public String getType() {
/*
return Constants.STUDY_MENU;
}
+ /**
+ * Get the study version.
+ *
+ * @return the version string
+ */
public String getVersion() {
return _version;
}
+ /**
+ * Check if the selected step is enabled for writing.
+ *
+ * @return true if the selected step is enabled for writing
+ */
public boolean isStepEnabled() {
return _urightstep.isEnabled();
}
- // ==============================================================================================================================
+ // =========================================================================
// Public services
- // ==============================================================================================================================
+ // =========================================================================
@Override
public URL newTemplateBasedDocument(final String typename, final User author) {
}
}
+ /**
+ * Select an activity (step).
+ *
+ * @param step
+ * the key of the step to select
+ */
public void setSelection(final String step) {
if (!step.equals(_selection)) {
_selection = step;
setupContents(); // The contents may have changed even if the selection is the same
}
- // ==============================================================================================================================
+ // =========================================================================
// Protected services
- // ==============================================================================================================================
+ // =========================================================================
+ /**
+ * Add a new document presentation facade.
+ *
+ * @param doc
+ * the document publication
+ */
protected void add(final Publication doc) {
DocumentFacade facade = new DocumentFacade(this, doc,
getProjectSettings(), getPublicationService(),
if (first) {
this.getMenu().refreshSelectedItem();
}
-
+ // Refresh dependencies. They can not be removed until removing this document.
+ for (Publication pub : doc.getRelations(UsesRelation.class)) {
+ update(pub);
+ }
}
+ /**
+ * Add a simulation context presentation facade.
+ *
+ * @param contex
+ * the simulation context to add
+ */
protected void add(final SimulationContext contex) {
SimulationContextFacade facade = new SimulationContextFacade(contex,
getProjectSettings().getAllSteps(), getApplicationSettings());
_context.add(facade);
}
+ /**
+ * Add a knowledge element presentation facade.
+ *
+ * @param kelm
+ * the knowledge element to add
+ */
protected void add(final KnowledgeElement kelm) {
KnowledgeElementFacade facade = new KnowledgeElementFacade(BeanHelper
.copyBean(kelm, KnowledgeElementDTO.class),
}
}
+ /**
+ * Remove the document presentation facade.
+ *
+ * @param doctag
+ * the document publication to remove
+ */
protected void remove(final Publication doctag) {
for (Iterator<DocumentFacade> i = _contents.iterator(); i.hasNext();) {
DocumentFacade facade = i.next();
}
}
+ /**
+ * Change the currently connected user and refresh user's rights.
+ *
+ * @param user
+ * the new connected user
+ */
protected void changeUser(final User user) {
_cuser = user;
_popup = null;
_urightstep = new StepRights(_cuser, _ustep);
}
+ /**
+ * Remove the simulation context presentation facade.
+ *
+ * @param contex
+ * the simulation context to remove
+ */
protected void remove(final SimulationContext contex) {
for (Iterator<SimulationContextFacade> i = _context.iterator(); i
.hasNext();) {
SimulationContextFacade facade = i.next();
- if (!facade.isFacadeOf(contex)) {
- continue;
+ if (facade.isFacadeOf(contex)) {
+ i.remove();
+ break;
}
- i.remove();
- break;
}
}
+ /**
+ * Remove the knowledge element presentation facade.
+ *
+ * @param kelm
+ * the knowledge element to remove
+ */
protected void remove(final KnowledgeElement kelm) {
// RKV: KnowledgeIterator known = _knowledge.get((int) (kelm.getType()
// RKV: .getIndex() - 2));
}
}
+ /**
+ * Refresh the document presentation facade.
+ *
+ * @param doc
+ * the document publication
+ */
protected void update(final Publication doc) {
DocumentFacade facade = _docpres.get(doc.getIndex());
if (facade != null) {
}
}
+ /**
+ * Refresh the knowledge element presentation facade.
+ *
+ * @param kelm
+ * the knowledge element DTO
+ */
protected void update(final KnowledgeElementDTO kelm) {
KnowledgeElementFacade facade = _knowpres.get(kelm.getIndex());
if (facade != null) {
}
}
+ /**
+ * Refresh simulation contexts presentation facades.
+ */
protected void updateSimulationContexts() {
_context.clear();
for (Iterator<Step> i = _involving.iterator(); i.hasNext();) {
}
}
- // ==============================================================================================================================
+ // =========================================================================
// Private services
- // ==============================================================================================================================
+ // =========================================================================
private void setupPreviousToSelectedSteps() {
String[] item = _selection.split("\\x2E");
_documentService = documentService;
}
+ /**
+ * Get the detached study object.
+ *
+ * @return the detached study object
+ */
public Study getMystudy() {
return _mystudy;
}
+ /**
+ * Set the study to present.
+ *
+ * @param mystudy
+ * the selected study detached object
+ */
public void setMystudy(final Study mystudy) {
this._mystudy = mystudy;
}