import java.util.List;
import java.util.Vector;
-import org.hibernate.Session;
-import org.hibernate.Transaction;
import org.splat.kernel.InvalidPropertyException;
import org.splat.kernel.Name;
import org.splat.dal.bo.kernel.User;
import org.splat.som.ApplicationRights;
-import org.splat.dal.dao.som.Database;
import org.splat.service.SimulationContextService;
import org.splat.service.UserService;
import org.splat.service.technical.ProjectSettingsService;
// ==============================================================================================================================
public String doSubmitForm() {
- // -----------------------------
// Identification of the user action
UserAction action = UserAction.refreshResult;
if (ctype != null && Integer.valueOf(ctype) > 0)
action = UserAction.cancelSelect;
}
// Execution of the user action
- Session connex = Database.getCurSession();
- Transaction transax = connex.beginTransaction();
String done;
try {
saveFilter(); // Also reinitializes the form, if needed
setContextTypeOptions(getInvolvedContexts()); // Done in other do functions, when required
}
setCandidates();
- transax.commit();
return done;
} catch (Exception error) {
// No need to roll back the transaction as it is read only
@SuppressWarnings("unchecked")
protected String doSelectContextType() {
- // ---------------------------------------
SimulationContext.Properties sprop = new SimulationContext.Properties();
newtype = getSimulationContextService().selectType(
}
protected String doAddContext() {
- // --------------------------------
SimulationContext selected = getSimulationContextService()
.selectSimulationContext(Integer.valueOf(cvalue));
}
protected String doRemoveContext() {
- // -----------------------------------
int index = Integer.valueOf(cindex);
for (Iterator<SimulationContext> selected = context.iterator(); selected
.hasNext();) {
@SuppressWarnings("unchecked")
protected String doCancel() {
- // ----------------------------
result = (List<Proxy>) getSession().get("search.result"); // Current result search
setContextTypeOptions(getInvolvedContexts()); // Sets critext
return "refresh";
// ==============================================================================================================================
public String getAuthor() {
- // --------------------------
return author;
}
public List<Name> getCandidates() {
- // ----------------------------------
return manager;
}
public List<SimulationContextType> getContextTypeOptions() {
- // -----------------------------------------------------------
return critext;
}
public List<SimulationContext> getContextValueOptions() {
- // --------------------------------------------------------
return newvalue;
}
public SimulationContextType getSelectedContextType() {
- // ------------------------------------------------------
return newtype;
}
public List<SimulationContext> getSimulationContexts() {
- // -------------------------------------------------------
return context;
}
public List<Proxy> getResult() {
- // -------------------------------
return result;
}
// ==============================================================================================================================
public void setAuthor(String index) {
- // ------------------------------------
this.author = index;
}
public void setContextType(String type) {
- // ----------------------------------------
this.ctype = type;
}
public void setContextValue(String value) {
- // ------------------------------------------
this.cvalue = value;
}
public void setContextIndex(String value) {
- // ------------------------------------------
this.cindex = value;
}
protected void setCandidates() {
- // -------------------------------
manager = new Vector<Name>();
List<User> users = getUserService().selectAllUsers();
User me = getConnectedUser(); // May be null
}
protected void setContextTypeOptions(List<SimulationContextType> critext) {
- // --------------------------------------------------------------------------
for (Iterator<SimulationContext> i = context.iterator(); i.hasNext();) {
critext.remove(i.next().getType()); // Already used context type
}