fixed processed order stats to only display new order stats when theres new orders

added password encryption using jasypt
This commit is contained in:
2011-01-26 18:54:47 +00:00
parent 21c7d0642b
commit c85e599530
8 changed files with 26 additions and 10 deletions

View File

@@ -8,5 +8,6 @@
<classpathentry kind="lib" path="lib/ostermillerutils_1_07_00.jar"/>
<classpathentry kind="lib" path="lib/mysql-connector-java-5.1.14-bin.jar"/>
<classpathentry kind="lib" path="lib/sqlitejdbc-v056.jar"/>
<classpathentry kind="lib" path="lib/jasypt-1.7.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -1,7 +1,7 @@
#---No Comment---
#Sat Jan 22 21:42:25 EST 2011
server_parrword=S35-2n6t
use_remote_server=true
#Wed Jan 26 13:29:05 EST 2011
server_parrword=kwz5vDLcNnKG6agAnGSm8nwzSncF2SK5
server_location=tcdevsvn1
use_remote_server=true
server_port_number=3306
server_user_name=ricky.barrette

Binary file not shown.

View File

@@ -25,6 +25,8 @@ import java.util.Collections;
import java.util.Locale;
import java.util.Properties;
import org.jasypt.util.text.BasicTextEncryptor;
import com.Ostermiller.util.CSVParser;
import com.TwentyCodes.java.OrderProcessor.Date;
import com.TwentyCodes.java.OrderProcessor.InvalidDateFormatException;
@@ -41,6 +43,7 @@ import com.TwentyCodes.java.OrderProcessor.UI.SettingsPanel;
*/
public class OrderDB {
public final static String PASSWORD = "askjdhfui2ywpordhewpfiy2390uriyfu230rhuiyhew8fu293hro9yqewrfup9u34bh0yf3-eqwjf9834-fjud9i-he9-fhuj830uewfh";
private final String CREATE_TABLE = "CREATE TABLE Orders (id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, item blob);";
private final String CREATE_TABLE_LOCAL = "CREATE TABLE Orders (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 'item' blob);";
private final String INSERT = "insert into Orders (item) values (?);";
@@ -209,6 +212,8 @@ public class OrderDB {
*/
private Connection getConnection() throws SQLException, SocketException{
Properties props = getProperties();
BasicTextEncryptor passwordEncryptor = new BasicTextEncryptor();
passwordEncryptor.setPassword(PASSWORD);
if(isUsingRemoteDatabase){
String url = "jdbc:mysql://"+props.getProperty(SettingsPanel.SERVER_LOCATION)+":"+props.getProperty(SettingsPanel.SERVER_PORT_NUMBER, "3306")+"/Orders";
@@ -217,7 +222,7 @@ public class OrderDB {
url += "?user="+ props.getProperty(SettingsPanel.SERVER_USERNAME);
if(props.getProperty(SettingsPanel.SERVER_PASSWORD).length() > 0)
url += "&password="+ props.getProperty(SettingsPanel.SERVER_PASSWORD);
url += "&password="+ passwordEncryptor.decrypt(props.getProperty(SettingsPanel.SERVER_PASSWORD));
return DriverManager.getConnection(url);

View File

@@ -88,8 +88,7 @@ public class OrderPane extends JScrollPane {
updateTextPane(list, styles);
updateTextPane("\nPossible sold: " + list.size()
+"\nPossible sales: $" + possible.setScale(2, BigDecimal.ROUND_DOWN)
+ "\n\nTotal new sales: "+ newOrders
+ "\nPossible new sales: $"+ possibleNew.setScale(2, BigDecimal.ROUND_DOWN)
+ ( (newOrders > 0) ? "\n\nTotal new sales: "+ newOrders + "\nPossible new sales: $"+ possibleNew.setScale(2, BigDecimal.ROUND_DOWN) : "")
+ "\n\nTotal sold: " + total
+ "\nActual sales: $" + actual.setScale(2, BigDecimal.ROUND_DOWN) , TextStyle.BOLD);
}

View File

@@ -24,6 +24,10 @@ import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;
import org.jasypt.util.text.BasicTextEncryptor;
import com.TwentyCodes.java.OrderProcessor.DB.OrderDB;
/**
* this panel will be used to display and handle application settings
* @author ricky barrette
@@ -178,10 +182,12 @@ public class SettingsPanel extends JPanel implements ActionListener {
//save button
if(e.getSource() == mSaveButton){
BasicTextEncryptor passwordEncryptor = new BasicTextEncryptor();
passwordEncryptor.setPassword(OrderDB.PASSWORD);
mProps.put(SERVER_LOCATION, mServerLocation.getText());
mProps.put(SERVER_PORT_NUMBER, mPortNumber.getText());
mProps.put(SERVER_USERNAME, mUserName.getText());
mProps.put(SERVER_PASSWORD, new String(mUserPassword.getPassword()));
mProps.put(SERVER_PASSWORD, new String(passwordEncryptor.encrypt(new String(mUserPassword.getPassword()))));
try {
FileOutputStream out = new FileOutputStream(".settings.propertys");
mProps.store(out, "---No Comment---");

View File

@@ -38,3 +38,8 @@ MainWinod.java, reorganized the constructor so the progress bar will be indeterm
added clear button to the ShowAllPanel.java
fixed the export save dialog to automatically handle extensions
added new order stats to the order pane
1.1.3 b 48
fixed processed order stats to only display new order stats when theres new orders
added password encryption using jasypt

View File

@@ -1 +1 @@
1.1.2 b 47
1.1.3 b 48