import java.net.URL;
import java.net.URLConnection;
-
public class FileTransfer {
- final static int size = 1024;
+ private final static int SIZE = 1024;
- public static void Download (String path, String filename, String destination) {
-// ------------------------------------------------------------------------------
- URLConnection conx = null; // Communication link between the application and a URL.
- InputStream is = null;
- OutputStream os = null;
- try {
- URL url;
- byte[] buf;
- int ByteRead = 0;
-// int ByteWritten = 0;
+ public static void download(final String path, final String filename,
+ final String destination) {
+ URLConnection conx = null; // Communication link between the application and a URL.
+ InputStream is = null;
+ OutputStream os = null;
+ try {
+ URL url;
+ byte[] buf;
+ // int ByteWritten = 0;
- url = new URL(path);
- os = new BufferedOutputStream( new FileOutputStream(destination + "/" + filename) );
-// The URLConnection object is created by invoking the openConnection method on a URL.
+ url = new URL(path);
+ os = new BufferedOutputStream(new FileOutputStream(destination
+ + "/" + filename));
+ // The URLConnection object is created by invoking the openConnection method on a URL.
- conx = url.openConnection();
- is = conx.getInputStream();
- buf = new byte[size];
- while ((ByteRead = is.read(buf)) != -1) {
- os.write(buf, 0, ByteRead);
-// ByteWritten += ByteRead;
- }
-// System.out.println("File \"" + filename + "\" successfully downloaded");
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- finally {
- try {
- is.close();
- os.close();
- }
- catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
+ conx = url.openConnection();
+ is = conx.getInputStream();
+ buf = new byte[SIZE];
+ int ByteRead = is.read(buf);
+ while (ByteRead != -1) {
+ os.write(buf, 0, ByteRead);
+ ByteRead = is.read(buf);
+ }
+ // System.out.println("File \"" + filename + "\" successfully downloaded");
+ } catch (Exception e) {
+ e.printStackTrace(); // RKV: NOPMD: TODO: try to use logger
+ } finally {
+ try {
+ is.close();
+ os.close();
+ } catch (IOException e) {
+ e.printStackTrace(); // RKV: NOPMD: TODO: try to use logger
+ }
+ }
+ }
}
\ No newline at end of file
import java.awt.Graphics;
import java.awt.Image;
-
public class ToolButton extends Button {
- private Image icon;
- private int orx; // X of the icon top left corner
- private int ory; // Y of the icon top left corner
- private String link;
- private String target;
+ private transient final Image _icon;
+ private transient int _orx; // X of the icon top left corner
+ private transient int _ory; // Y of the icon top left corner
+ private transient final String _link;
+ private transient final String _target;
private static final long serialVersionUID = 5723786125423445749L;
-
-// ==============================================================================================================================
-// Constructors
-// ==============================================================================================================================
- public ToolButton (int size, Image icon, String link) {
-// -----------------------------------------------------
+ // ==============================================================================================================================
+ // Constructors
+ // ==============================================================================================================================
+
+ public ToolButton(final int size, final Image icon, final String link) {
this(size, icon, link, null);
}
- public ToolButton (int size, Image icon, String link, String target) {
-// --------------------------------------------------------------------
- orx = 24; // icon.getWidth(this); seems returning 0 before being painted
- ory = 24; // icon.getHeight(this); seems returning 0 before being painted
- if (orx < size) orx = (size - orx) / 2;
- else orx = 0;
- if (ory < size) ory = (size - ory) / 2;
- else ory = 0;
-
- this.icon = icon;
- this.link = link;
- this.target = target;
- this.setSize(size, size);
- this.setCursor(new Cursor(Cursor.HAND_CURSOR));
+
+ public ToolButton(final int size, final Image icon, final String link,
+ final String target) {
+ super();
+ _orx = 24; // icon.getWidth(this); seems returning 0 before being painted
+ _ory = 24; // icon.getHeight(this); seems returning 0 before being painted
+ if (_orx < size) {
+ _orx = (size - _orx) / 2;
+ } else {
+ _orx = 0;
+ }
+ if (_ory < size) {
+ _ory = (size - _ory) / 2;
+ } else {
+ _ory = 0;
+ }
+
+ this._icon = icon;
+ this._link = link;
+ this._target = target;
+ this.setSize(size, size);
+ this.setCursor(new Cursor(Cursor.HAND_CURSOR));
}
-
-// ==============================================================================================================================
-// Overridden functions
-// ==============================================================================================================================
- public void paint(Graphics screen) {
-// ----------------------------------
- screen.drawImage(icon, orx, ory, new Color(205, 229, 255), this);
- }
-
-// ==============================================================================================================================
-// Member functions
-// ==============================================================================================================================
+ // ==============================================================================================================================
+ // Overridden functions
+ // ==============================================================================================================================
- public String getTool () {
-// ------------------------
- return link;
- }
+ @Override
+ public void paint(final Graphics screen) {
+ screen.drawImage(_icon, _orx, _ory, new Color(205, 229, 255), this);
+ }
- public String getTarget () {
-// --------------------------
- return target;
- }
+ // ==============================================================================================================================
+ // Member functions
+ // ==============================================================================================================================
+
+ public String getTool() {
+ return _link;
+ }
+
+ public String getTarget() {
+ return _target;
+ }
}
\ No newline at end of file
package org.splat.launcher;
+import java.awt.ComponentOrientation;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.awt.ComponentOrientation;
import java.io.ObjectInputStream;
import java.net.URL;
import java.net.URLConnection;
+public class ToolbarApplet extends java.applet.Applet implements ActionListener {
+
+ private static final long serialVersionUID = 3243053622061086715L;
-public class ToolbarApplet extends java.applet.Applet implements ActionListener {
+ // ==============================================================================================================================
+ // Overridden functions
+ // ==============================================================================================================================
- private int width;
- private int height;
+ @Override
+ public void init() {
+ URL appurl = getCodeBase();
+ int hgap = 6; // Gap between icons
+ int ntools;
- private static final long serialVersionUID = 3243053622061086715L;
-
-// ==============================================================================================================================
-// Overridden functions
-// ==============================================================================================================================
+ int width = getSize().width;
+ int height = getSize().height;
+ for (ntools = 0; ntools < (width + hgap) / (height + hgap); ntools++) {
+ String icon = this.getParameter("icon" + ntools);
+ String tool = this.getParameter("tool" + ntools);
+ String file = this.getParameter("file" + ntools); // May be null
+ if (icon != null && tool != null) {
+ ToolButton button = new ToolButton(height, getImage(appurl,
+ "../skin/" + icon), tool, file);
+ add(button); // For displaying the button
+ button.addActionListener(this);
+ }
+ }
+ setLayout(new GridLayout(1, ntools, hgap, 0)); // 1 row, {ntools} buttons
+ applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ }
- public void init () {
-// -------------------
- URL appurl = getCodeBase();
- int hgap = 6; // Gap between icons
- int ntools;
-
- width = getSize().width;
- height = getSize().height;
- for (ntools = 0; ntools < (width+hgap)/(height+hgap); ntools++) {
- String icon = this.getParameter("icon"+ntools);
- String tool = this.getParameter("tool"+ntools);
- String file = this.getParameter("file"+ntools); // May be null
- if (icon != null && tool != null) {
- ToolButton button = new ToolButton(height, getImage(appurl, "../skin/" + icon), tool, file);
- add(button); // For displaying the button
- button.addActionListener(this);
- }
- }
- setLayout( new GridLayout(1, ntools, hgap, 0) ); // 1 row, {ntools} buttons
- applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
- }
+ public void actionPerformed(final ActionEvent event) {
+ // -----------------------------------------------
+ if (event.getSource() instanceof ToolButton) {
+ ToolButton clicked = (ToolButton) event.getSource();
+ String module = clicked.getTool();
+ String target = clicked.getTarget();
+ launch(module, target);
+ }
+ }
- public void actionPerformed (ActionEvent event) {
-// -----------------------------------------------
- if (event.getSource() instanceof ToolButton) {
- ToolButton clicked = (ToolButton)event.getSource();
- String module = clicked.getTool();
- String target = clicked.getTarget();
- launch(module, target);
- }
- }
-
-// ==============================================================================================================================
-// Public member functions
-// ==============================================================================================================================
+ // ==============================================================================================================================
+ // Public member functions
+ // ==============================================================================================================================
- public void launch (String name, String filename) {
-// -------------------------------------------------
- String module = name;
- try {
+ public void launch(final String name, final String filename) {
+ // -------------------------------------------------
+ String module = name;
+ try {
-// Opening a Web page in a new tab
- if (module.startsWith("http")) {
- getAppletContext().showDocument(new URL(module), "_blank");
- } else
+ // Opening a Web page in a new tab
+ if (module.startsWith("http")) {
+ getAppletContext().showDocument(new URL(module), "_blank");
+ } else
-// Opening a Web module in a new tab
- if (module.startsWith("../") || module.startsWith("/")) {
- module = getCodeBase().toString() + module;
- if (filename != null) module = module + "?open=" + filename;
- getAppletContext().showDocument(new URL(module), "_blank");
- } else
+ // Opening a Web module in a new tab
+ if (module.startsWith("../") || module.startsWith("/")) {
+ module = getCodeBase().toString() + module;
+ if (filename != null) {
+ module = module + "?open=" + filename;
+ }
+ getAppletContext().showDocument(new URL(module), "_blank");
+ } else
-// Opening an application on the local machine
- if (module.endsWith(".exe") || module.endsWith(".EXE")) {
- String applikey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Applications\\" + module;
- String valkey = ""; // Default application and file keys
+ // Opening an application on the local machine
+ if (module.endsWith(".exe") || module.endsWith(".EXE")) {
+ String applikey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Applications\\"
+ + module;
+ String valkey = ""; // Default application and file keys
- module = WindowsRegistry.readValue(applikey + "\\shell\\open\\command", valkey);
- if (module == null) module = WindowsRegistry.readValue(applikey + "\\shell\\edit\\command", valkey);
-// if (module == null) module = "\"C:\\Program Files (x86)\\Microsoft Office\\Office14\\WINWORD.EXE\"";
- if (module != null) {
- String[] parse = module.split("/");
- String command = parse[0]; // Removing eventual options
- if (filename != null) {
- String path = "";
-// Opening the application with a server side existing file
- if (filename.startsWith("http")) {
- path = " \"" + filename + "\"";
- }
-// Opening the application with a file previously created by the server
- else if (filename.startsWith("/jsp")) { // Document created through a JSP
- URL my = getDocumentBase();
- String http = "http://" + my.getHost() + ":" + my.getPort() + "/";
- String[] jsppath = my.getPath().split("/"); // Parses "/webapp/..."
- String location = http + jsppath[1] + filename;
+ module = WindowsRegistry.readValue(applikey
+ + "\\shell\\open\\command", valkey);
+ if (module == null) {
+ module = WindowsRegistry.readValue(applikey
+ + "\\shell\\edit\\command", valkey);
+ }
+ // if (module == null) module = "\"C:\\Program Files (x86)\\Microsoft Office\\Office14\\WINWORD.EXE\"";
+ if (module == null) {
+ module = getCodeBase().toString()
+ + "error.jsp?message=launch&value=" + name;
+ getAppletContext().showDocument(new URL(module));
+ } else {
+ String[] parse = module.split("/");
+ String command = parse[0]; // Removing eventual options
+ if (filename != null) {
+ String path = "";
+ // Opening the application with a server side existing file
+ if (filename.startsWith("http")) {
+ path = " \"" + filename + "\"";
+ }
+ // Opening the application with a file previously created by the server
+ else if (filename.startsWith("/jsp")) { // Document created through a JSP
+ URL my = getDocumentBase();
+ String http = "http://" + my.getHost() + ":"
+ + my.getPort() + "/";
+ String[] jsppath = my.getPath().split("/"); // Parses "/webapp/..."
+ String location = http + jsppath[1] + filename;
- URLConnection connection = new URL(location).openConnection();
- ObjectInputStream fromservlet = new ObjectInputStream(connection.getInputStream());
- URL docurl = (URL)fromservlet.readObject();
+ URLConnection connection = new URL(location)
+ .openConnection();
+ ObjectInputStream fromservlet = new ObjectInputStream(
+ connection.getInputStream());
+ URL docurl = (URL) fromservlet.readObject();
- fromservlet.close();
- if (docurl != null) path = " " + docurl.toString();
- }
- command = command + path;
- }
- Runtime.getRuntime().exec(command);
- } else {
- module = getCodeBase().toString() + "error.jsp?message=launch&value=" + name;
- getAppletContext().showDocument(new URL(module));
- }
- }
- } catch (Exception error) {
- error.printStackTrace();
- }
- }
+ fromservlet.close();
+ if (docurl != null) {
+ path = " " + docurl.toString();
+ }
+ }
+ command = command + path;
+ }
+ Runtime.getRuntime().exec(command);
+ }
+ }
+ } catch (Exception error) {
+ error.printStackTrace(); // RKV: NOPMD: TODO: try to use logger
+ }
+ }
}
\ No newline at end of file
import java.io.InputStreamReader;
import java.io.StringWriter;
-
public class WindowsRegistry {
- static class StreamReader extends Thread {
-// ----------------------------------------
- private InputStream is;
- private StringWriter sw= new StringWriter();;
+ private static final String REG_SZ = "REG_SZ";
+
+ static class StreamReader extends Thread { //RKV: NOPMD: TODO: Clarify the purpose of this class and then fix
+ private transient final InputStream _is;
+ private transient final StringWriter _sw = new StringWriter();;
+
+ public StreamReader(final InputStream is) {
+ super();
+ this._is = is;
+ }
+
+ @Override
+ public void run() {
+ try {
+ int c = _is.read();
+ while (c != -1) {
+ _sw.write(c);
+ c = _is.read();
+ }
+ } catch (IOException e) {
+ e.printStackTrace(); // RKV: NOPMD: TODO: try to use logger
+ }
+ }
+
+ public String getResult() {
+ return _sw.toString();
+ }
+ }
+
+ public static final String readValue(final String location, final String key) {
+ String res = null;
+ try {
+ // Run reg query, then read output with StreamReader (internal class)
+ String aKey;
+ if (key.length() == 0) {
+ aKey = "/ve"; // Looking for the default key
+ } else {
+ aKey = "/v " + key;
+ }
- public StreamReader(InputStream is) {
- this.is = is;
- }
- public void run() {
- try {
- int c;
- while ((c = is.read()) != -1) sw.write(c);
- }
- catch (IOException e) {
- }
- }
- public String getResult() {
- return sw.toString();
- }
- }
+ Process process = Runtime.getRuntime().exec(
+ "reg query " + location + " " + aKey);
+ BufferedReader buffer = new BufferedReader(new InputStreamReader(
+ process.getInputStream()));
- public static final String readValue (String location, String key) {
-// ------------------------------------------------------------------
- try {
-// Run reg query, then read output with StreamReader (internal class)
- if (key.length() == 0) key = "/ve"; // Looking for the default key
- else key = "/v " + key;
-
- Process process = Runtime.getRuntime().exec("reg query " + location + " " + key);
- BufferedReader buffer = new BufferedReader( new InputStreamReader(process.getInputStream()) );
-
-// Output has the following format:
-// \n<Version information>\n\n<key>\t<registry type>\t<value>
- String output = null;
- String value = "REG_SZ";
- while ((output = buffer.readLine()) != null) {
- if (output.contains(value)) {
- int index = output.indexOf(value) + value.length() + 1;
- return output.substring(index).trim();
- }
- }
- return null;
-// StreamReader reader = new StreamReader(process.getInputStream());
+ // Output has the following format:
+ // \n<Version information>\n\n<key>\t<registry type>\t<value>
+ String output = buffer.readLine();
+ while (output != null) {
+ if (output.contains(REG_SZ)) {
+ int index = output.indexOf(REG_SZ) + REG_SZ.length() + 1;
+ res = output.substring(index).trim();
+ break;
+ }
+ output = buffer.readLine();
+ }
+ // StreamReader reader = new StreamReader(process.getInputStream());
-// reader.start();
-// process.waitFor();
-// reader.join();
-// String output = reader.getResult();
+ // reader.start();
+ // process.waitFor();
+ // reader.join();
+ // String output = reader.getResult();
-// Output has the following format:
-// \n<Version information>\n\n<key>\t<registry type>\t<value>
-// if( ! output.contains("\t") ){
-// return null;
-// }
-// Parse out the value
-// String[] parsed = output.split("\t");
-// return parsed[parsed.length-1];
- }
- catch (Exception e) {
- return null;
- }
- }
+ // Output has the following format:
+ // \n<Version information>\n\n<key>\t<registry type>\t<value>
+ // if( ! output.contains("\t") ){
+ // return null;
+ // }
+ // Parse out the value
+ // String[] parsed = output.split("\t");
+ // return parsed[parsed.length-1];
+ } catch (Exception e) {
+ e.printStackTrace(); // RKV: NOPMD: TODO: try to use logger
+ }
+ return res;
+ }
}
\ No newline at end of file
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.Set;
-import java.util.Vector;
import org.hibernate.Session;
import org.hibernate.Transaction;
-
-import org.splat.simer.Action;
-import org.splat.simer.ApplicationSettings;
-import org.splat.dal.dao.som.Database;
import org.splat.dal.bo.som.KnowledgeElement;
import org.splat.dal.bo.som.ProgressState;
+import org.splat.dal.bo.som.SimulationContext;
+import org.splat.dal.bo.som.SimulationContextType;
+import org.splat.dal.bo.som.Study;
+import org.splat.dal.dao.som.Database;
import org.splat.service.KnowledgeElementService;
import org.splat.service.SearchService;
import org.splat.service.SimulationContextService;
-import org.splat.service.technical.ProjectSettingsService;
import org.splat.service.dto.Proxy;
import org.splat.service.dto.SimulationContextFacade;
-import org.splat.dal.bo.som.SimulationContext;
-import org.splat.dal.bo.som.SimulationContextType;
-import org.splat.dal.bo.som.Study;
+import org.splat.service.technical.ProjectSettingsService;
+import org.splat.simer.Action;
+import org.splat.simer.ApplicationSettings;
/**
* Action for operations on simulation contexts.
*/
private static final long serialVersionUID = 7083323229359094699L;
- private List<SimulationContextFacade> tocheck; // Simulation contexts to be approved
- private int selection; // Index of the selected simulation context presented in the approval form
- private SimulationContext edition; // Corresponding simulation context object
- private ProjectSettingsService.Step step; // Study step to which the selected simulation context is attached
- private Set<ProjectElementFacade> owner; // Study scenarios indexed by this simulation context
- private List<LocalizedContextTypes> existype; // Existing approved simulation context types ordered by localized names
- private List<SimulationContextType> exisname; // Existing approved simulation context types ordered by internal codes
- private List<SimulationContext> existing; // Existing simulation contexts of selected type
+ /**
+ * Simulation contexts to be approved.
+ */
+ private transient List<SimulationContextFacade> _tocheck;
+ /**
+ * Index of the selected simulation context presented in the approval form.
+ */
+ private int _selection;
+ /**
+ * Corresponding simulation context object.
+ */
+ private transient SimulationContext _edition;
+ /**
+ * Study step to which the selected simulation context is attached.
+ */
+ private transient ProjectSettingsService.Step _step;
+ /**
+ * Study scenarios indexed by this simulation context.
+ */
+ private transient Set<ProjectElementFacade> _owner;
+ /**
+ * Existing approved simulation context types ordered by localized names.
+ */
+ private transient List<LocalizedContextTypes> _existype;
+ /**
+ * Existing approved simulation context types ordered by internal codes.
+ */
+ private transient List<SimulationContextType> _exisname;
+ /**
+ * Existing simulation contexts of selected type.
+ */
+ private transient List<SimulationContext> _existing;
/**
* Injected search service.
*/
/**
* Injected project settings service.
*/
- private ProjectSettingsService _projectSettingsService;
+ private ProjectSettingsService _projectSettings;
/**
* Injected knowledge element service.
*/
* Injected simulation context service.
*/
private SimulationContextService _simulationContextService;
-
+
/**
- * Value of the menu property.
- * It can be: none, create, open, study, knowledge, sysadmin, help.
+ * Value of the menu property. It can be: none, create, open, study, knowledge, sysadmin, help.
*/
private String _menuProperty;
-
+
/**
- * Value of the tool bar property.
- * It can be: none, standard, study, back.
+ * Value of the tool bar property. It can be: none, standard, study, back.
*/
private String _toolProperty;
-
+
/**
- * Value of the left menu property.
- * It can be: open, study, knowledge, scenario.
+ * Value of the left menu property. It can be: open, study, knowledge, scenario.
*/
private String _leftMenuProperty;
*
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
- public int compare(SimulationContextType t1, SimulationContextType t2) {
+ public int compare(final SimulationContextType t1,
+ final SimulationContextType t2) {
String name1 = t1.getName();
String name2 = t2.getName();
}
public class LocalizedContextTypes {
- // ----------------------------------
- private Locale locale;
- private List<String> sortype; // Existing approved simulation context types ordered by localized names
+ private transient final Locale _locale;
+ private transient final List<String> _sortype; // Existing approved simulation context types ordered by localized names
- public LocalizedContextTypes(List<SimulationContextType> types,
- Locale lang) {
+ public LocalizedContextTypes(final List<SimulationContextType> types,
+ final Locale lang) {
ResourceBundle bundle = ResourceBundle.getBundle("som", lang);
SimulationContextType[] tosort = types
.toArray(new SimulationContextType[types.size()]);
String[] name = new String[types.size()];
- for (int i = 0; i < name.length; i++)
+ for (int i = 0; i < name.length; i++) {
name[i] = bundle.getString("type.context."
+ tosort[i].getName());
+ }
Arrays.sort(name);
- sortype = Arrays.asList(name);
- locale = lang;
+ _sortype = Arrays.asList(name);
+ _locale = lang;
}
public String getLocale() {
- return locale.toString();
+ return _locale.toString();
}
public List<String> getTypeNames() {
- return sortype;
+ return _sortype;
}
public boolean isCurrent() {
- return (locale.equals(ApplicationSettings.getCurrentLocale()));
+ return _locale.equals(ApplicationSettings.getCurrentLocale());
}
}
/**
* Initialize the simulation context list.
+ *
* @return SUCCESS if succeeded, otherwise - ERROR
*/
public String doInitialize() {
+ String res = SUCCESS;
try {
- tocheck = getSimulationContextService()
+ _tocheck = getSimulationContextService()
.getSimulationContextsInState(ProgressState.inCHECK);
- selection = 0;
- edition = null;
- owner = null;
-
+ _selection = 0;
+ _edition = null;
+ _owner = null;
+
setMenuProperty("study");
setToolProperty("none");
setLeftMenuProperty("open");
- initializationFullScreenContext(_menuProperty, _toolProperty, _leftMenuProperty);
-
- return SUCCESS;
+ initializationFullScreenContext(_menuProperty, _toolProperty,
+ _leftMenuProperty);
} catch (Exception error) {
LOG.error("Reason:", error);
- return ERROR; // No need to roll-back the transaction as it is read-only
+ res = ERROR; // No need to roll-back the transaction as it is read-only
}
+ return res;
}
public String doSelect() {
- // -------------------------
-
+
+ String res = SUCCESS;
setMenuProperty("study");
setToolProperty("none");
setLeftMenuProperty("open");
- initializationFullScreenContext(_menuProperty, _toolProperty, _leftMenuProperty);
-
+ initializationFullScreenContext(_menuProperty, _toolProperty,
+ _leftMenuProperty);
+
Session connex = Database.getCurSession();
Transaction transax = connex.beginTransaction();
try {
List<SimulationContext> selected = new ArrayList<SimulationContext>(
1);
- tocheck = new Vector<SimulationContextFacade>(context.size());
+ _tocheck = new ArrayList<SimulationContextFacade>(context.size());
for (Iterator<SimulationContext> i = context.iterator(); i
.hasNext();) {
SimulationContext next = i.next();
- if (next.getIndex() == selection) {
- edition = next;
- selected.add(edition);
+ if (next.getIndex() == _selection) {
+ _edition = next;
+ selected.add(_edition);
}
- tocheck.add(new SimulationContextFacade(next,
+ _tocheck.add(new SimulationContextFacade(next,
getProjectSettings().getAllSteps()));
}
KnowledgeElement.Properties kprop = new KnowledgeElement.Properties();
kprop.setSimulationContexts(selected).setState(
ProgressState.inWORK));
- step = getSimulationContextService().getAttachedStep(
- edition.getType());
- owner = new HashSet<ProjectElementFacade>();
+ _step = getSimulationContextService().getAttachedStep(
+ _edition.getType());
+ _owner = new HashSet<ProjectElementFacade>();
for (Iterator<Proxy> i = kelm.iterator(); i.hasNext();) {
KnowledgeElement next = getKnowledgeElementService()
.selectKnowledgeElement(i.next().getIndex());
ProjectElementFacade facade;
- if (step.appliesTo(Study.class))
+ if (_step.appliesTo(Study.class)) {
facade = new ProjectElementFacade(next.getOwnerScenario()
- .getOwnerStudy(), step);
- else
+ .getOwnerStudy(), _step);
+ } else {
facade = new ProjectElementFacade(next.getOwnerScenario(),
- step);
- owner.add(facade);
+ _step);
+ }
+ _owner.add(facade);
}
SimulationContextType.Properties sprop = new SimulationContextType.Properties();
List<SimulationContextType> types = getSimulationContextService()
Locale[] support = ApplicationSettings.getSupportedLocales();
// Sort localized type names
- existype = new ArrayList<LocalizedContextTypes>(support.length);
+ _existype = new ArrayList<LocalizedContextTypes>(support.length);
for (int i = 0; i < support.length; i++) {
- existype.add(new LocalizedContextTypes(types, support[i]));
+ _existype.add(new LocalizedContextTypes(types, support[i]));
}
SimulationContextType[] names = types
.toArray(new SimulationContextType[types.size()]);
Arrays.sort(names, new ContextNameComparator());
- exisname = Arrays.asList(names);
+ _exisname = Arrays.asList(names);
- existing = getSimulationContextService()
+ _existing = getSimulationContextService()
.selectSimulationContextsWhere(
- cprop.setType(edition.getType()).setState(
+ cprop.setType(_edition.getType()).setState(
ProgressState.APPROVED));
transax.commit();
- return SUCCESS;
} catch (Exception error) {
LOG.error("Reason:", error);
- return ERROR; // No need to roll-back the transaction as it is read-only
+ res = ERROR; // No need to roll-back the transaction as it is read-only
}
+ return res;
}
// ==============================================================================================================================
// ==============================================================================================================================
public List<ProjectSettingsService.Step> getAllStudySteps() {
- // -----------------------------------------------------
return getProjectSettings().getAllSteps();
}
* @return Project settings service
*/
private ProjectSettingsService getProjectSettings() {
- return _projectSettingsService;
+ return _projectSettings;
}
/**
* @param projectSettingsService
* project settings service
*/
- public void setProjectSettings(ProjectSettingsService projectSettingsService) {
- _projectSettingsService = projectSettingsService;
+ public void setProjectSettings(
+ final ProjectSettingsService projectSettingsService) {
+ _projectSettings = projectSettingsService;
}
public ProjectSettingsService.Step getAttachedStep() {
- // ----------------------------------------------
- return step;
+ return _step;
}
public List<SimulationContextFacade> getContextsToBeApproved() {
- // ---------------------------------------------------------------
- return tocheck;
+ return _tocheck;
}
public SimulationContext getEdited() {
- // -------------------------------------
- return edition;
+ return _edition;
}
public List<SimulationContext> getExistingContexts() {
- // -----------------------------------------------------
- return existing;
+ return _existing;
}
public List<SimulationContextType> getExistingNames() {
- // ------------------------------------------------------
- return exisname;
+ return _exisname;
}
public List<LocalizedContextTypes> getSupportedLocales() {
- // ---------------------------------------------------------
- return existype;
+ return _existype;
}
public Set<ProjectElementFacade> getIndexedElements() {
- // ------------------------------------------------------
- return owner;
+ return _owner;
}
public int getSelection() {
- // --------------------------
- return selection;
+ return _selection;
}
- public void setSelection(String index) {
- // ---------------------------------------
- selection = Integer.valueOf(index);
+ public void setSelection(final String index) {
+ _selection = Integer.valueOf(index);
}
/**
* the knowledgeElementService to set
*/
public void setKnowledgeElementService(
- KnowledgeElementService knowledgeElementService) {
+ final KnowledgeElementService knowledgeElementService) {
_knowledgeElementService = knowledgeElementService;
}
* the simulationContextService to set
*/
public void setSimulationContextService(
- SimulationContextService simulationContextService) {
+ final SimulationContextService simulationContextService) {
_simulationContextService = simulationContextService;
}
* @param searchService
* the searchService to set
*/
- public void setSearchService(SearchService searchService) {
+ public void setSearchService(final SearchService searchService) {
_searchService = searchService;
}
-
+
/**
- * Get the menuProperty.
+ * Get the menuProperty.
+ *
* @return the menuProperty
*/
public String getMenuProperty() {
/**
* Set the menuProperty.
+ *
* @param menuProperty
* the menuProperty to set
*/
public void setMenuProperty(final String menuProperty) {
this._menuProperty = menuProperty;
}
-
+
/**
* Get the toolProperty.
+ *
* @return the toolProperty
*/
public String getToolProperty() {
/**
* Set the toolProperty.
- * @param toolProperty the toolProperty to set
+ *
+ * @param toolProperty
+ * the toolProperty to set
*/
public void setToolProperty(final String toolProperty) {
_toolProperty = toolProperty;
}
-
+
/**
* Get the leftMenuProperty.
+ *
* @return the leftMenuProperty
*/
public String getLeftMenuProperty() {
/**
* Set the leftMenuProperty.
- * @param leftMenuProperty the leftMenuProperty to set
+ *
+ * @param leftMenuProperty
+ * the leftMenuProperty to set
*/
public void setLeftMenuProperty(final String leftMenuProperty) {
_leftMenuProperty = leftMenuProperty;