prjct file
Embed Size (px)
TRANSCRIPT
-
7/30/2019 Prjct File
1/98
1
CHAPTER 1
Introduction
1.1 Overview
ShareManager- will be an application which will provide its users a FTP Server to upload and
download files on a central repository.Users will be able to share files with other users as files
will be on central repository and FTP Server will be created to support file sharing.A user
friendly Graphical User Interface will be provided to easily upload and download files using FTP
Server.Only registered / authorized users will be able to use this application for download &
upload as per the rights available to them. Users will be able to rename and delete files uploaded
by them.It will be developed using Java technologies. It Create a FTP Server to transfer
files.Provide interface to users for downloading & uploading files of specific FTP server.Provide
support to users to share, rename and delete files on server.To maintain various users of the
application & their access rights.Maintain history of all the activities (File Downloads and
Uploads) of users, for future analysis.To provide a functionality to the administrator of the
application for setting up the configuration of FTP server.
Figure 1.1 sharemanager
-
7/30/2019 Prjct File
2/98
2
Business Functions
1. Login: To access this application, users would be required to login through a loginscreen. After authentication user would be able to access the application according to
his/her privileges.
2. Users Maintenance: That allows adding or updating the details of all users who willaccess this application.
3. File Upload: To provide support to users, so that they could upload their files on centralserver using FTP Server and Client.
4. File Download: To provide support to users, so that they could download files fromcentral server using FTP Client.
5. Report: Reports of users of the system, user activities, and files uploaded anddownloaded by users.
-
7/30/2019 Prjct File
3/98
3
Users
The users of this system will be the users of the organization using this ShareManager.
Following are the type of users:
a. Administrator: Administrator will be the super user of the system having all theprivileges. Administrator will be responsible to add, delete and assign privileges
to the other users of the system. Administrator will decide whether a user can
download files or not.
b. Employee: Employee is the member of staff of the organization using thisapplication. Employee will be having limited privileges as assigned by the
administrator. Employees will be able to upload ,download,rename and delete
files as per the privileges assigned.
-
7/30/2019 Prjct File
4/98
4
Modules
Following modules are to be developed:
1. Login
2. Admin User Maintenance Privilege Maintenance
3. File Upload
4. File Download
5. Reports All Users details. User Activities Details. File upload and download details.
-
7/30/2019 Prjct File
5/98
5
1.2 Feasibility study of project .
Project
The meaning of project is to give physical existence to the vibration idea and thought. Project is
a great source to develop technical skills in technical students. During the programming of
projects, students undergo different problems and experiences. A student gets charged to climb
on the roof of practicals, step by step through the ladder of the theory, thus he gets adequate
practical knowledge and knowledge of economics to go at the field.
A very important aim of any project is that it should be feasible and economical. Actually the
word PROJECT consists of seven alphabets, each of which has separate meanings :
P for PLANNING: Planning is must to start a work or scheme.. If planning is good and
impressive, half work is done.
R for RELIABLE SOURCE: Practical and Theoretical material and an able guidance and
assistance is achieved from different sources to promote the function of plan area.
O for OVERALL EXPENCES: Overall expenses to provide final design to any project are also
considerable. These expenses are analyzed for each concept and method of working on the
computer.
J for JOINT EFFORT: Joint Effort is crucial for programming.
E for ECONOMIC TIME FEASIBILITY: Another important point is to check how much
economic time feasible is the planned scheme. It is must to analyze estimate for completion of
the project.
C for CONSTRUCTION: After analyzing the program, complete project work is done to give
logical existence of planned scheme.
T for TESTING: Testing of project is done before submitting the project. After testing the
gadget is OK for use.
-
7/30/2019 Prjct File
6/98
6
System Development Strategy
Rapid Prototyping Model:-
Fig:- 1.2 Rapid Prototyping Model
-
7/30/2019 Prjct File
7/98
7
Rapid application development (RAD) is a software development methodology that usesminimal planning in favor of rapid prototyping. The "planning" of software developed
using RAD is interleaved with writing the software itself. The lack of extensive pre-
planning generally allows software to be written much faster, and makes it easier to
change requirements.
Rapid application development involves methods like iterative development and softwareprototyping. It is a merger of various structured techniques, especially data-driven
Information Engineering, with prototyping techniques to accelerate software systems
development.
In rapid application development, structured techniques and prototyping are especiallyused to define users' requirements and to design the final system. The development
process starts with the development of preliminary data models and business process
models using structured techniques. In the next stage, requirements are verified using
prototyping, eventually to refine the data and process models. These stages are repeated
iteratively; further development results in "a combined business requirements and
technical design statement to be used for constructing new systems".
-
7/30/2019 Prjct File
8/98
8
Feasibility Study:
An important outcome of the proposed system is the determination that the System requested is
feasible. There are three aspects in feasibility study.
1) Technical Feasibility:Technical feasibility requires the work done with the current equipment i.e. existing software,
hardware etc. in our case we have required hardware and software tools.
2) Economic Feasibility:Economic Feasibility includes sufficient benefit in creating the system to make the cost
acceptable. The system do not need much of infrastructure i.e. large amount of investing in
infrastructure is do not needed. Project will be done with the available resources.
3) Operational feasibility:Operational feasibility shows the risk analysis, which involves following characteristics:
a) Will the system work?b) Will the system be implemented?
-
7/30/2019 Prjct File
9/98
9
CHAPTER-2
Requirement Specif ication And Analysis
Software Requi rements
1 JDK 1.6
NetBeans 6.5.1
2
Jdbc Driver for MySQL Database Server mysql-connector-java-5.1.7-bin.jar
3 Database Server MySQL Database Server 5.0
4 Operating system Windows Vista / XP sp3/ Linux Fedora 11
Hardware Requirements
1 Intel P4 processor with minimum 2.0Ghz Speed2. RAM: Minimum 512MB3. Hard Disk: Minimum 20GB
-
7/30/2019 Prjct File
10/98
10
Input Requirements
1. Login details.2. Users details and their privileges.3. FTP server connection details.
Output Requirements
1. An FTP Server to support file sharing2. Files to be uploaded successfully.3. Files to be downloaded successfully.4. Listing of user activities.5. Listing of user details.6. Listing of files uploaded, downloaded and shared by users.
-
7/30/2019 Prjct File
11/98
11
CHAPTER-3
Design
3.1DFDS
Graphical description of system data is as Data Flow diagrams. It dont supply detailed
description of modules but graphically describe a systems data interact with the system. To
construct data flow diagrams, we use arrows, circles, open end boxes and squares.
An Arrow identifies data flow i.e. data in motion.
An open ended box or or represents data store
or
temporary repository of data. A square defines a square (originator) or destination of
system data.
server
fig-3.1 DFD for server Login
-
7/30/2019 Prjct File
12/98
12
fig-3.2 DFD for sharemanager server
fig-3.3 DFD for FTP Server
-
7/30/2019 Prjct File
13/98
13
fig-3.4 DFD for Profile Maintenance
fig-3.5 DFD for user Maintenance
-
7/30/2019 Prjct File
14/98
14
fig-3.6 DFD for Reports
-
7/30/2019 Prjct File
15/98
15
Client
fig-3.7 DFD for client Login
-
7/30/2019 Prjct File
16/98
16
fig-3.8 DFD for Profile Maintenance
fig-3.9 DFD for sharemanager client
-
7/30/2019 Prjct File
17/98
17
fig-3.10 DFD for FTP Server
-
7/30/2019 Prjct File
18/98
18
3.2 Data Model
Fig-3.2 Data model
-
7/30/2019 Prjct File
19/98
19
CHAPTER-4
Implementation And Coding
4.1Introduction of Language1. Java
Java is a platform independent, object-oriented, robust, secure and innovativeprogramming language.
It consist of Two Parts JVM (Java Virtual Machine), which is software component that is used to
execute java programs.
Java API (Application Programming Interface) that consist of inbuiltclasses that are used in different programs.
2. Database Programming JDBC is Java Database Connectivity that is used for communication between
database server and a java application. JDBC is a specification and API that is in
programming database applications in java.
3. Windows Programming Swings: Swings in java is a rich set of components for building GUIs and adding
interactivity to java applications. Swing includes all the components that you
would expect from a modern GUI toolkit that is table controls, list controls, tree
controls, buttons and labels. The basic architecture of swing is MVC. And are
entirely made in java.
-
7/30/2019 Prjct File
20/98
20
The Java Programming Language
The Java programming language is a high-level language that can be characterized by all
of the following characteristics
Simple Object oriented Distributed Multithreaded Architecture neutral Portable High performance Robust
In the Java programming language, all source code is first written in plain text files
ending with the .java extension. Those source files are then compiled into .class files by the javac
compiler. A .class file does not contain code that is native to your processor; it instead contains
bytecodesthe machine language of the Java Virtual Machine1(Java VM). The java launcher
tool then runs your application with an instance of the Java Virtual Machine.
Fig-4.1 An overview of the software development process.
http://localhost/var/www/apps/conversion/Projects%202010/_ProjectDataJuneJuly/_2010JuneWindows/New%20Folder/C:/java16Tut/getStarted/intro/definition.htmlhttp://localhost/var/www/apps/conversion/Projects%202010/_ProjectDataJuneJuly/_2010JuneWindows/New%20Folder/C:/java16Tut/getStarted/intro/definition.htmlhttp://localhost/var/www/apps/conversion/Projects%202010/_ProjectDataJuneJuly/_2010JuneWindows/New%20Folder/C:/java16Tut/getStarted/intro/definition.html -
7/30/2019 Prjct File
21/98
21
Because the Java VM is available on many different operating systems, the same .class
files are capable of running on Microsoft Windows, the SolarisTM
Operating System (Solaris
OS), Linux, or Mac OS. Some virtual machines, such as the Java HotSpot virtual machine,
perform additional steps at runtime to give your application a performance boost. This include
various tasks such as finding performance bottlenecks and recompiling (to native code)
frequently used sections of code.
Through the Java VM, the same application is capable of running on multiple platforms.
-
7/30/2019 Prjct File
22/98
22
Java is an object-oriented programming language with a built-in application programming
interface (API) that can handle graphics and user interfaces and that can be used to create
applications or applets. Because of its rich set of API's, similar to Macintosh and Windows, and
its platform independence, Java can also be thought of as a platform in itself. Java also has
standard libraries for doing mathematics.
Much of the syntax of Java is the same as C and C++. One major difference is that Java does not
have pointers. However, the biggest difference is that you must write object oriented code in
Java. Procedural pieces of code can only be embedded in objects. In the following we assume
that the reader has some familiarity with a programming language. In particular, some familiarity
with the syntax of C/C++ is useful.
In Java we distinguish between applications, which are programs that perform the same functions
as those written in other programming languages, and applets, which are programs that can be
embedded in a Web page and accessed over the Internet. Our initial focus will be on writing
applications. When a program is compiled, a byte code is produced that can be read and executed
by any platform that can run Java.
Characteristics:
Platform independentJava is a platform for application development. A platform is a loosely defined computer
industry buzzword that typically means some combination of hardware and system
software that will mostly run all the same software.
Java byte code is exactly the same on every platform. Java programs that have been
compiled into byte code still need an interpreter to execute them on any given platform.
The interpreter reads the byte code and translates it into the native language of the host
machine on the fly. Since the byte code is completely platform independent, only the
interpreter and a few native libraries need to be ported to get Java to run on a new
computer or operating system.
All these pieces, the javac compiler, the java interpreter, the Java programming language,
and more are collectively referred to as Java.
-
7/30/2019 Prjct File
23/98
23
Object orientedIn object-oriented programs data is represented by objects. Objects have two sections,
fields (instance variables) and methods. Fields tell you what an object is. Methods tell
you what an object does. These fields and methods are closely tied to the object's real
world characteristics and behavior. When a program is run messages are passed back and
forth between objects. When an object receives a message it responds accordingly as
defined by its methods.
RobustJava implements a robust exception handling mechanism to deal with both expected and
unexpected errors. The worst that an applet can do to a host system is bringing down the
runtime environment. It cannot bring down the entire system.
Most importantly Java applets can be executed in an environment that prohibits them
from introducing viruses, deleting or modifying files, or otherwise destroying data and
crashing the host computer. A Java enabled web browser checks the byte codes of an
applet to verify that it doesn't do anything nasty before it will run the applet.
MultithreadedJava is inherently multi-threaded. A single Java program can have many different
threads executing independently and continuously. Three Java applets on the same page
can run together with each getting equal time from the CPU with very little extra effort
on the part of the programmer.
High perf ormanceJava byte codes can be compiled on the fly to code that rivals C++ in speed using a "just-
in-time compiler." Several companies are also working on native-machine-architecture
compilers for Java. These will produce executable code that does not require a separate
interpreter, and that is indistinguishable in speed from C++.
-
7/30/2019 Prjct File
24/98
24
DynamicJava programs carry with them substantial amounts of run-time type information that is used to
verify and resolve accesses to objects at run-time. This makes it possible to dynamically link
code in a safe and expedient manner. The java programming language is unusual than other
programming languages it first compiles and then interprets the program
-
7/30/2019 Prjct File
25/98
25
The Java Platform
A platform is the hardware or software environment in which a program runs. Most
platforms can be described as a combination of the operating system and underlying hardware.
The Java platform differs from most other platforms in that it's a software-only platform that runs
on top of other hardware-based platforms.
The Java platform has two components:
The Java Virtual Machine (JVM) The Java Application Programming Interface (API)
Java Virtual Machine is the base for the Java platform and is ported onto various
hardware-based platforms.
The API is a large collection of ready-made software components that provide many useful
capabilities. It is grouped into libraries of related classes and interfaces; these libraries are known
aspackages.
1. The API and Java Virtual Machine insulate the program fromthe underlying hardware.
Every full implementation of the Java platform gives you the following features:
Development Tools: The development tools provide means for compiling, running,debugging, and documenting your applications. The main tools are the javac compiler,
the java launcher, and the javadoc documentation tool.
-
7/30/2019 Prjct File
26/98
26
Application Programming Interface (API): The API provides the core functionality of theJava programming language. It offers a wide array of useful classes ready for use in your
own applications. It spans everything from basic objects, to networking and security, to
XML generation and database access, etc.
Deployment Technologies: The JDK software provides standard mechanisms such as theJava Web Start software and Java Plug-In software for deploying your applications to end
users.
User Interface Toolkits: The Swing and Java 2D toolkits make it possible to createsophisticated Graphical User Interfaces (GUIs).
Integration Libraries: Integration libraries such as the Java IDL, JDBC, JNDI, Java RMI,and Java Remote Method Invocation over Internet Inter-ORB Protocol Technology (Java
RMI-IIOP Technology) enable database access and manipulation of remote objects.
Introduction to MYSQL
MySQL, the most popular Open Source SQL database management system, is
developed, distributed, and supported by Oracle Corporation. The MySQL (R) software delivers
a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database
server. MySQL Server is intended for mission-critical, heavy-load production systems as well as
for embedding into mass-deployed software.
The MySQL software is Dual Licensed. Users can choose to use the MySQL software as
an Open Source/Free Software product under the terms of the GNU General Public License orcan purchase a standard commercial license.
The MySQL web site (http://www.mysql.com/) provides the latest information about the
MySQL software.
http://www.mysql.com/http://www.mysql.com/http://www.mysql.com/http://www.mysql.com/ -
7/30/2019 Prjct File
27/98
27
MySQL is a relational database management system.A database is a structured collection of data. It may be anything from a simple shopping list to a
picture gallery or the vast amounts of information in a corporate network. To add, access, and
process data stored in a computer database, you need a database management system such asMySQL Server. Since computers are very good at handling large amounts of data, database
management systems play a central role in computing, as standalone utilities, or as parts of other
applications.
MySQL software is Open Source.A relational database stores data in separate tables rather than putting all the data in one big
storeroom. This adds speed and flexibility. The SQL part of MySQL stands for Structured
Query Language. SQL is the most common standardized language used to access databases and
is defined by the ANSI/ISO SQL Standard. The SQL standard has been evolving since 1986 and
several versions exist.
The MySQL Database Server is very fast, reliable, and easy to use.MySQL Server was originally developed to handle large databases much faster than existing
solutions and has been successfully used in highly demanding production environments for
several years. Although under constant development, MySQL Server today offers a rich and
useful set of functions. Its connectivity, speed, and security make MySQL Server highly suited
for accessing databases on the Internet
MySQL Server works in client/server or embedded systems.The MySQL Database Software is a client/server system that consists of a multi-threaded SQL
server that supports different backends, several different client programs and libraries,
administrative tools, and a wide range of application programming interfaces (APIs)
-
7/30/2019 Prjct File
28/98
28
4.2 Coding
1. Server
LOGIN
import sharemanagerserver.alpha.DBOperations;
import sharemanagerserver.alpha.UsermasterBean;
import sharemanagerserver.em/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sharemanagerserver;
ail.SendSMTP;
public class LoginFrame extends javax.swing.JFrame {
/** Creates new form LoginFrame */
public LoginFrame() {
initComponents();
setLocationRelativeTo(null);
}
/** This method is called from within the constructor to
* initialize the form.* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
-
7/30/2019 Prjct File
29/98
29
// //GEN-
BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
txtUsername = new javax.swing.JTextField();
txtPassword = new javax.swing.JPasswordField();
btnLogin = new javax.swing.JButton();
btnCancel = new javax.swing.JButton();
btnRetrievePassword = new javax.swing.JButton();
lblMessage = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Login"));
jLabel1.setText("Username");
jLabel2.setText("Password");
txtPassword.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtPasswordActionPerformed(evt);
}
});
btnLogin.setText("Login");
btnLogin.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
-
7/30/2019 Prjct File
30/98
30
btnLoginActionPerformed(evt);
}
});
btnCancel.setText("Cancel");
btnCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCancelActionPerformed(evt);
}
});
btnRetrievePassword.setText("Retrieve Password");
btnRetrievePassword.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnRetrievePasswordActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(btnLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 74,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-
7/30/2019 Prjct File
31/98
31
.addComponent(btnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 85,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnRetrievePassword,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 76,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 68,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtPassword, javax.swing.GroupLayout.DEFAULT_SIZE,
226, Short.MAX_VALUE)
.addComponent(txtUsername, javax.swing.GroupLayout.DEFAULT_SIZE,
226, Short.MAX_VALUE))))
.addContainerGap())
);
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new
java.awt.Component[] {btnCancel, btnLogin});
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new
java.awt.Component[] {jLabel1, jLabel2});
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-
7/30/2019 Prjct File
32/98
32
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELIN
E)
.addComponent(txtUsername, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELIN
E)
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELIN
E)
.addComponent(btnLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 21,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnCancel)
.addComponent(btnRetrievePassword,
javax.swing.GroupLayout.PREFERRED_SIZE, 21,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new
java.awt.Component[] {jLabel1, jLabel2});
-
7/30/2019 Prjct File
33/98
33
jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new
java.awt.Component[] {btnCancel, btnLogin, btnRetrievePassword});
lblMessage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lblMessage.setText(" ");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lblMessage, javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, 350, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(lblMessage)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-
7/30/2019 Prjct File
34/98
34
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
pack();
}// //GEN-END:initComponents
private void txtPasswordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_txtPasswordActionPerformed
// TODO add your handling code here:
loginAction();
}//GEN-LAST:event_txtPasswordActionPerformed
private void btnLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_btnLoginActionPerformed
// TODO add your handling code here:
loginAction();
}//GEN-LAST:event_btnLoginActionPerformed
private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_btnCancelActionPerformed
// TODO add your handling code here:
System.exit(0);
}//GEN-LAST:event_btnCancelActionPerformed
private void btnRetrievePasswordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_btnRetrievePasswordActionPerformed
// TODO add your handling code here:
DBOperations objDB = new DBOperations();
String username = txtUsername.getText();
if (username.equalsIgnoreCase("")) {
-
7/30/2019 Prjct File
35/98
35
lblMessage.setText("Enter username to retrieve password");
} else {
UsermasterBean objBean = objDB.getUserDetailByUsername(username);
if (objBean == null) {
lblMessage.setText("Invalid username");
} else {
String email = objDB.getEmailByUsername(username);
if (!email.equalsIgnoreCase("failed")) {
String result = new SendSMTP().sendMail(email, "Your recovered password is : " +
objBean.getPassword(), "Your recovered password is :");
if (result.equalsIgnoreCase("sent")) {
lblMessage.setText("Your password has been sent to : " + email);
} else {
lblMessage.setText("Error in sending password to your emailid");
}
}
}
}
}//GEN-LAST:event_btnRetrievePasswordActionPerformed
void loginAction() {
String username = txtUsername.getText();
String passowrd = new String(txtPassword.getPassword());
DBOperations objDB = new DBOperations();
UsermasterBean objBean = objDB.authenticateUser(username, passowrd);
if (objBean == null) {
lblMessage.setText("Invalid Username or Password");
} else {
-
7/30/2019 Prjct File
36/98
36
System.out.println("");
if (objBean.getUserStatus().equalsIgnoreCase("inactive") ||
!(objBean.getUserType().equalsIgnoreCase("Administrator"))) {
lblMessage.setText("Invalid Username or Password");
} else {
int userActivityID = objDB.addUserActivity(objBean.getUserId());
new MainFrame(objBean, userActivityID);
setVisible(false);
}
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new LoginFrame().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCancel;
private javax.swing.JButton btnLogin;
private javax.swing.JButton btnRetrievePassword;
private javax.swing.JLabel jLabel1;
-
7/30/2019 Prjct File
37/98
37
private javax.swing.JLabel jLabel2;
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel lblMessage;
private javax.swing.JPasswordField txtPassword;
private javax.swing.JTextField txtUsername;
// End of variables declaration//GEN-END:variables
}
USER MAINTAINENCE
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sharemanagerserver;
import sharemanagerserver.alpha.DBOperations;
import sharemanagerserver.alpha.UsermasterBean;
import java.util.ArrayList;
import javax.swing.JOptionPane;
/**
*
* @author admin
*/public class UserAccountDetail extends javax.swing.JPanel {
int count = 0;
ArrayList alstUser;
DBOperations objDB = new DBOperations();
-
7/30/2019 Prjct File
38/98
38
String AddUpdateFlag;
/** Creates new form UserAccountDetail */
public UserAccountDetail() {
initComponents();
btnSave.setEnabled(false);
disable(false);
alstUser = objDB.getAllUserDetailList();
if (alstUser.size() > 0) {
UsermasterBean objBean = (UsermasterBean) alstUser.get(count);
showUserRecord(objBean);
}
setVisible(true);
}
public UserAccountDetail(int count) {
initComponents();
btnSave.setEnabled(false);
disable(false);
alstUser = objDB.getAllUserDetailList();
this.count = count;
if (alstUser.size() > 0) {
UsermasterBean objBean = (UsermasterBean) alstUser.get(count);
showUserRecord(objBean);
}
setVisible(true);
}
public UserAccountDetail(String operationType) {
initComponents();
alstUser = objDB.getAllUserDetailList();
-
7/30/2019 Prjct File
39/98
39
if (operationType.equals("add")) {
AddUpdateFlag = "add";
disable(true);
clear();
btnSave.setEnabled(true);
btnAdd.setEnabled(false);
btnUpdate.setEnabled(false);
btnFirst.setEnabled(false);
btnPrevious.setEnabled(false);
btnNext.setEnabled(false);
btnLast.setEnabled(false);
btnUserPersonalDetail.setEnabled(false);
int maxUserID = objDB.getMaxUserId();
txtUserID.setText(String.valueOf(maxUserID + 1));
}
setVisible(true);
}
public void disable(boolean val) {
txtUsername.setEditable(val);
txtPassword.setEditable(val);
ddlUserType.setEnabled(val);
ddlSecurityQuestion.setEnabled(val);
ddlUserStatus.setEnabled(val);
//txtSecurityQuestion.setEditable(val);
txtSecurityAnswer.setEditable(val);
chkUpload.setEnabled(val);
-
7/30/2019 Prjct File
40/98
40
chkDownload.setEnabled(val);
}
public void clear() {
txtUsername.setText("");
txtPassword.setText("");
txtSecurityAnswer.setText("");
// txtSecurityQuestion.setText("");
}
public void showUserRecord(UsermasterBean objBean) {
txtUserID.setText(String.valueOf(objBean.getUserId()));
txtUsername.setText(objBean.getUsername());
txtPassword.setText(objBean.getPassword());
ddlUserType.setSelectedItem(objBean.getUserType());
ddlUserStatus.setSelectedItem(objBean.getUserStatus());
ddlSecurityQuestion.setSelectedItem(objBean.getSecurityQuestion());
txtSecurityAnswer.setText(objBean.getSecurityAnswer());
chkUpload.setSelected(objBean.isCan_Upload());
chkDownload.setSelected(objBean.isCan_Download());
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
-
7/30/2019 Prjct File
41/98
41
// //GEN-
BEGIN:initComponents
private void initComponents() {
jLabel7 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
txtSecurityAnswer = new javax.swing.JTextField();
txtPassword = new javax.swing.JPasswordField();
txtUserID = new javax.swing.JTextField();
txtUsername = new javax.swing.JTextField();
ddlUserType = new javax.swing.JComboBox();
ddlUserStatus = new javax.swing.JComboBox();
jLabel8 = new javax.swing.JLabel();
btnAdd = new javax.swing.JButton();
btnFirst = new javax.swing.JButton();
btnUpdate = new javax.swing.JButton();
btnPrevious = new javax.swing.JButton();
btnNext = new javax.swing.JButton();
btnSave = new javax.swing.JButton();
btnCancel = new javax.swing.JButton();
btnLast = new javax.swing.JButton();
btnUserPersonalDetail = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
chkUpload = new javax.swing.JCheckBox();
chkDownload = new javax.swing.JCheckBox();
ddlSecurityQuestion = new javax.swing.JComboBox();
-
7/30/2019 Prjct File
42/98
42
setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jLabel7.setText("Security Answer");
jLabel4.setText("User Type");
jLabel6.setText("Security Question");
jLabel5.setText("User Status");
jLabel3.setText("Password");
jLabel2.setText("Username");
jLabel1.setText("User ID");
txtUserID.setEditable(false);
ddlUserType.setModel(new javax.swing.DefaultComboBoxModel(new String[] {
"Administrator", "Employee" }));
ddlUserType.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ddlUserTypeActionPerformed(evt);
}
});
ddlUserStatus.setModel(new javax.swing.DefaultComboBoxModel(new String[] {
"Active", "InActive" }));
jLabel8.setFont(new java.awt.Font("Courier New", 1, 18));
-
7/30/2019 Prjct File
43/98
43
jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel8.setText("User Account Detail");
btnAdd.setText("Add");
btnAdd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnAddActionPerformed(evt);
}
});
btnFirst.setText("First");
btnFirst.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnFirstActionPerformed(evt);
}
});
btnUpdate.setText("Update");
btnUpdate.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnUpdateActionPerformed(evt);
}
});
btnPrevious.setText("Previous");
btnPrevious.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnPreviousActionPerformed(evt);
}
});
-
7/30/2019 Prjct File
44/98
44
btnNext.setText("Next");
btnNext.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnNextActionPerformed(evt);
}
});
btnSave.setText("Save");
btnSave.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSaveActionPerformed(evt);
}
});
btnCancel.setText("Cancel");
btnCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCancelActionPerformed(evt);
}
});
btnLast.setText("Last");
btnLast.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnLastActionPerformed(evt);
}
});
btnUserPersonalDetail.setText("Personal Detail");
btnUserPersonalDetail.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
-
7/30/2019 Prjct File
45/98
45
btnUserPersonalDetailActionPerformed(evt);
}
});
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("User Privilege"));
chkUpload.setText("Upload");
chkUpload.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
chkUploadActionPerformed(evt);
}
});
chkDownload.setText("Download");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel1Layout.createSequentialGroup()
.addGap(31, 31, 31)
.addComponent(chkUpload)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 168,
Short.MAX_VALUE)
.addComponent(chkDownload)
.addGap(43, 43, 43))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
-
7/30/2019 Prjct File
46/98
46
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELIN
E)
.addComponent(chkDownload)
.addComponent(chkUpload))
.addContainerGap(17, Short.MAX_VALUE))
);
ddlSecurityQuestion.setModel(new javax.swing.DefaultComboBoxModel(new String[] {
"What is your first mobile number? ", "What is your first school name?", "What is your hobby?",
"Which is your favourite color?", "Which is your favourite sport?" }));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel7)
.addComponent(jLabel4)
.addComponent(jLabel6)
.addComponent(jLabel3)
.addComponent(jLabel2)
.addComponent(jLabel1)
.addComponent(jLabel5))
-
7/30/2019 Prjct File
47/98
47
.addGap(71, 71, 71)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(ddlSecurityQuestion, 0,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtPassword)
.addGroup(layout.createSequentialGroup()
.addComponent(txtUserID,
javax.swing.GroupLayout.PREFERRED_SIZE, 60,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btnUserPersonalDetail,
javax.swing.GroupLayout.PREFERRED_SIZE, 152,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(txtUsername, javax.swing.GroupLayout.DEFAULT_SIZE,
149, Short.MAX_VALUE)
.addComponent(ddlUserType,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtSecurityAnswer,
javax.swing.GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE)
.addComponent(ddlUserStatus,
javax.swing.GroupLayout.PREFERRED_SIZE, 108,
javax.swing.GroupLayout.PREFERRED_SIZE))))
.addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE, 441, Short.MAX_VALUE))
.addGap(34, 34, 34))
.addGroup(layout.createSequentialGroup()
-
7/30/2019 Prjct File
48/98
48
.addGap(53, 53, 53)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(btnAdd, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnFirst, javax.swing.GroupLayout.PREFERRED_SIZE, 75,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(btnUpdate, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnPrevious, javax.swing.GroupLayout.PREFERRED_SIZE, 89,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnNext, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.PREFERRED_SIZE, 75,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnSave, javax.swing.GroupLayout.PREFERRED_SIZE, 75,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 75,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnLast, javax.swing.GroupLayout.PREFERRED_SIZE, 75,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(90, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
-
7/30/2019 Prjct File
49/98
49
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(66, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(jLabel8)
.addGap(32, 32, 32)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(txtUserID, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnUserPersonalDetail,
javax.swing.GroupLayout.PREFERRED_SIZE, 20,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(txtUsername, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(12, 12, 12)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
-
7/30/2019 Prjct File
50/98
50
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(ddlUserType, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ddlUserStatus, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))
.addGap(12, 12, 12)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(ddlSecurityQuestion,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(16, 16, 16)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(txtSecurityAnswer, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
-
7/30/2019 Prjct File
51/98
51
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnFirst, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnPrevious, javax.swing.GroupLayout.PREFERRED_SIZE,
20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnUpdate, javax.swing.GroupLayout.PREFERRED_SIZE,
20, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addComponent(btnNext, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btnSave, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(btnLast, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
javax.swing.GroupLayout.PREFERRED_SIZE)))
-
7/30/2019 Prjct File
52/98
52
.addGap(20, 20, 20))
);
}// //GEN-END:initComponents
private void ddlUserTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_ddlUserTypeActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_ddlUserTypeActionPerformed
private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_btnAddActionPerformed
// TODO add your handling code here:
AddUpdateFlag = "add";
disable(true);
clear();
btnSave.setEnabled(true);
btnAdd.setEnabled(false);
btnUpdate.setEnabled(false);
btnFirst.setEnabled(false);
btnPrevious.setEnabled(false);
btnNext.setEnabled(false);
btnLast.setEnabled(false);
btnUserPersonalDetail.setEnabled(false);
chkDownload.setSelected(false);
chkUpload.setSelected(false);
int maxUserID = objDB.getMaxUserId();
txtUserID.setText(String.valueOf(maxUserID + 1));
}//GEN-LAST:event_btnAddActionPerformed
-
7/30/2019 Prjct File
53/98
53
private void btnFirstActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_btnFirstActionPerformed
if (alstUser.size() > 0) {
count = 0;
UsermasterBean objBean = (UsermasterBean) alstUser.get(count);
showUserRecord(objBean);
}
}//GEN-LAST:event_btnFirstActionPerformed
private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_btnUpdateActionPerformed
// TODO add your handling code here:
AddUpdateFlag = "update";
disable(true);
btnSave.setEnabled(true);
btnAdd.setEnabled(false);
btnUpdate.setEnabled(false);
btnFirst.setEnabled(false);
btnPrevious.setEnabled(false);
btnNext.setEnabled(false);
btnLast.setEnabled(false);
btnUserPersonalDetail.setEnabled(false);
}//GEN-LAST:event_btnUpdateActionPerformed
private void btnPreviousActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_btnPreviousActionPerformed
// TODO add your handling code here:
if (count > 0) {
count--;
-
7/30/2019 Prjct File
54/98
54
UsermasterBean objBean = (UsermasterBean) alstUser.get(count);
showUserRecord(objBean);
}
}//GEN-LAST:event_btnPreviousActionPerformed
private void btnNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_btnNextActionPerformed
// TODO add your handling code here:
if (count < alstUser.size() - 1) {
count++;
UsermasterBean objBean = (UsermasterBean) alstUser.get(count);
showUserRecord(objBean);
}
}//GEN-LAST:event_btnNextActionPerformed
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_btnSaveActionPerformed
String result = "";
int flag = 0;
UsermasterBean objBean = new UsermasterBean();
objBean.setUserId(Integer.parseInt(txtUserID.getText()));
objBean.setPassword(new String(txtPassword.getPassword()));
objBean.setUserType(ddlUserType.getSelectedItem().toString());
objBean.setUserStatus(ddlUserStatus.getSelectedItem().toString());
objBean.setUsername(txtUsername.getText());
objBean.setSecurityQuestion(ddlSecurityQuestion.getSelectedItem().toString());
objBean.setSecurityAnswer(txtSecurityAnswer.getText());
objBean.setCan_Upload(chkUpload.isSelected());
objBean.setCan_Download(chkDownload.isSelected());
-
7/30/2019 Prjct File
55/98
55
if (AddUpdateFlag.equals("add")) {
if (txtUserID.getText().equals("")) {
JOptionPane.showMessageDialog(this, "User ID is missing", "ERROR",
JOptionPane.ERROR_MESSAGE);
} else if (txtUsername.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Username is missing", "ERROR",
JOptionPane.ERROR_MESSAGE);
} else if (new String(txtPassword.getPassword()).equals("")) {
JOptionPane.showMessageDialog(this, "Password is missing", "ERROR",
JOptionPane.ERROR_MESSAGE);
} else {
try {
result = objDB.addUserAccountDetail(objBean);
} catch (Exception e) {
JOptionPane.showMessageDialog(this, "Record Cannot be Added", "ERROR",
JOptionPane.ERROR_MESSAGE);
}
}
if (result.equals("added")) {
flag = 1;
alstUser = objDB.getAllUserDetailList();
count = alstUser.size() - 1;
UsermasterBean objBean1 = (UsermasterBean) alstUser.get(count);
showUserRecord(objBean1);
JOptionPane.showMessageDialog(null, "Record has been successfully added",
"Record Added", 1);
} else if (result.equals("failed")) {
-
7/30/2019 Prjct File
56/98
56
JOptionPane.showMessageDialog(null, "Record not Added", "ERROR", 2);
} else if (result.equals("exists")) {
JOptionPane.showMessageDialog(null, "User already exist", "ERROR", 2);
}
} else if (AddUpdateFlag.equals("update")) {
if (txtUserID.getText().equals("")) {
JOptionPane.showMessageDialog(this, "User ID is missing", "ERROR",
JOptionPane.ERROR_MESSAGE);
} else if (txtUsername.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Username is missing", "ERROR",
JOptionPane.ERROR_MESSAGE);
} else if (new String(txtPassword.getPassword()).equals("")) {
JOptionPane.showMessageDialog(this, "Password is missing", "ERROR",
JOptionPane.ERROR_MESSAGE);
} else {
objBean.setFlag(true);
result = objDB.updateUserAccountDetail(objBean);
}
if (result.equals("updated")) {
flag = 1;
alstUser = objDB.getAllUserDetailList();
UsermasterBean objBean1 = (UsermasterBean) alstUser.get(count);
showUserRecord(objBean1);
JOptionPane.showMessageDialog(null, "Record has been successfully updated",
"Record Updated", 1);
} else if (result.equals("failed")) {
JOptionPane.showMessageDialog(null, "Record not Added", "ERROR", 2);
-
7/30/2019 Prjct File
57/98
57
} else if (result.equals("exists")) {
JOptionPane.showMessageDialog(null, "User already exists", "ERROR", 2);
}
}
if (flag == 1) {
disable(false);
btnSave.setEnabled(false);
btnAdd.setEnabled(true);
btnUpdate.setEnabled(true);
btnFirst.setEnabled(true);
btnPrevious.setEnabled(true);
btnNext.setEnabled(true);
btnLast.setEnabled(true);
btnUserPersonalDetail.setEnabled(true);
}
}//GEN-LAST:event_btnSaveActionPerformed
private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_btnCancelActionPerformed
// TODO add your handling code here:
MainFrame.container.removeAll();
MainFrame.container.setVisible(false);
}//GEN-LAST:event_btnCancelActionPerformed
private void btnLastActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_btnLastActionPerformed
-
7/30/2019 Prjct File
58/98
58
// TODO add your handling code here:
if (alstUser.size() > 0) {
count = alstUser.size() - 1;
UsermasterBean objBean = (UsermasterBean) alstUser.get(count);
showUserRecord(objBean);
}
}//GEN-LAST:event_btnLastActionPerformed
private void btnUserPersonalDetailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_btnUserPersonalDetailActionPerformed
// TODO add your handling code here:
MainFrame.container.removeAll();
UserPersonalDetail objUserPersonalDetail = new UserPersonalDetail(count);
objUserPersonalDetail.setBounds(250, 100, 460, 450);
MainFrame.container.setVisible(false);
MainFrame.container.add(objUserPersonalDetail);
MainFrame.container.setVisible(true);
}//GEN-LAST:event_btnUserPersonalDetailActionPerformed
private void chkUploadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_chkUploadActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_chkUploadActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnAdd;
private javax.swing.JButton btnCancel;
private javax.swing.JButton btnFirst;
private javax.swing.JButton btnLast;
private javax.swing.JButton btnNext;
-
7/30/2019 Prjct File
59/98
59
private javax.swing.JButton btnPrevious;
private javax.swing.JButton btnSave;
private javax.swing.JButton btnUpdate;
private javax.swing.JButton btnUserPersonalDetail;
private javax.swing.JCheckBox chkDownload;
private javax.swing.JCheckBox chkUpload;
private javax.swing.JComboBox ddlSecurityQuestion;
private javax.swing.JComboBox ddlUserStatus;
private javax.swing.JComboBox ddlUserType;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JPasswordField txtPassword;
private javax.swing.JTextField txtSecurityAnswer;
private javax.swing.JTextField txtUserID;
private javax.swing.JTextField txtUsername;
// End of variables declaration//GEN-END:variables
}
FILE UPLOAD AND DOWNLOAD
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sharemanagerserver.server;
-
7/30/2019 Prjct File
60/98
60
import java.net.ServerSocket;
import java.net.Socket;
import sharemanagerserver.Authentication;
import sharemanagerserver.MainFrame;
import sharemanagerserver.alpha.DBOperations;
/**
*
* @author Administrator
*/
public class FTPServer extends Thread {
DBOperations db = new DBOperations();
int serverPort = 1;
ServerSocket soc;
public FTPServer() {
try {
serverPort = db.getServerPort();
System.out.println("server port " + serverPort);
soc = new ServerSocket(serverPort);
System.out.println("FTP Server Started on Port Number " + serverPort);
start();
if (!isAlive()) {
MainFrame.serverFlag = 0;
}
} catch (Exception e) {
MainFrame.serverFlag = 0;
e.printStackTrace();
}
-
7/30/2019 Prjct File
61/98
61
}
@Override
public void run() {
MainFrame.serverFlag = 1;
while (true) {
try {
sleep(2000);
while (true) {
sleep(2000);
System.out.println("Waiting for Connection ...");
Socket s = soc.accept();
System.out.println("CSonnected ...");
Authentication.cancelFlag = 0;
Authentication.flag = 0;
while (true) {
if (Authentication.cancelFlag == 1 || Authentication.flag == 1) {
// s.close();
break;
} else {
new Authentication(s);
}
}
if (Authentication.flag == 1) {
new TransferFile(s);
}
}
-
7/30/2019 Prjct File
62/98
62
} catch (Exception e) {
MainFrame.serverFlag = 0;
System.out.println("Tested " + e);
}
}
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sharemanagerserver.server;
/**
*
* @author Administrator
*/
public class ServerRun {
public ServerRun()
{
Thread t=new Thread(new FTPServer());
t.start();
}
}
REPORTS
-
7/30/2019 Prjct File
63/98
63
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sharemanagerserver.report;
import sharemanagerserver.alpha.*;
import java.sql.Connection;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.view.JasperViewer;
/**
*
* @author admin
*/
public class JasperReportGenerator {
String designFilePath;
public JasperReportGenerator(String designFilePath) {
this.designFilePath = designFilePath;
generateReport();
}
void generateReport() {
try {
-
7/30/2019 Prjct File
64/98
64
JasperDesign jasperDesign = JRXmlLoader.load(designFilePath);
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
Connection con = DBConnection.getConnection();
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, null, con);
JasperViewer.viewReport(jasperPrint, false);
} catch (Exception e) {
System.out.println("Exception in generationg report, generateReport() of
JasperReportGenerator: "+e);
}
}
}
-
7/30/2019 Prjct File
65/98
65
Client
Login
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sharemanagerclient;
import java.net.Socket;
import javax.swing.JOptionPane;
import sharemanagerclient.com.DBOperation;
import sharemanagerclient.com.FTPConfigurationMasterBean;
/**
*
* @author student
*/
public class FTPLoginClient {
Socket s;
int flag, flag1;
String str;
public FTPLoginClient() {
try {
DBOperation objDb = new DBOperation();
FTPConfigurationMasterBean objWftpcmb = objDb.getServerPort();
s = new Socket(objWftpcmb.getFTP_Server_IP(), objWftpcmb.getFTP_Server_Port());
flag = 1;
-
7/30/2019 Prjct File
66/98
66
} catch (Exception e) {
flag = 0;
JOptionPane.showMessageDialog(null, "Unable to Connect. Try again later!",
"ERROR", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
if (flag == 1) {
try {
new LoginFrame(s);
} catch (Exception e2) {
System.out.println("Exception int FTPLoginClient()" + e2);
}
//dispose();
}
}
}
USER MAINTAINENCE
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sharemanagerclient;
import javax.swing.JOptionPane;
import sharemanagerclient.com.DBOperation;
import sharemanagerclient.com.UsermasterBean;
-
7/30/2019 Prjct File
67/98
67
/**
*
* @author admin
*/
public class ProfileAccountDetail extends javax.swing.JPanel {
DBOperation objDB = new DBOperation();
String AddUpdateFlag;
int userId;
UsermasterBean objBean;
/** Creates new form UserAccountDetail */
public ProfileAccountDetail() {
initComponents();
btnSave.setEnabled(false);
disable(false);
userId = MainFrameClient.userid;
objBean = objDB.getUserAccountDetailByUserId(userId);
showUserRecord(objBean);
setVisible(true);
}
public void disable(boolean val) {
txtUsername.setEditable(val);
txtPassword.setEditable(val);
ddlSecurityQuestion.setEnabled(val);
txtSecurityAnswer.setEditable(val);
}
public void clear() {
-
7/30/2019 Prjct File
68/98
68
txtUsername.setText("");
txtPassword.setText("");
txtSecurityAnswer.setText("");
}
public void showUserRecord(UsermasterBean objBean) {
txtUserID.setText(String.valueOf(objBean.getUserId()));
txtUsername.setText(objBean.getUsername());
txtPassword.setText(objBean.getPassword());
ddlSecurityQuestion.setSelectedItem(objBean.getSecurityQuestion());
txtSecurityAnswer.setText(objBean.getSecurityAnswer());
chkDownload.setSelected(objBean.isCan_Download());
chkUpload.setSelected(objBean.isCan_Upload());
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// //GEN-
BEGIN:initComponents
private void initComponents() {
jLabel7 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
-
7/30/2019 Prjct File
69/98
69
jLabel2 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
txtSecurityAnswer = new javax.swing.JTextField();
txtPassword = new javax.swing.JPasswordField();
txtUserID = new javax.swing.JTextField();
txtUsername = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
btnUpdate = new javax.swing.JButton();
btnSave = new javax.swing.JButton();
btnCancel = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
chkUpload = new javax.swing.JCheckBox();
chkDownload = new javax.swing.JCheckBox();
ddlSecurityQuestion = new javax.swing.JComboBox();
setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jLabel7.setText("Security Answer");
jLabel6.setText("Security Question");
jLabel3.setText("Password");
jLabel2.setText("Username");
jLabel1.setText("User ID");
txtUserID.setEditable(false);
jLabel8.setFont(new java.awt.Font("Courier New", 1, 18));
jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
-
7/30/2019 Prjct File
70/98
70
jLabel8.setText("User Account Detail");
btnUpdate.setText("Update");
btnUpdate.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnUpdateActionPerformed(evt);
}
});
btnSave.setText("Save");
btnSave.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSaveActionPerformed(evt);
}
});
btnCancel.setText("Cancel");
btnCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCancelActionPerformed(evt);
}
});
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("User Privilege"));
chkUpload.setText("Upload");
chkUpload.setEnabled(false);
chkUpload.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
chkUploadActionPerformed(evt);
}
-
7/30/2019 Prjct File
71/98
71
});
chkDownload.setText("Download");
chkDownload.setEnabled(false);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel1Layout.createSequentialGroup()
.addGap(31, 31, 31)
.addComponent(chkUpload)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 200,
Short.MAX_VALUE)
.addComponent(chkDownload)
.addGap(43, 43, 43))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELIN
E)
.addComponent(chkDownload)
.addComponent(chkUpload))
.addContainerGap(16, Short.MAX_VALUE))
);
-
7/30/2019 Prjct File
72/98
72
ddlSecurityQuestion.setModel(new javax.swing.DefaultComboBoxModel(new String[] {
"What is your first mobile number? ", "What is your first school name?", "What is your hobby?",
"Which is your favourite color?", "Which is your favourite sport?" }));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel2)
.addComponent(jLabel1))
.addGap(117, 117, 117)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtPassword)
.addComponent(txtUserID,
javax.swing.GroupLayout.PREFERRED_SIZE, 60,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtUsername,
javax.swing.GroupLayout.DEFAULT_SIZE, 149, Short.MAX_VALUE)))
-
7/30/2019 Prjct File
73/98
73
.addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE, 418, Short.MAX_VALUE))
.addGap(35, 35, 35))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(btnUpdate)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnSave, javax.swing.GroupLayout.PREFERRED_SIZE,
75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(btnCancel, javax.swing.GroupLayout.PREFERRED_SIZE,
75, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING,
layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel7)
.addComponent(jLabel6))
.addGap(71, 71, 71)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtSecurityAnswer)
-
7/30/2019 Prjct File
74/98
74
.addComponent(ddlSecurityQuestion, 0,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))))
.addContainerGap())))
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[]
{btnCancel, btnSave, btnUpdate});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(35, 35, 35)
.addComponent(jLabel8)
.addGap(32, 32, 32)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(txtUserID, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(txtUsername, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(12, 12, 12)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
-
7/30/2019 Prjct File
75/98
75
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(ddlSecurityQuestion,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(16, 16, 16)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(txtSecurityAnswer, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnSave, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[]
{btnCancel, btnSave, btnUpdate});
-
7/30/2019 Prjct File
76/98
76
}// //GEN-END:initComponents
private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_btnUpdateActionPerformed
// TODO add your handling code here:
AddUpdateFlag = "update";
disable(true);
btnSave.setEnabled(true);
btnUpdate.setEnabled(false);
}//GEN-LAST:event_btnUpdateActionPerformed
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_btnSaveActionPerformed
String result = "";
int flag = 0;
objBean.setUserId(Integer.parseInt(txtUserID.getText()));
objBean.setPassword(new String(txtPassword.getPassword()));
objBean.setUsername(txtUsername.getText());
objBean.setSecurityQuestion(ddlSecurityQuestion.getSelectedItem().toString());
objBean.setSecurityAnswer(txtSecurityAnswer.getText());
if (txtUserID.getText().equals("")) {
JOptionPane.showMessageDialog(this, "User ID is missing", "ERROR",
JOptionPane.ERROR_MESSAGE);
} else if (txtUsername.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Username is missing", "ERROR",
JOptionPane.ERROR_MESSAGE);
-
7/30/2019 Prjct File
77/98
77
} else if (new String(txtPassword.getPassword()).equals("")) {
JOptionPane.showMessageDialog(this, "Password is missing", "ERROR",
JOptionPane.ERROR_MESSAGE);
} else {
result = objDB.updateUserAccountDetail(objBean);
}
if (result.equals("updated")) {
flag = 1;
objBean = objDB.getUserAccountDetailByUserId(userId);
showUserRecord(objBean);
JOptionPane.showMessageDialog(null, "Record has been successfully updated", "Record
Updated", 1);
} else if (result.equals("failed")) {
JOptionPane.showMessageDialog(null, "Record not Added", "ERROR", 2);
} else if (result.equals("exists")) {
JOptionPane.showMessageDialog(null, "User already exists", "ERROR", 2);
}
if (flag == 1) {
disable(false);
btnSave.setEnabled(false);
btnUpdate.setEnabled(true);
}
}//GEN-LAST:event_btnSaveActionPerformed
private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_btnCancelActionPerformed
// TODO add your handling code here:
-
7/30/2019 Prjct File
78/98
78
MainFrameClient.container.removeAll();
MainFrameClient.container.setVisible(false);
}//GEN-LAST:event_btnCancelActionPerformed
private void chkUploadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_chkUploadActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_chkUploadActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCancel;
private javax.swing.JButton btnSave;
private javax.swing.JButton btnUpdate;
private javax.swing.JCheckBox chkDownload;
private javax.swing.JCheckBox chkUpload;
private javax.swing.JComboBox ddlSecurityQuestion;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JPasswordField txtPassword;
private javax.swing.JTextField txtSecurityAnswer;
private javax.swing.JTextField txtUserID;
private javax.swing.JTextField txtUsername;
// End of variables declaration//GEN-END:variables
}
-
7/30/2019 Prjct File
79/98
79
FTP SERVER
-
7/30/2019 Prjct File
80/98
80
-
7/30/2019 Prjct File
81/98
81
-
7/30/2019 Prjct File
82/98
82
-
7/30/2019 Prjct File
83/98
83
EMAIL
package sharemanagerclient.email;
import java.util.Properties;
import java.util.Date;
import javax.mail.Address;
-
7/30/2019 Prjct File
84/98
84
import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
public class SendSMTP {
String result = "failed";
public String sendMail(String toEmailId, String text, String subject) {
try {
//--[ Set up the default parameters
Properties p = new Properties();
p.put("mail.smtp.auth", "true");
p.put("mail.transport.protocol", "smtp");
p.put("mail.smtp.host", "smtp.gmail.com");
p.put("mail.smtp.port", "25");
p.put("mail.smtp.starttls.enable", "true");
//--[ Create the session and create a new mail message
Authenticator auth = new SMTPAuthenticator("gmailid", "password");
Session mailSession = Session.getInstance(p, auth);
Message msg = new MimeMessage(mailSession);
//--[ Set the FROM, TO, DATE and SUBJECT fields
msg.setFrom(new InternetAddress("gmailid"));
String rec[] = toEmailId.split(";");
-
7/30/2019 Prjct File
85/98
85
int count = 1;
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(rec[0]));
while (count < rec.length) {
msg.addRecipients(Message.RecipientType.TO, InternetAddress.parse(rec[count]));
count++;
}
msg.setSentDate(new Date());
msg.setSubject(subject);
//--[ Create the body of the mail
msg.setText(text);
//--[ Ask the Transport class to send our mail message
Transport trans = mailSession.getTransport();
trans.connect();
Address[] ad = msg.getAllRecipients();
for (int i = 0; i < ad.length; i++) {
try {
Address[] ad1 = new Address[1];
ad1[0] = ad[i];
trans.sendMessage(msg, ad1);
result = "sent";
} catch (Exception e) {
continue;
-
7/30/2019 Prjct File
86/98
86
}
}
} catch (Exception E) {
System.out.println("Something gone wrong while sending mail!");
E.printStackTrace();
return result;
}
return result;
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sharemanagerclient.email;
import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;
/**
*
* @author Administrator
*/
public class SMTPAuthenticator extends Authenticator{
private String username,password;
public SMTPAuthenticator(String username,String password){
this.username=username;
-
7/30/2019 Prjct File
87/98
87
this.password=password;
}
public javax.mail.PasswordAuthentication getPasswordAuthentication(){
return new PasswordAuthentication(this.username,this.password);
}
}
-
7/30/2019 Prjct File
88/98
88
CHAPTER-5
Testing
5.1 which testing technique used in project
The most natural, and customary, way of verifying any piece of work is just to operate it in some
representative situations and verify whether its Behavior is as expected. In general, it is
impossible to test it under all possible operating conditions. Thus, it is necessary to find suitable
test cases that provide enough evidence that the desired behavior will be exhibited in all
remaining cases. Further more, in the case of software testing, the usual analogies betweentraditional Engineering fields and software engineering fail to provide useful suggestions.
Testing is a critical activity in software engineering and should be performed as systematically as
possible by stating clearly what result one expects to obtain that result. On the contrary, often in
practice, testing is performed in an unstructured way without applying any criterion.
Software Testing Techniques:
The important of software testing and its implication with respect to software quality cannot be
overemphasized. Software testing is a critical element of software quality assurance and
represents the ultimate review of specification, design and code generation. The increase in
visibility of soft-ware as a system element and the attendant cost associated with a software
failure are motivating forces for well-planned, through testing is not unusual for a software
development organization to expand between 30 and 40% of total project effort on testing. In the
extreme testing of human rated software for exampleflight control, nuclear reactor monitoring
can cost 3 to 5 time as much as all other software engineering steps combined!
There are two major type of testing they are
1) White Box Testing.2) Black Box Testing.
-
7/30/2019 Prjct File
89/98
89
White Box Testing
White box some times called Glass box testing is a test case design uses the control structure
of the procedural design to drive test case.
Using white box testing methods, the following tests where made on the system
a) All independent paths within a module have been exercised once. In our system, ensuring that
case was selected and executed checked all case structures. The bugs that were prevailing in
some part of the code where fixed
b) All logical decisions were checked for the truth and falsity of the values.
Black box Testing Black box testing focuses on the functional requirements of the software.
This is black box testing enables the software engineering to derive a set of input conditions that
will fully exercise all functional requirements