full thesis.pdf

Upload: nishant-raj

Post on 02-Jun-2018

245 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 Full Thesis.pdf

    1/109

    INFORMATION AND COMMUNICATION TECHNOLOGIES ENGINEERING

    GRADUATION PROJECT REPORT

    Thesis Title

    Administration and Student AffairsSystem

    Supervisors

    Prof. Sameh A.SalemProf. Claudio FornaroDr. Paolo Prinetto

    Students

    Ahmed Adel A ad.!an" A#d E$%Samad.Ahmed !isham Saad.

    Amro Salem !assan.Ram" Saad &ohare#.

    A'ademi' "ear ()*)+**

    1

  • 8/10/2019 Full Thesis.pdf

    2/109

    Administration and Student Affairs System

    Project Team:

    1- Amro Salem Hassan:-Database Design and Security.-Student Module.-Shared in Admin Module.

    - !amy Saad Mohareb:-"onstructing #! Model $sing S%& De'elo(er Datamodeler)*racle +1+ release,.-Professor Module.-Shared in Admin Module.

    - Hany Abd #l-Samad:-Database "reation Scri(ts.

    - Ahmed Adel A/ad:-"ontrol Module.

    0- Ahmed Hisham Saad:- raduate Module.

    2

  • 8/10/2019 Full Thesis.pdf

    3/109

    Index

    Part I : Modeling the Problem.

    Chapter 1 : Introduction: Page1.1- 2ntroducing the Problem. 1. - ra(hical !e(resentation of the Project. 01. - Dee(er &oo3 into the Database. 41. - Modules and &ayers of the "lient A((lication. 1+1.0- Products $sed in the Project. 15

    Part II : Solving the Problem.

    Chapter 2: Amro Salem Contribution:.1- Designing the 2m(lementation. 16. - 2dentifying the $sers of the System and "reating

    "orres(onding !oles.. - Some 7unctions of the Student Module. 5. - 2m(ortant 7eatures of the Student Module 8a'a

    "ode. 6.0- Some 7unctions of the Admin Module.

    Chapter 3: Ram Saad Contribution:.1- Some 7unctions of the Professor Module. 9. - 2m(ortant 7eatures of the Professor Module 8a'a

    "ode.. - 2m(ortant 7eatures of the Admin Module. 6. - The 8a'a Mail AP2. 0

    Chapter !: "an Abd#lSamad Contribution:.1- "reating Tables. 0. - #nable !o/ Mo'ement 7eature. 09

    Chapter $: Ahmed A%ad Contribution. 04

    Chapter &: Ahmed "i'ham Contribution. 4

    3

  • 8/10/2019 Full Thesis.pdf

    4/109

    Chapter 1Introduction

    1.1- 7ile S "om(uteri;ed System:

    Due to the increasing number of students a((lying toHel/anuests of those students. There are se'eralsolutions for this (roblem. *ne of the most com(eting solutions isim(lementing a three-tier system )Data ser'er - A((lication ser'er -"lients,. This solution re>uires a lot of resources: at least three u(-to-date ser'er machines= at least t/o dedicated data ser'ers= and a coolingsystem. Since those re>uirements /ere difficult to allocate= and sincethere /ere a lac3 in resources= another solution /as considered.

    The solution /e chose to im(lement is a t/o-tier system /hichconsists of a dedicated database= and a s(ecially constructed 8a'a"lient A((lication. The u(side of this solution is that the (rocessing is nomore centrali;ed. *n the contrary= the client a((lication consumes theresources of the user running it locally. The only thing that is centrali;edis the database. The trade off /as harder (rogramming to manage(arallel e?ecution (roblems= and resources )(rocessor and memory,consum(tion.

    @e managed to mani(ulate the database through 8a'a "lient A((lication by using 8D " AP2 offered by *racle for connecting andretrie'ing data from data sources.

    The resource consum(tion /as minimi;ed by utili;ing (arallel(rocessing through the Threading AP2 of the 8a'a (latform. Also thee'ent dri'en nature of the des3to( a((lication made minimi;ing theresource consum(tion easier= since only the (rocess that the userinitiates /ill be using the resources.

    The choice of 8a'a Platform )8a'a (rogramming language and AP2s, /as made based on su((orting a solution for the (roblem ofdi'ersity of (latforms. Since the t/o-tier architecture re>uires installingthe client a((lication on the users P"s )/hich may ha'e different(latforms,= the (ortability of the system has been a major issue. The8a'a Platform sol'es this (roblem by (ro'iding different 8 Ms ) 8a'a

    irtual Machines , for different architectures. So the 8a'a bytecoderesulting from com(iling the 8a'a source codes could run on any(latform regardless ho/ it is im(lemented. So as a conclusion= the 8a'aPlatform /as chosen to o'ercome the intero(erability issue resultingfrom the different (latforms that /ould be running the client a((lication.

    4

  • 8/10/2019 Full Thesis.pdf

    5/109

    1. - A ra(hical !e(resentation of the Project:

    The static 2P is a fi?ed 2P address gi'en to a cloud terminal. 2f thestatic 2P /as not used in the system it /ould ha'e been im(ossible for

    the client a((lication to recogni;e the ser'er o'er the cloud. Any terminalaccessing the cloud is normally assigned a dynamic 2P that changes(eriodically or /hene'er the connection is terminated. @ith this situationthe (ossible solutions are either to construct a 'irtual (ri'ate net/or3) PB, bet/een the clients and the database= or to assign a fi?ed 2P tothe database so that /hene'er a client is calling the database= this 2Paddress could be used to establish the connection. The (roblem /ith the

    PB /as that /hene'er a ne/ client is introduced to the system= the

    5

  • 8/10/2019 Full Thesis.pdf

    6/109

    net/or3 administrator must add this client to the PB manually using theMA" address. So it is ob'ious that the dynamicity of the system /ouldha'e been unaccom(lished if this solution /as im(lemented. *n theother hand= the solution of the static 2P (ut no o'erhead for establishinga fi?ed closed net/or3. esides the static 2P solution is by far more

    com(atible /ith configuring the database listener. The disad'antage ofthe static 2P /as the 'ulnerability for unauthori;ed access. $sing the*racle database hel(ed us o'ercoming this disad'antage on the ser'erside= since the *racle database utili;es multi(le security features. $singthe 8a'a Platform hel(ed us o'ercoming this (roblem on the client side=since the 8a'a Platforms im(lements the Sandbo? Security Model= /hichre>uires authentication /hene'er a connection is re>uested from acloud.

    Database &istener is an a((lication offered by *racle andbundled /ith their database ser'er. The listener continuously chec3s for

    connections coming o'er a T"P

  • 8/10/2019 Full Thesis.pdf

    7/109

    There /ere multi(le (rotocols that could be used achie'esuccessful communication o'er the cloud: $DP= T"P= and *ranet. TheT"P /as chosen s(ecifically because by far the T"P is the mostcom(atible communication (rotocol used in com(uter net/or3s.

    Additionally the T"P is (erfectly com(atible /ith both the database

    listener and the 8D " AP2 . Di'iding the data to be communicated intosmall segments called (ac3ets= the T"P creates messages to becommunicated o'er the cloud.

    8D " is an AP2 (ro'ided by *racle to achie'e the communicationlin3 bet/een client a((lications and the database. The 8D " (ro'idesan interface bet/een the client a((lication and one end of the T"Pchannels= so basically translates 8a'a strings into S%& >ueries thatcould be understood by the data-ser'er and translates bac3 the result

    returned by the database into !esultSet objects that could beunderstood by 8!#.

    7

  • 8/10/2019 Full Thesis.pdf

    8/109

    1. - Dee(er &oo3 into the Database:

    A large organi;ation such as a uni'ersity contains a large numberof entities. #ach entity is correlated to the other entities by a relationshi(.!elationshi(s bet/een entities defined the /ay each entity /ill affect and

    be affected by the other entities. @hen constructing the database thedesigner is su((osed to figure out a ma((ing bet/een the entitiese?isting in the en'ironment to be modeled and the tables of the databasemodeling this en'ironment. Such ma((ing should re(resent each one ofthose entities into a table= the columns of this table carries the attributesof the entity. As an e?am(le /hen modeling the em(loyees of anorgani;ation a table /ould be created /ith its columns carrying theattributes that describe each of the em(loyees. So the table /ould loo3li3e:

    8

  • 8/10/2019 Full Thesis.pdf

    9/109

    #ach one of these attributes is bounded by natural conditions= fore?am(le a hundred years old em(loyee cannot be hired. These naturalboundaries are modeled in the database through constraints."onstraints are also used to enforce the business (rocess rules. 7ore?am(le in the case of a uni'ersity a student cannot enroll in a course

    /hich he hasnCt (assed its (rere>uisites. The ty(es of constraintsa'ailable in *racle database are:1- Primary Key constraints: The (rimary 3ey is used to identify

    any ro/ in the system. Primary 3ey enforces the no t/o ro/s can ha'ethe same 'alue for a column also ro/s cannot ha'e null 'alues in thesecolumn.

    2- Unique constraints: $ni>ue constraints are the same as(rimary 3ey constraints /ith the e?ce(tion that they acce(t null 'alues.

    3- Not Null constraints: Bot Bull constraints enforce the ro/s to

    ha'e 'alues in the column to /hich they are a((lied.4- Check constraints: "hec3 constraints demands that the 'alues

    inserted should adhere to a gi'en condition s(ecified in the creation ofthe constraint.

    5- Foreign Key: This 3ind of constraints is used to constructrelationshi(s. As foreign 3eys re>uires that ro/s inserted in a child tablecannot ha'e 'alues in the column that refer to the (arent table that doesnot already e?ists in the (arent table.

    Some of the constraints included in our database design andresulted from the modeling done to the business (rocess of theuni'ersity are:

    9

  • 8/10/2019 Full Thesis.pdf

    10/109

    1. - &ayers and Modules of the "lient A((lication:

    The system /as di'ided into fi'e layers each of these layers /asim(lemented se(arately. #ach layer can communicate only either /iththe directly successor layer or /ith the directly (redecessor layer.

    10

  • 8/10/2019 Full Thesis.pdf

    11/109

    The Data-&ayer contains database /hich consists of the (hysicaldata files and the logical re(resentation of those files in the form oftables= 'ie/s= constraints= and se>uence. The database also containslogical entities that maintain the security and access control to the data=for e?am(le users= and roles. The database also carries metadatare(resented in the Data Dictionary in the form of 'ie/s /hich containsinformation about all the objects= users= roles etc in the database.Data Dictionary can only be mani(ulated by the database administrator.

    The Session-&ayer /ra(s u( the o(erations that could be doneagainst the database and offers to the u((er layers an interface or AP2

    that can be used to mani(ulate the data regardless /here the data is(laced. Some of the o(erations offered by the session-layer are e?ecuteselect and e?ecute DM&:

    11

  • 8/10/2019 Full Thesis.pdf

    12/109

  • 8/10/2019 Full Thesis.pdf

    13/109

    The most im(ortant feature of this layer is that it (ro'ides a(ortable AP2 for sending emails. This feature built based on the 8a'amail AP2= /hich is the o(en source e?tension (ro'ided by *racle. The8a'a mail AP2 is used to send emails using e?ternal SMTP ser'ers li3e

    mail= Hotmail= and Eahoo.

    The Handling-layer is used to manage the $2 forms by hidingthe ser'ices initiated by buttons and /hatsoe'er from the final $2re(resentation of these ser'ices. 2n other /ords the handling layer ma(se'ery button= form= $2 table= and list to a ser'ice (ro'ided to thesystem by the ser'ices layer. 7or e?am(le (ressing search in the searchcourses (anel of the $2 layer:

    13

  • 8/10/2019 Full Thesis.pdf

    14/109

    This (rocess is ma((ed into the search courses (rocess in theser'ices layer by the handling layer as follo/:

    public void actionPerformed( ActionEvent evt) { Services.StudentSearchCourses search;

    if( evt.getActionCommand().equals gnoreCase(!search!)) search " ne#

    Services.StudentSearchCourses( manipulate$parent.getCourse %().equals

    gnoreCase(!!) & null ' parent.getCourse %()$parent.getCourse ame().equal

    s gnoreCase(!!) & null ' parent.getCourse ame()$

    14

  • 8/10/2019 Full Thesis.pdf

    15/109

    null$ parent.getCredits()$

    parent.get um fPrequisits()$parent.getStatus*().equals g

    noreCase(!an+!) & null ' parent.getStatus*()$

    parent.getStatus,().equals gnoreCase(!an+!) & null ' parent.getStatus,());

    else search " ne#

    Services.StudentSearchCourses( manipulate$ null$null$ null$ -*$ -*$ null$ null);

    ie#CurrentCourses vie# " ne#

    ie#CurrentCourses( parent.get urParent()); vie#.set/able( search.get0esult() ); parent.get/abbedPane().setComponentA

    t( parent.get/abbedPane().getSelected nde1() $vie# );

    2

    #ach of the $2 layer and the handling layer is di'ided into fi'ese(arate modules:

    1- he !tu"ent mo"ule: 2s made to be used by the students of theuni'ersity using the system. 2t offers multi(le functions that the student

    may be using to u(date= 'ie/= enroll etc in a course or e?am.- he Pro#essor mo"ule: 2s made to be used by (rofessors

    inde(endently from the administrator. As an e?am(le he can schedule amidterm= >ui; or final e?am to be seen by the /hole users of the systemafter the scheduling re>uest being confirmed by the systemadministrator. He can also 'ie/ his studentsC attendance or e'en otherstudents on the system= but he cannot change the attendance sheet'alues as it is an administrator authority.

    - he Control mo"ule: 2s made to be used by the (rofessors orem(loyees that ha'e the authority of submitting the e?am scores in thedatabase. This module also enables the control users to edit= delete or'ie/ all the results for the students= considering that the system has thehighest authority administrator that should confirm the re>uestedchanges in the results and (lace it on the database.

    - he $ra"uate mo"ule: 2s made to be used by the studentsbeing graduated from the uni'ersity. Those users can use the system in

    15

  • 8/10/2019 Full Thesis.pdf

    16/109

    order to grab some useful im(ortant information to them. This grabbedinformation for e?am(le can be 'ie/ing or (rinting student transcri(t='ie/ing accumulated PA= and 'ie/ing currently stored courses on thedatabase in case of that graduate needs to ma3e (ost-graduate studies.

    0- he %"min mo"ule: 2t is the user that has the highest (ri'ilegeon the system. The admin user is the user that ta3es and confirmsim(ortant decisions= such as confirming registration re>uests made bythe users registering the system etc.

    1.0- Products $sed in the Project:

    1.0.1 *racle data ser'er:

    *racle database is an object-relational database managementsystem )*!D MS, (roduced and mar3eted by *racle "or(oration.*racle database is a collection of data treated as a unit. The (ur(ose ofa database is to store and retrie'e related information. A databaseser'er is the 3ey for sol'ing the (roblems of information management. 2ngeneral= a ser'er reliably manages a large amount of data in a multi-useren'ironment so that many users can concurrently access the same data.

    All this is accom(lished /hile deli'ering high (erformance. A databaseser'er also (re'ents unauthori;ed access and (ro'ides efficientsolutions for failure reco'ery. *racle Database is the first databasedesigned for enter(rise grid com(uting= the most fle?ible and costeffecti'e /ay to manage information and a((lications. #nter(rise gridcom(uting creates large (ools of industry-standard= modular storage andser'ers. @ith this architecture= each ne/ system can be ra(idly(ro'isioned from the (ool of com(onents. There is no need for (ea3/or3loads= because ca(acity can be easily added or reallocated from theresource (ools as needed. The database has logical structures and(hysical structures. ecause the (hysical and logical structures arese(arate= the (hysical storage of data can be managed /ithout affectingthe access to logical storage structures.

    1.0. 8a'a Database "onnecti'ity:

    "ommonly referred to as 8D "= is an a((lication (rogramminginterfaces language that defines ho/ a client may access a database. 2t(ro'ides methods for >uerying and u(dating data in a database. 8D " isoriented to/ards relational databases. A 8D "-to-*D " bridge enablesconnections to any *D "-accessible data source in the 8 M host.#n'ironment.8D " hel(s you to /rite ja'a a((lications that managethese three (rogramming acti'ities:

    16

  • 8/10/2019 Full Thesis.pdf

    17/109

    "onnect to a data source= li3e a database. Send >ueries and u(date statements to the database. !etrie'e and (rocess the results recei'ed from the database in ans/er to

    your >uery.

    1& 'istory an" im(lementation: Sun Microsystems released 8D "as (art of 8DF 1.1 on 7ebruary 16= 1669. 2t has since formed (art of the8a'a Standard #dition.The 8D " classes are contained in the 8a'a(ac3age ja'a.s>l and ja'a?.s>l starting /ith 'ersion .+= 8D " has beende'elo(ed under the 8a'a "ommunity Process.

    2& Functionality: 8D " allo/s multi(le im(lementations to e?istand be used by the same a((lication. The AP2 (ro'ides a mechanism fordynamically loading the correct 8a'a (ac3ages and registering them /iththe 8D " Dri'er Manager. The Dri'er Manager is used as a connection

    factory for creating 8D " connections. 8D " connections su((ortcreating and e?ecuting statements. These may be u(date statementssuch as S%&Gs "!#AT#= 2BS#!T= $PDAT# and D#T#= or they maybe >uery statements such as S#"T. Additionally= stored (roceduresmay be in'o3ed through a 8D " connection. 8D " re(resentsstatements using one of the follo/ing classes:

    Statement the statement is sent to the database ser'er each and e'erytime.

    Pre(aredStatement the statement is cached and then the e?ecution (athis (re-determined on the database ser'er allo/ing it to be e?ecuted

    multi(le times in an efficient manner. "allableStatement used for e?ecuting stored (rocedures on thedatabase. $(date statements such as 2BS#!T= $PDAT# and D#T#return an u(date count that indicates ho/ many ro/s /ere affected in thedatabase. These statements do not return any other information.%uerystatements return a 8D " ro/ result set. The ro/ result set is used to/al3 o'er the result set. 2ndi'idual columns in a ro/ are retrie'ed either byname or by column number. There may be any number of ro/s in theresult set. The ro/ result set has metadata that describes the names ofthe columns and their ty(es. There is an e?tension to the basic 8D " AP2in the ja'a?.s>l. 8D " connections are often managed 'ia a connection

    (ool rather than obtained directly from the dri'er.1.0. Bet eans:

    !efers to both a (latform frame/or3 for 8a'a des3to(a((lications= and an integrated de'elo(ment en'ironment )2D#, forde'elo(ing /ith 8a'a= 8a'aScri(t= PHP= Python= !uby= roo'y= "= "II=Scala= "lojure= and others. The Bet eans 2D# is /ritten in 8a'a and can

    17

    http://download.oracle.com/javase/1.4.2/docs/api/java/sql/Statement.htmlhttp://download.oracle.com/javase/1.4.2/docs/api/java/sql/Statement.htmlhttp://download.oracle.com/javase/6/docs/api/java/sql/PreparedStatement.htmlhttp://download.oracle.com/javase/6/docs/api/java/sql/CallableStatement.htmlhttp://download.oracle.com/javase/1.4.2/docs/api/java/sql/Statement.htmlhttp://download.oracle.com/javase/6/docs/api/java/sql/PreparedStatement.htmlhttp://download.oracle.com/javase/6/docs/api/java/sql/CallableStatement.html
  • 8/10/2019 Full Thesis.pdf

    18/109

    run any/here a 8 M is installed= including @indo/s= Mac *S= &inu?=and Solaris. A 8DF is re>uired for 8a'a de'elo(ment functionality= but isnot re>uired for de'elo(ment in other (rogramming languages. TheBet eans (latform allo/s a((lications to be de'elo(ed from a set ofmodular soft/are com(onents called mo"ules . A((lications based on

    the Bet eans (latform )including the Bet eans 2D#, can be e?tended bythird (arty de'elo(ers. The Bet eans Platform is a reusable frame/or3for sim(lifying the de'elo(ment of 8a'a S/ing des3to( a((lications. TheBet eans 2D# bundle for 8a'a S# contains /hat is needed to startde'elo(ing. Bet eans (lug-in and Bet eans Platform baseda((licationsJ no additional SDF is re>uired. A((lications can installmodules dynamically. Any a((lication can include the $(date "entermodule to allo/ users of the a((lication to do/nload digitally-signedu(grades and ne/ features directly into the running a((lication.!einstalling an u(grade or a ne/ release does not force users todo/nload the entire a((lication again.

    18

  • 8/10/2019 Full Thesis.pdf

    19/109

    Chapter 2Amro Salem Contribution

    .1- Designing 2m(lementation:

    The im(lementation /as designed to ma3e use of the featuresand the technologies of the a'ailable (roducts. eside using the featuresand the technologies of the a'ailable (roducts= common (rogrammingtechni>ues /as utili;ed to enca(sulate the data layer and ma3e use ofthe u((er layers in such a /ay that those layers is not directlymani(ulating the database. This /as done by utili;ing the sessioncoordinate in the system. The session (ac3age containing the systemoffers a lot of features that /ould ma3e the system more usable.$sability of the system /as the main factor considered /hen designingthe data mani(ulation scheme. The session (ac3age contains t/oclasses. Those classes are D ManAP2 and Session. The Session classcarries the HashMa( that holds each S%& >uery as a 3ey and the resultof this S%& >uery as a !esultSet 'alue. Also it offers basic mani(ulationser'ices such as retrie'ing data and u(dating data in the HashMa(. 2nother /ords the /ay data is retrie'ed is hidden from the u((er layersusing the session class= so /hene'er a >uery is made= the user do not3no/ /hether it is retrie'ed directly from the database or from the historycontained in the HashMa(.:

    pac3age session;

    import com.sun.ro#set.Cached0o#Set mpl;import 4ava.sql.Connection;import 4ava.sql.0esultSet;import 4ava.sql.S56E1ception;import 4ava.sql.Statement;import 4ava.util.7ash8ap;import 4ava.util.8ap.Entr+;import 4ava1.sql.0o#Set;import 4ava1.s#ing.9 ptionPane;

    public class Session implements 0unnable{

    public 7ash8ap: String$ 0o#Set hash; Connection connect;

    public Session( Connection connect) { this.connect " connect; hash " ne# 7ash8ap:String$ 0o#Set ();

    19

  • 8/10/2019 Full Thesis.pdf

    20/109

    2

    public 0o#Set addEntr+( String sql$ 0o#Setresult)

    {

    return hash.put( sql$ result ); 2

    public 0o#Set get peration( String element ) { return hash.get( element ); 2

    public void update ccured() { tr+ { for( Entr+: String$ 0o#Set ent '

    hash.entr+Set() ) { Statement statement "

    connect.createStatement( 0esultSet./0=0EA%= 6< );

    Cached0o#Set mpl result " ne#Cached0o#Set mpl();

    result.populate(statement.e1ecute5uer+( ent.get?e+() ));

    ent.set alue( result ); hash.put(ent.get?e+()$

    ent.get alue()); 2 2

    catch( S56E1ception e1 ) { 9 ptionPane.sho#8essage%ialog( null

    $ !Error curred @hile >pdating Session %ata !$ !%ataBase Error!$ 9 ptionPane.E00 0=8ESSA E);

    2

    2 public boolean 3e+E1ists( String sql )

    { return hash.contains?e+( sql ); 2

    public void run()

    20

  • 8/10/2019 Full Thesis.pdf

    21/109

    { update ccured(); 22

    This class offers a user multi(le functions= the most im(ortantfunction is:

    1- The user can access the data retrie'ed before= during thesession e'en if the connection is terminated )offline,.

    - 2t decreases the time re>uired to fetch data from the *racledatabase ser'er= because no e'ery time data is re>uired it is fetchedfrom database. 2n other /ords= if this data is being fetched for the firsttime it /ill be brought from the database then (laced in HashMa( then

    'ie/ed to the user. *n the other hand= if this data /as fetched before= sothe result of the >uery is fetched from the HashMa( sa'ing the time of>uerying the database o'er the cloud.

    The D ManAP2 class offers common mani(ulation tas3s built onthe session class. Those o(erations are e?ecuting a select statementagainst the database and e?ecuting a DM&

  • 8/10/2019 Full Thesis.pdf

    22/109

    { tr+

    {if( session.3e+E1ists(sql))

    {

    if( session.get peration( sql )" null ) { return session.get peration(

    sql ); 2 else { Statement statement "

    connect.createStatement( 0esultSet./0=0EA%= 6< );

    Cached0o#Set mpl res " ne#Cached0o#Set mpl();

    res.populate( statement.e1ecute5uer+( sql ) );

    statement.close(); S+stem.gc(); return

    session.addEntr+( sql$ res ); 2

    2 else { Statement statement "

    connect.createStatement( 0esultSet./0=0EA%= 6< );

    Cached0o#Set mpl res " ne#Cached0o#Set mpl();

    res.populate( statement.e1ecute5uer+( sql ) );

    statement.close(); S+stem.gc(); session.addEntr+(sql$ res); return session.addEntr+(sql$

    res); 2

    2 catch(S56E1ception e1) { 9 ptionPane.sho#8essage%ialog( null$

    e1$ !E00 0!$ 9 ptionPane.E00 0=8ESSA E);

    22

  • 8/10/2019 Full Thesis.pdf

    23/109

    e1.printStac3/race(); return null; 2

    2

    public int e1ecute%86( String sql ) thro#sS56E1ception

    { Statement statement " statement "

    connect.createStatement( 0esultSet./0=0EA%= 6< );

    int result "statement.e1ecute>pdate(sql);

    statement.close(); S+stem.gc(); return result; 2

    public void fire>pdate() { /hread th " ne# /hread(session); th.start(); 2 public Connection getConnection(){ return connect; 2 2

    *ne im(ortant feature of this class is that it ma3es use of thethreading AP2 of the 8a'a to u(date the result contained in the HashMa(in the bac3ground /ithout (ausing the e?ecution of the (rogram. Thiscould be noticed in fire$(date), method /hich creates a ne/ instance ofThread class to achie'e 'irtually (arallel (rocessing.

    23

  • 8/10/2019 Full Thesis.pdf

    24/109

    . - 2dentifying the $sers of the System and "reating the"orres(onding !oles:

    A system of a uni'ersity normally has more than one ty(e ofusers. @hen the target users of the system /ere determined a se(arate

    3ind of logical category of (ri'ileges /as created. Bormally in *racledatabase this logical category of (ri'ileges is grou(ed into schema objectcalled K!oleC. The roles that /ere created for the database system areStudent= Professor= Administrator= "ontrol and raduate. Those roles/ere ma((ed also in the $2 and the Handling layer of the system. As ane?am(le of creating a role is:

    C0EA/E 0 6E student;0A / C0EA/E SESS / student;0A / SE6EC/ courses / student;0A / SE6EC/ e1ams / student;

    0A / >P%A/E student=courses( status ) /student;....

    The (re'ious code is a sni((et of the code of creating a role.#ach user that is granted access to the system is assigned a ne/account /ith a uni>ue username and (ass/ord. @hene'er a ne/account is created *racle database assigns a ne/ schema= this schema

    can hold any 3ind of objects= /hether a tables= 'ie/s= se>uence= or inde?.The tables com(osing the system are all contained in oneschema this schema is called de'elo(er. The de'elo(er schema has itso/n username and (ass/ord /hich is KD# C and KD# C res(ecti'ely.

    Access to this schema is (lanned to be granted only to the databaseadministrator of the system.

    After logically grou(ing the data that /ill be sa'ed in thedatabase= the #! model /as created. The #! model re(resents:

    1- Ho/ data /ould be stored.- @hat data /ould be stored.

    - @hat are the logical relationshi(s bet/een the tables.- @hat 'ie/s /ould be created on these tables.0- @hat users /ill be accessing /hich information.5- @hich columns /ill be the (rimary 3eys of the tables.

    24

  • 8/10/2019 Full Thesis.pdf

    25/109

    25

  • 8/10/2019 Full Thesis.pdf

    26/109

    . - Some 7unctions of the Student Module:

    The Student module contains the $2 and the Handling code thatmodels the ty(ical o(erations that /ould be initiated by a student usingthe system. These o(erations reflect the (ri'ileges granted for the

    student and hide the o(erations that are not allo/ed for a student. 7ore?am(le the user that logged in as a student cannot remo'e anotherstudent from the database. Some of those functions are mentioned inthe follo/ing sub-sections.

    . .1- !e'ie/ing the attendance in a gi'en course:

    26

  • 8/10/2019 Full Thesis.pdf

    27/109

    . . - Fee(ing trac3 of the courses of the user student:

    27

  • 8/10/2019 Full Thesis.pdf

    28/109

    28

  • 8/10/2019 Full Thesis.pdf

    29/109

    . - 2m(ortant 7eatures of Student Module:

    The features of the student module a((ear in ho/ ser'ices reflectthe o(erations that /ould be re>uested by a ty(ical student. Thecoordinates of these features are:

    1- S%& code that could be translated by the database.- 8a'a code that offers a ma((ing bet/een the 8a'a 'ariables

    and the 'alues of the columns. 7or e?am(le= the student needs tosearch the courses of his de(artment according to a certain criteria= inorder to enroll in one of these courses. These criteria can be searchingthe courses by number of credit hours= course name= a s(ecific(rere>uisite course= a s(ecific number of (rere>uisites to that course orsearching by the status of the course )K"urrently #nrolledC= KPassedC=KBe'er #nrolledC= KTried eforeC,. :

    pac3age Services;import 4ava.sql.0esultSet;import session.%B8anAP ;

    public class StudentSearchCourses{ %B8anAP manipulate; String course %; String course ame; String prof %; int num fCredits; int num fPre; String status*; String status,; String quer+;

    public StudentSearchCourses( %B8anAPmanipulate )

    { this.manipulate " manipulate; 2

    public StudentSearchCourses( %B8anAPmanipulate$ String course %$ String course ame$ Stringprof %$ int num fCredits$ int num fPre$ Stringstatus*$ String status,)

    { this.manipulate " manipulate; this.course % " course %; this.course ame " course ame;

    29

  • 8/10/2019 Full Thesis.pdf

    30/109

    this.prof % " prof %; this.num fCredits " num fCredits; this.num fPre " num fPre; this.status* " status*; this.status, " status,;

    quer+ " String.format( !selectc.course=id D!Course %D!$ c.course=name D!CourseameD!$ !

    !c.ma1=score D!Full 8ar3D!$ to=char( c.pass=pct ) GG HIIH D!Pass PercentageD!$ !

    !c.credit=hours D! umber of 7oursD!$nvl,( c.prequisit*=id$ p*.course=name$ HH) D!Prequisit*D!$ !

    !nvl,( c.prequisit,=id$ p,.course=name$HH) D!Prequisit ,D!$ !

    !nvl,( c.prequisitJ=id$ pJ.course=name$HH) D!Prequisit JD!$ !

    !nvl,( c.prequisitK=id$ pK.course=name$HH) D!Prequisit KD!$ !

    !sc.status D!0SE= %) !

    !left outer 4oincourses pJ !

    !on

    ( c.P0E5> S /J= % " pJ.C >0SE= %) ! !left outer 4oincourses pK !

    !on( c.P0E5> S /K= % " pK.C >0SE= %) !

    !left outer 4oin(select course=id$ !

    30

  • 8/10/2019 Full Thesis.pdf

    31/109

    !status$ score$num=of=enteries !

    !fromstudent=courses !

    !#here

    upper( student=id )" HISH ) sc ! !on( c.C >0SE= %" sc.C >0SE= % ) !

    ! !$eneralServices.getCurrentStudent %( manipulate ));

    setCourse %(); setCourse ame(); setCredits(); set umPre(); setStatus(); 2

    public final void setCourse %() { if( course % "" null) return; else quer+ " String.format(! 0

    upper( c.course=id ) li3e HIIISIIH!$ course %); 2

    public final void setCourse ame() { if( course ame "" null ) return; else quer+ " String.format(! 0

    upper( c.course=name ) li3e HIIISIIH!$ course ame); 2

    public final void setCredits() { if( num fCredits "" -*) return;

    else quer+ " String.format(! 0c.credit=hours " Id!$ num fCredits);

    2

    public final void set umPre() { if( num fPre "" -*)

    31

  • 8/10/2019 Full Thesis.pdf

    32/109

    return; else quer+ " String.format(! 0 (L ! !nvl,( c.prequisit*=id$ *$

    L )!

    ! nvl,( c.prequisit,=id$*$ L )! ! nvl,( c.prequisitJ=id$

    *$ L )! ! nvl,( c.prequisitK=id$

    *$ L ) ) " Id!$ num fPre); 2

    public final void setStatus() { if( status* "" null MM status, "" null) return; if( status* "" null MM status, " null) quer+ " String.format( !or

    upper( sc.status ) " HISH!$ status,); if( status, "" null MM status* " null) quer+ " String.format( !or

    upper( sc.status ) " HISH!$ status*); if( status, "" null MM status* " null ) quer+ " String.format( !or

    upper( sc.status ) in ( HISH$ HISH )!$ status*$status,);

    2

    public 0esultSet get0esult() { return manipulate.e1ecuteSelect(quer+); 22

    32

  • 8/10/2019 Full Thesis.pdf

    33/109

    .0- Some 7unctions of the Admin Module:

    The admin module contains the $2 and handling code thatmodels the ty(ical o(erations that /ould be initiated by an admin usingthe system. These o(erations reflect the (ri'ileges granted for the

    admin. 7or e?am(le the user that logged in as an admin can remo'e auser from the database. Some of those functions are mentioned in thefollo/ing sub-sections.

    .0.1- "onfirming !egistration !e>uests:

    33

  • 8/10/2019 Full Thesis.pdf

    34/109

    34

  • 8/10/2019 Full Thesis.pdf

    35/109

    .0. - ie/inguests:

    35

  • 8/10/2019 Full Thesis.pdf

    36/109

    .0. - ie/ing Already Handled !e>uest:

    36

  • 8/10/2019 Full Thesis.pdf

    37/109

    Chapter 3Ram Saad Contribution

    .1- Some 7unctions of the Professor Module:

    The Professor module contains the $2 and handling code thatmodels the ty(ical o(erations that /ould be initiated by a (rofessor usingthe system. These o(erations reflect the (ri'ileges granted for the(rofessor and hide the o(erations that are not allo/ed for a (rofessor.7or e?am(le the user that logged in as a (rofessor cannot remo'e astudent from the database or submit scores for a course that he is notteaching. Some of those functions are mentioned in the follo/ing sub-sections.

    .1.1- A((lying for Teaching a "ourse:

    37

  • 8/10/2019 Full Thesis.pdf

    38/109

    .1. - !e'ie/ing the attendance of students:

    38

  • 8/10/2019 Full Thesis.pdf

    39/109

    .1. - ie/ing &ectures Schedule:

    39

  • 8/10/2019 Full Thesis.pdf

    40/109

    .1. - enerating Some Statistics for a "ourse:

    40

  • 8/10/2019 Full Thesis.pdf

    41/109

    .1. - ie/ing #?am Schedule:

    41

  • 8/10/2019 Full Thesis.pdf

    42/109

  • 8/10/2019 Full Thesis.pdf

    43/109

    String username; String pass#ord; %B8anAP manipulate; String emplo+ee %;

    public e#Emplo+ee( %B8anAP manipulate$String username$ String pass#ord)

    { this.username " username; this.pass#ord " pass#ord; this.manipulate " manipulate; 2

    public e#Emplo+ee(%B8anAP manipulate$String username$ String pass#ord$ String emplo+ee %)

    { this( manipulate$ username$ pass#ord); this.emplo+ee % " emplo+ee %;

    2

    public void create>ser() thro#s S56E1ception { tr+

    { manipulate.e1ecute%86(String.format(

    !create user Is identified b+ Is!$ username$pass#ord));

    manipulate.e1ecute%86(String.format(!grant professor to Is!$ username));

    2

    catch( S56E1ception e1) { thro# e1; 2 2

    public void remove>ser() thro#s S56E1ception { tr+ { manipulate.e1ecute%86( String.format

    (!delete from dev.registration=requests #hereupper(username) " upper(HIsH)!$ username));

    2

    43

  • 8/10/2019 Full Thesis.pdf

    44/109

    catch( S56E1ception e1)

    { thro# e1; 2

    2

    public void add7istor+() thro#s S56E1ception { tr+ { manipulate.e1ecute%86( String.format

    (!insert into dev.request=archive( requesting=user$request=time$ handeled=b+$ handling=time)( selectHIsH$ request=time$ user$ s+sdate fromdev.registration=requests #hereupper(username)"upper(HIsH))!$ username$ username));

    2 catch( S56E1ception e1) { thro# e1; 2 2 public void addEmplo+ee/o/able() thro#s

    S56E1ception { tr+ {

    manipulate.e1ecute%86( String.format( !insert into dev.emplo+ees ( first=name$middle=name$ !

    !last=name$ nationalit+$email$ mobile=no$ !

    !telephone=no$ username$street$ cit+!

    !$ state$ countr+$date=of=birth$ place=of=birth$ !

    ! emplo+ee=id$ image)( select first=name$ middle=name$ ! !last=name$ nationalit+$

    email$ mobile=no$ ! !telephone=no$ username$

    addr=street$ addr=cit+! !$ addr=state$

    addr=countr+$ birth=date$ !

    44

  • 8/10/2019 Full Thesis.pdf

    45/109

    !birth=place=countr+$to=number(HIsH )$ to=number(HIsH)$ image fromdev.registration=requests !

    !#here upper( username ) "HISH )!$ this.emplo+ee %$ username) );

    9 ptionPane.sho#8essage%ialog(null$!/he Emplo+ee @as Successfull+ Added to /he S+stem !$!C F 08A/ !$ 9 ptionPane. F 08A/ =8ESSA E);

    2

    catch( S56E1ception e1) { thro# e1; 2 2

    void setEmplo+ee %(String id){

    emplo+ee % " id; 2

    public String getEmail() { tr+ { 0esultSet email "

    manipulate.e1ecuteSelect(String.format(!select emailfrom dev.emplo+ees #here username " HIsH!$username));

    email.first(); return email.getString(*); 2 catch( S56E1ception e1 ) { return

    9 ptionPane.sho# nput%ialog(!Please Enter the Emailof /his Emplo+ee'!);

    2

    2 public String get>sername() { return username; 2

    public String getPass#ord() {

    45

  • 8/10/2019 Full Thesis.pdf

    46/109

    return pass#ord; 22

    . .1- Feature createUser)*:

    This feature creates a ne/ login credentials for the (rofessor using theusername and the (ass/ord already re>uired by the user before. This isdone by using the create user *racle S%& command. The ma((ingbet/een a 8a'a string 'ariable and a S%& literal is done by aString.format), static function.

    . . - Feature a""+m(loyee o a,le)*:

    This feature creates a ne/ ro/ for the (rofessor in the em(loyees tableusing the insert command. The insert command used in this feature is

    not a normal insert command= it uses a sub>uery to co(y the user datafrom the registration table directly to the em(loyees table. 7inally afterthe (rofessor is (erfectly added to the em(loyees in the system= aconfirmation message /ill a((ear to the user using the follo/ing codesni((et:JOptionPane.showMessageDialog(null, "The Employee WasSuccessfully !!e! to The System ", "#O$%&'M T&O$",JOptionPane.&$%O'M T&O$ MESS )E*+

    . . - Another e?am(le of the features is 2nitiali;eProf2nfo class in(ac3age Ser'ices:This class is used to retrie'e all the basic information about (rofessorfrom the database /hene'er the (rofessor login the system= and 3ee(sthis information in the session.

    pac3age Services;

    import 4ava.sql.0esultSet;import session.%B8anAP ;

    public class nitialiNeProf nfo {

    String first ame " !!; String middle ame " !!; String last ame " !!; %B8anAP manipulate;

    public nitialiNeProf nfo(%B8anAP manipulate$String first ame$ String middle ame$ String last ame){ this.first ame " first ame;

    46

  • 8/10/2019 Full Thesis.pdf

    47/109

    this.middle ame " middle ame; this.last ame " last ame; this.manipulate " manipulate; 2

    public nitialiNeProf nfo(%B8anAP manipulate) { this.manipulate " manipulate; 2

    public 0esultSet getAll nfo() { if (first ame.equals(!!) GGmiddle ame.equals(!!) GG last ame.equals(!!)) { return manipulate.e1ecuteSelect(!select Ofrom dev.emplo+ees #here username " user!); 2 else { returnmanipulate.e1ecuteSelect(String.format(!select O fromdev.emplo+ees #here first=name " HIsH and middle=name" HIsH and last=name " HIsH!$ first ame$ middle ame$last ame)); 2 2

    public 0esultSet get%a+() { if (first ame.equals(!!) GGmiddle ame.equals(!!) GG last ame.equals(!!)) { return manipulate.e1ecuteSelect(!selectto=number(to=char(date=of=birth$ H%%H)) from ( selectO from dev.emplo+ees #here username " user)!); 2 else { returnmanipulate.e1ecuteSelect(String.format(!selectto=number(to=char(date=of=birth$ H%%H)) from ( Is )!$String.format(!select O from dev.emplo+ees #herefirst=name " HIsH and middle=name " HIsH andlast=name " HIsH!$ first ame$ middle ame$last ame))); 2 2

    public 0esultSet get8onth() { if (first ame.equals(!!) GGmiddle ame.equals(!!) GG last ame.equals(!!)) { return manipulate.e1ecuteSelect(!selectto=number(to=char(date=of=birth$ H88H)) from ( selectO from dev.emplo+ees #here username " user)!); 2 else {

    47

  • 8/10/2019 Full Thesis.pdf

    48/109

    returnmanipulate.e1ecuteSelect(String.format(!selectto=number(to=char(date=of=birth$ H88H)) from ( Is)!$String.format(!select O from dev.emplo+ees #herefirst=name " HIsH and middle=name " HIsH and

    last=name " HIsH!$ first ame$ middle ame$last ame))); 2

    2

    public 0esultSet get

  • 8/10/2019 Full Thesis.pdf

    49/109

    . - 2m(ortant 7eatures of the Admin Module:

    Admin moduleCs features are the 8a'a code that offers ser'icesthat ma(s the different (rocesses re>uested by the admin into databaseo(erations. 7or e?am(le= in order for the student to be enrolled in a

    course= an administrator must confirm this re>uest. This o(eration ishandled by a ser'ices class called !e>uests2nsertion in Ser'ices(ac3age. :

    pac3age Services;

    import 4ava.sql.0esultSet;import 4ava.sql.S56E1ception;import session.%B8anAP ;

    public class CourseConfirmation

    { %B8anAP manipulate; String username; String course %; String course ame;

    public CourseConfirmation( %B8anAPmanipulate$ String username$ String course % )

    { this.manipulate " manipulate; this.username " username; this.course % " course %; this.course ame " course ame();

    2

    public void changingStatus() { tr+ { manipulate.e1ecute%86(String.format

    ( !update student=courses set status " Hcurrentl+! !

    enrolledH$ num=of=enteries " num=of=enteries *#here student=id" ( select !

    ! s.student=idfrom dev.students s #here upper(s.username) " HISH )and !

    !upper( course=id ) " HISH !$ username$ course % ));

    2

    49

  • 8/10/2019 Full Thesis.pdf

    50/109

    catch( S56E1ception e1 )

    { e1.printStac3/race(); 2

    2 public void adding7istor+()

    { tr+ { manipulate.e1ecute%86( String.format

    (!insert into dev.request=archive( requesting=user$request=time$ handeled=b+$ handling=time)( selectHIsH$ request=date$ user$ s+sdate fromdev.course=requests #hereupper(username)"upper(HIsH))!$ username$ username));

    manipulate.e1ecute%86( String.format(!delete from dev.course=requests #hereupper(username) " upper(HIsH)!$ username));

    2 catch( S56E1ception e1 ) { e1.printStac3/race(); 2 2

    public String course ame() { 0esultSet course ame "

    manipulate.e1ecuteSelect(String.format( !selectcourse=name from dev.courses!

    ! #here upper( course=id ) "IS!$ course % ));

    tr+ { course ame.first(); return

    course ame.getString( * );

    2 catch( S56E1ception e1 ) { e1.printStac3/race(); return !!; 2 2

    50

  • 8/10/2019 Full Thesis.pdf

    51/109

  • 8/10/2019 Full Thesis.pdf

    52/109

    . - The 8a'a Mail 1. . AP2:

    8a'aMail 1. . release contains se'eral bug fi?es andenhancements= including:

    - Ability to cache P*P messages on dis3.

    - 2n-memory P*P message cache no/ uses soft references.- BT&M authentication su((ort is no/ integrated. SAS&

    authentication su((ort for SMTP.- Be/ demo classes sho/ing ho/ to handle old non-M2M#

    *utloo3 messages. Bote: $nless youGre using 8a'a S# 5= you /ill alsoneed the 8a'a eans Acti'ation 7rame/or3 )8A7, e?tension that(ro'ides the ja'a?.acti'ation (ac3age. @e suggest you use 'ersion 1.1.1of 8A7= the latest release. 8A7 is included /ith 8a'a S# 5.

    The 8a'aMail AP2 su((orts 8DF 1. or higher.

    Protocols su((orted:

    This release su((orts the follo/ing 2nternet standard mail(rotocols:

    2MAP - a message Store (rotocol= for reading messages from aser'er.

    P*P - a message Store (rotocol= for reading messages froma ser'er.

    SMTP - a message Trans(ort (rotocol= for sending messagesto a ser'er.

    The follo/ing table lists the names of the su((orted (rotocols )as

    used in the 8a'aMail AP2, and their ca(abilities:

    52

  • 8/10/2019 Full Thesis.pdf

    53/109

    See our /eb (age athtt(:uired and o(tionalcommand-line o(tions to successfully run any demo. 7or e?am(le: 4avamsgsho# - lists the a'ailable o(tions. And 4ava msgsho# -/ imap-7 :mailserver -> :username -P :pass#d -f B Quses the 2MAP (rotocol to dis(lay message number 0 from your 2B *O.

    )Additional instructions on ho/ to run the sim(le mail readerdemo and ser'let demo are (ro'ided in demo53

    http://www.oracle.com/technetwork/java/javamail/http://www.oracle.com/technetwork/java/javamail/
  • 8/10/2019 Full Thesis.pdf

    54/109

    Chapter!"an Abd(#lSamad Contribution

    .1- "reating Tables:

    54

  • 8/10/2019 Full Thesis.pdf

    55/109

    The #! model /as studied (erfectly and the (lan of the #! model/as created. *racle S%& synta? /as studied also some features of*racle 1+ /as com(rehended. 2m(lementing the #! model re>uires toim(licitly embed a di'erse categories of statements in the tables creationscri(ts. 2n order to achie'e a truly reflecting im(lementation of the #!

    model= 2 had to 3ee( trac3 of the 'ariation of se'eral 'ariables includingty(es of the columns= (recision and scale of the columns= and finally thety(es of constraints that (erfectly fit the 'isuali;ation of the #! model.

    About 15 creation scri(ts /ere re>uired to com(letely satisfy thes(ecification com(rehended from the #! model. Through this 15 scri(ts2 changed se'eral (arameters to fit the im(lementation of each tableinde(endently from the others. *ne of these scri(ts is as follo/ing:

    C0EA/E /AB6E !%E !.!E8P6 0SE=E PE0/ SEQ! A0C7A0,(,Q B %! A0C7A0,(*LL B

  • 8/10/2019 Full Thesis.pdf

    56/109

    6 B (! 8A E!) S/ 0E AS BAS CF 6E ( /AB6ESPACE !>SE0S! E AB6E S/ 0A E 0 @ C7> ?

    T*U,S/ 0A E( / A6 QQJ E / *LKTQR 8 E /E /S

    * 8A E /E /S ,*KRKTJ KQ

    PC/ C0EASE L F0EE6 S/S * F0EE6 S/ 0 >PS *B>FFE0=P 6 %EFA>6/)) E AB6E 0 @ 8 E8E / ;

    The (re'ious scri(t creates a table that models a em(loyee)(rofessor or tutor, user. 2t contains all the attributes needed to model areal (rofessor into a tu(le in the database. The most im(ortant ser'ices 2ha'e used in this creation scri(ts are listed in the follo/ing (oints:

    .1.1- The "!#AT# TA statement:

    The create table statement creates a table by s(ecifying thecolumns and the data ty(es of these columns and (ossible default'alues for these columns in a comma se(arated list after the table name.2t also can s(ecify some features about the table that could ma3e theadministratorCs job easier after the comma se(arated list.

    .1. - The &* data ty(e:

    This data ty(e is offered by the *racle 1+ database to hold abinary file. *racle 1+ offers t/o data ty(es that could re(resent binaryfiles they are:

    1- 72:2t holds a (ointer to a file located locally on the file system of the

    o(erating system running the database. 2n other /ords= 72s does nothold a file itself but it holds a (ointer to the file located on the o(eratingsystem. Mani(ulating this data ty(e o'er the cloud re>uires the use of an7TP ser'er since in order to transfer the file bet/een the ser'er and theclient the file /ould be first co(ied from the local o(erating system of theser'er and sent o'er the cloud to the client.

    - inary &arge *bject ) &* ,:2t holds a binary file rather than just a (ointer to the file. This data

    ty(e can be >ueried easily o'er the cloud /ithout using 7TP ser'er=since the file does not need to be co(ied from any file system firstly.

    So the &* s are used to hold the images or a'atars of the(rofessors. This hel(ed in mani(ulating those images into in(ut streamsof the 2

  • 8/10/2019 Full Thesis.pdf

    57/109

    . - #nable !o/ Mo'ement:

    Three flashbac3 techni>ues are based on the use of undosegments. The first flashbac3 ca(ability /as initially introduced /ithrelease 6 i of the database and has been substantially enhanced

    subse>uently. 7lashbac3 %uery )the release 6 i feature, lets you >uerythe database as it /as at some time in the (ast= either for one selectstatement or by ta3ing your session tem(orarily bac3 in time so that allits >ueries /ill be against a (re'ious 'ersion of the database. This canbe used to see the state of the data before a set of transactions /ascommitted. @hat did the tables loo3 li3e half an hour ago This can bein'aluable in trac3ing do/n the cause of business data corru(tions= andcan also be used to correct some mista3es: by com(aring the currentand (re'ious 'ersions of a table= you can identify /hat /as done that/as /rong. 2t is e'en (ossible to select all 'ersions of a ro/ o'er a(eriod of time= to sho/ a history of /hat has ha((ened to the ro/= /hen

    it ha((ened= /ho did it= and the identifiers of the transactions that madeeach change. The third flashbac3 techni>ue based on undo data is7lashbac3 Table. Ha'ing determined that ina((ro(riate /or3 has beencommitted against one table= you can instruct *racle to re'erse allchanges made to that table since a (articular (oint in time= /hile lea'ingall other tables current. 1 The Q#nable !o/ Mo'ementR statementscontained in the creation of the table enables us to ma3e use of theflashbac3 (ro(erties offered by *racle 11 database.

    1. Oracle Database Administration 11G Guide.

    57

  • 8/10/2019 Full Thesis.pdf

    58/109

    Chapter$Ahmed A%ad Contribution

    Control Role

    -The 7unctions:

    a, The $2 Descri(tion of the control 7unctions:

    1-The main 7rame:

    This is the main /indo/ that is o(ened after the authentication is done andafter that the (ass/ord of the user is 3no/n to be 'erified to be belonged to thecontrol de(artment.This /indo/ is com(osed of three buttons on the to( and a button in the do/n ofthe /indo/ three buttons that im(lement the three functions that is needed fromthe control de(artment this buttons are:

    Add !esult button#dit !esult button

    Print !esult buttona, Add !esult button:This button is used to the result of a student to the database of the system.b, #dit !esult button:This button is used to change the result of student in the system database.c, Print !esult button:This button is used to (rint the scri(t of a student or of a subject.

    58

  • 8/10/2019 Full Thesis.pdf

    59/109

    D, ac3 button:The bac3 button is used to return to the authentication /indo/.

    2f the add button is (ushed the follo/ing frame is o(ened /hich is:

    -Add !esult 7rame:

    The add !esult 7rame contain four combo bo?es /hich are:

    A, Student Bame "ombo o?:This combo bo? is used to clarify the names of the students /ho are registered ina certain course from this combo bo? /e choose the name of the student /ho hisresult /ill be edited this bo? is acti'ated automatically after the choice of both the

    course name combo bo? and the e?am date and ty(e combo bo?.

    , "ourse Bame "ombo o?:This combo bo? is used to select the name of the subject that /ill edit the resultof its e?am for the student name that e?ists in the combo bo?.

    ", #?am Date and Ty(e:This button is acti'ated /hen selecting the course name automatically to ma3ethe user select from the dates of the e?ams of this course and the ty(e of thee?am.

    There are 0 Te?t 7ields that are e?isted in the Add !esult 7rame /hich are:

    A, #?am Score 7ield:This field is used to ta3e the e?am score entered for that student in that subject.

    , Mid Term Score 7ield:This field is used to ta3e the mid term score of the s(ecific student in that e?am.

    59

  • 8/10/2019 Full Thesis.pdf

    60/109

    ", Attendance 7ield:This field is used to ta3e the attendance (ercentage of the student in that course.

    D, Acti'ity Score 7ield:This 7ield is used to ta3e the acti'ity score of the student in this subject.

    #, Total Score 7ield:This 7ield is used to (rint the summation of the total of this scores.There are t/o buttons in the Add !esult 7rame /hich are:

    A, *F button: This button /hen it is (ushed it dum(s all the data gi'en this 7ields into thedatabase and (rints the total score in the total score field.

    , ac3 button:This button is used to bac3 to the interface frame.

    @hen (ushing the #dit button in the interface 7rame the follo/ing 7rame iso(ened :

    This @indo/ is com(osed of the follo/ing $2 com(onents /hich are:

    UA, 7our "ombo bo?es /hich are: Student Bame "ombo o?: 2s the combo bo? that contains the names of the

    students that are enrolled in a gi'en "ourse name that is s(ecified from the"ourse Bame "ombo o? and in a s(ecific e?am /hich has a s(ecific date anda s(ecific ty(e that is chosen from the e?am Date and e?am ty(e combo bo? .

    "ourse Bame "ombo o?:

    This is the combo bo? that contains the course names that are e?isted in thesystem.

    60

  • 8/10/2019 Full Thesis.pdf

    61/109

    #?am Date and Ty(e "ombo o?es:

    This "ombo o? is used to contain all the e?am dates of a gi'en course and thety(e of the e?ams.

    There are three buttons in the #dit Student 7rame /hich are:

    *F utton:y (ushing this button all the data from the ne/ fields are dum(ed in the

    database.

    ac3 utton:This button is used to bac3 to the interface frame.

    enerate utton:

    This button is used to retrie'e the old data related to a gi'en student that aree?isted in the database.

    There 1+ 7ields in this frame /hich are:

    1-*ld #?am Score: this field contains the retrie'ed old e?am score of a gi'enstudent data that comes from the database.

    - *ld midterm Score 7ield: this field contains the old midterm score of a gi'enstudent that is retrie'ed from a database.

    - *ld Acti'ity Score 7ield: this field contains the old acti'ity score of a gi'enstudent.-*ld Attendance 7ield: this field contains the old attendance of a gi'en student.

    0-*ld total score 7ield: this field contains the *ld total final score of a gi'enstudent.5-Be/ #?am Score 7ield: this field contains the ne/ e?am score of a gi'enstudent.9-Be/ midterm Score 7ield: this field contains the ne/ mid term score of a gi'enstudent that is retrie'ed from the database.4-Be/ Acti'ity Score 7ield: this field contains the ne/ acti'ity score of a gi'enstudent.6-Be/ Attendance 7ield: this field contains the ne/ attendance of a gi'enstudent.1+-Be/ Total score 7ield: this field contains the ne/ summation of the ne/scores of a gi'en student.

    @hen (ushing the (rint button from the interface /indo/ the gi'en frame iso(ened:

    61

  • 8/10/2019 Full Thesis.pdf

    62/109

    This is the Student s Subject 7rame /hich consists of the follo/ing:

    Three buttons /hich are:

    a, Student Scri(t button:

    This button is used for (rinting a student results in the subjects that is o(ened inthe currently semester )or term as /ill be described shortly,.

    b, Subject Scri(t button:

    This button is used to (rint all the results of students in a gi'en subject that iso(ened in the currently semester.

    c, ac3 button:

    This button is used to return to the interface /indo/.

    @hen (ushing on the Student Scri(t button the follo/ing /indo/ is o(ened:

    62

  • 8/10/2019 Full Thesis.pdf

    63/109

    This is the Print frame.

    This frame consists of buttons /hich are:

    a, 7ull Term scri(t:

    This button lead to the (rinting of the results of a s(ecific student in the subjectshe ta3es in a full term )t/o semesters,.

    b, Half Term Scri(t:

    This button (rint the results of a s(ecific student in the subjects he too3 in onesemester )Half Term, .

    c, Total Scri(t:This button (rints the results of a gi'en student in all the subjects he too3.

    D, ac3 button: this button is used to return to the Student s Subject frame.

    2f you (ress on the Half Semester button for e?am(le:

    63

  • 8/10/2019 Full Thesis.pdf

    64/109

    The Half Semester 7rame consists of the follo/ing com(onents:

    7i'e 7ields /hich are:

    a, Bame 7ield: this field ta3es the name of the student of this scri(t.c, Hours Passed: this 7ield contains the total hours of the subjects that a gi'enstudent is (assed.D, &e'el: this field contains the le'el of a gi'en student.#, Semester Hours: "ontain the number of hours of the subjects that student

    ta3es in the currently semester.7, Total PA: this 7ield contains the total PA of a gi'en student. The frame contains the table /hich sho/s the results of subjects ta3en bystudent in one semester ha'e the follo/ing headers:Subject: this header contains the subjects ta3en by this student."!H: this header contains the credit hours of e'ery subject in the table.#BT: this header contains the number of entrance the s(ecific subject of a gi'enstudent.Deg: this header contains the total score of the student in each subject.*7: this field contains the ma?imum score of each subject

    rade: contains the rade of the student in each subject$nits: contain the units that are e>ui'alent to each grade

    There are t/o buttons /hich are:

    *F: this button is used to retrie'e the data from the data base of a gi'en studentFno/n from its id to be 'isuali;ed in the table.

    ac3: this button is used to return to the Print 7rame.

    64

  • 8/10/2019 Full Thesis.pdf

    65/109

  • 8/10/2019 Full Thesis.pdf

    66/109

    Subject: this header contains the subjects ta3en by this student.

    "!H: this header contains the credit hours of e'ery subject in the table.

    #BT: this header contains the number of entrance the s(ecific subject of a gi'en

    student.

    Deg: this header contains the total score of the student in each subject.

    *7: this field contains the ma?imum score of each subject.

    rade: contains the rade of the student in each subject.

    $nits: contain the units that are e>ui'alent to each grade.

    There are t/o buttons /hich are:

    *F: this button is used to retrie'e the data from the data base of a gi'en studentFno/n from its id to be 'isuali;ed in the table.

    ac3: this button is used to return to the Print 7rame.

    2f you Press the Total Scri(t button the same frame /ill be a((eared e?ce(t thefollo/ing little changes:

    The Total scri(t 7rame consists of the follo/ing com(onents:

    7i'e 7ields and "ombo o? /hich are:

    66

  • 8/10/2019 Full Thesis.pdf

    67/109

    a, Bame 7ield: this field ta3es the name of the student of this scri(t.

    b, Student 2d "ombo o?:This combo bo? /ill contain the id of the students that has the name /ritten inthe name field

    c, Hours Passed: this 7ield contains the total hours of the subjects that a gi'enstudent is (assed.D, &e'el: this field contains the le'el of a gi'en student.#, Total PA: this 7ield contains the total PA of a gi'en student. The frame contains the table /hich sho/s the results of subjects ta3en Passedby a gi'en student and has the follo/ing headers:Subject: this header contains the subjects ta3en by this student."!H: this header contains the credit hours of e'ery subject in the table.#BT: this header contains the number of entrance the s(ecific subject of a gi'enstudent.Deg: this header contains the total score of the student in each subject.

    *7: this field contains the ma?imum score of each subject.rade: contains the rade of the student in each subject.$nits: contain the units that are e>ui'alent to each grade.

    There are t/o buttons /hich are:

    *F: this button is used to retrie'e the data from the data base of a gi'en studentFno/n from its id to be 'isuali;ed in the table.

    ac3: this button is used to return to the Print 7rame.

    2f you (ress on the Subject Scri(t utton on the Student s Subject 7rame

    67

  • 8/10/2019 Full Thesis.pdf

    68/109

    The follo/ing frame is o(ened:

    This is the subject frame and contains the follo/ing com(onents:

    *ne "ombo o? /hich is:

    "ourse Bame "ombo o?: /hich contain the name of all courses in the system.#?am Date "ombo o?: /hich contain the Dates of all e?ams s(ecific to a gi'encourse name in the system.

    "ourse 2d 7ield: /hich contain the id number of the course being selected.

    T/o buttons /hich are:

    -*F: this button su((ly the data from the data base to the table.- ac3: this button is used to return to the Subject s Student frame.- Acti'ation utton: this button is used /hen /e /ant to acti'ate the choose ofthe students that ha'e an e?am in a gi'en subject for a s(ecific date.- "hoose utton: this button is used /hen /e /ant to choose of the students thatha'e an e?am in a gi'en subject for a s(ecific date.- "ourse 2d 7ield: this field contain the id of the course.

    The Table that is used to sho/ all the students that enter the test of this subjectand their results for the follo/ing e?am date.

    2ts header is :

    Student Bame: /hich contain the name of the students that ha'e e?am in thiscourse)and in a s(ecific date,.

    68

  • 8/10/2019 Full Thesis.pdf

    69/109

    midterm Score: the score of the mid term score of each student in this course. Attendance: contain the attendance of each student in the course. Acti'ity Score: contain the acti'ity score of each student in the course.#?am Score: contain the e?am score of each student in the course.Total Score: contain the summation of this scores of each student in the course.

    -7eatures:

    1,

    To (re'ent the entrance of a fault 'alue or /hen the (erson forget the student

    name or the course name so /e sol'e this (roblem by:Ma3ing a combo bo? for the courses names that contain the name of all coursesin the system.That load automatically /hen starting the class.

    2ts "ode is:db " ne# %atabaseConnection(); db.open%atabaseConnection(); String st " String.format(!select course=name fromdev.courses !); tr+ {

    0esultSet rs "db.con.createStatement().e1ecute5uer+(st); int counter " L; #hile (rs.ne1t()) { counter ; 2 rs " db.con.createStatement().e1ecute5uer+(st); cmbCoursesSelect.removeAll tems(); for (int i " L; i : counter; i ) { rs.ne1t(); cmbCoursesSelect.add tem(rs.getString(*));

    2 2 catch (S56E1ception e1) { S+stem.err.println(e1.get8essage() !in ! this.getClass().get ame()); e1.printStac3/race(); 2@hen a course name is selected and push the button

    #hich sho# all the dates of e1ams and the t+pe ofthe e1ams of a specific course its code is'

    69

  • 8/10/2019 Full Thesis.pdf

    70/109

    String e1am d,"null; db " ne# %atabaseConnection(); db.open%atabaseConnection();

    String courseSelected "cmbCoursesSelect.getSelected tem().toString(); cmb%ateSelection.removeAll tems(); cmbE1am/+peSelection.removeAll tems();

    tr+ {

    String st " String.format(!select course=id ! !from dev.courses #herecourse=name"HIsH !$ courseSelected); 0esultSet rs "db.con.createStatement().e1ecute5uer+(st);

    if (rs.ne1t()) { VVrs.ne1t(); course d"rs.getString(*); String course d, " rs.getString(*); String st* " String.format(!select e1am=idfrom e1ams ! !#here course=id"HIsH!$course d,); 0esultSet rs* "db.con.createStatement().e1ecute5uer+(st*); #hile( rs*.ne1t()){ e1am d, " rs*.getString(*);

    String st, " String.format(!selectto=char(e1am=date$H%%-88-

  • 8/10/2019 Full Thesis.pdf

    71/109

    cmbE1am/+peSelection.add tem(e1am=t+pe);

    2 2

    2 2 catch (S56E1ception e1) { S+stem.err.println(e1.get8essage() !in ! this.getClass().get ame()); e1.printStac3/race(); 2

    @hen you select an e?am date and (ush the button the names of thestudents that submit in the e?am of the course in this date are loaded in a combobo? to enable the user to select among them freely= its code is:

    nteger student d,"L;Stringe1am/+pe"cmbE1am/+peSelection.getSelected tem().toString();Stringe1am%ate"cmb%ateSelection.getSelected tem().toString(); String st " String.format(!select student=id ! !from dev.student=e1ams ! !#here e1am=id"select e1am=id fromdev.e1ams #here e1am=t+pe"HIsH A % e1am=date"HIsH!$e1am/+pe$e1am%ate); String e1am dSelection"String.format(!selecte1am=id from dev.e1ams #here e1am=t+pe"HIsH A %e1am=date"HIsH! ! A %course=id"HIsH!$e1am/+pe$e1am%ate$course d); cmbStudent ame.removeAll tems(); tr+ { 0esultSet rs "db.con.createStatement().e1ecute5uer+(st); #hile(rs.ne1t()){ student d, " rs.get nt(!student=id!); String st* " String.format(!select

    first=name$middle=name$last=name ! !from dev.students ! !#here student=id"HIdH!$ student d,); 0esultSet rs* "db.con.createStatement().e1ecute5uer+(st*); #hile (rs*.ne1t()) { String name " String.format(!Is Is Is!$rs*.getString(!first=name!)$

    71

  • 8/10/2019 Full Thesis.pdf

    72/109

    rs*.getString(!middle=name!)$rs*.getString(!last=name!)); cmbStudent ame.add tem(name); 2 2

    0esultSetrs,"db.con.createStatement().e1ecute5uer+(e1am dSelection); rs,.ne1t(); e1am d"rs,.getString(*); 2

    catch (S56E1ception e1) { S+stem.err.println(e1.get8essage() !in ! this.getClass().get ame()); e1.printStac3/race(); 2

    ,The generate button is used to (ro'ide the (erson /ith the old scores of gi'enstudent before adding the ne/ scores.%ouble old/otalScore " L.L; %ouble oldE1amScore " L.L; %ouble old8id/ermScore " L.L; %ouble oldAttendanceScore " L.L; %ouble oldActivit+Score " L.L;

    db " ne# %atabaseConnection(); db.open%atabaseConnection();

    tr+ { String generation " String.format(!selectscore$attendance=pct$activit+=score ! !from dev.student=courses #herestudent=id"HIdH A % course=id"HIsH!$ student d$ course d);

    72

  • 8/10/2019 Full Thesis.pdf

    73/109

    String mid/erm en"String.format(!select scorefrom dev.student=e1ams #here student=e1ams.student=id"HIdHA % ! !e1am=id"! !select midterm=id from

    dev.student=courses #here ! !student=courses.student=id"HIdH A %student=courses.course=id"HIsH!$student d$student d$coursed); String E1am en"String.format(!select score fromdev.student=e1ams #here student=e1ams.student=id"HIdH A % ! !e1am=id"! !select final=id fromdev.student=courses #here ! !student=courses.student=id"HIdH A %student=courses.course=id"HIsH!$student d$student d$coursed); 0esultSet rs "db.con.createStatement().e1ecute5uer+(generation); 0esultSet rs, "db.con.createStatement().e1ecute5uer+(mid/erm en); 0esultSet rsJ "db.con.createStatement().e1ecute5uer+(E1am en); if ((rs.ne1t()) MM (rs,.ne1t()) MM(rsJ.ne1t())) {

    oldE1amScore " rsJ.get%ouble(!score!); old8id/ermScore " rs,.get%ouble(!score!); oldAttendanceScore "rs.get%ouble(!attendance=pct!); oldActivit+Score "rs.get%ouble(!activit+=score!); old/otalScore " oldE1amScore old8id/ermScore oldAttendanceScore oldActivit+Score; old/otalScoreField.set/e1t(old/otalScore.toString()); oldE1amScoreField.set/e1t(oldE1amScore.toString()); old8id/ermField.set/e1t(old8id/ermScore.toS

    tring()); oldAttendanceField.set/e1t(oldAttendanceScore.toString()); oldActivit+ScoreField.set/e1t(oldActivit+Score.toString()); 2 2 catch (S56E1ception e1) {

    73

  • 8/10/2019 Full Thesis.pdf

    74/109

    S+stem.err.println(e1.get8essage() !in ! this.getClass().get ame()); e1.printStac3/race(); this.dispose(); 2

    , in the (rint frame:

    @hen you select half term scri(t button or full term scri(t button the same iso(ened e?ce(t the label /hich is called semester hours must change into termhours

    74

  • 8/10/2019 Full Thesis.pdf

    75/109

    So there /as a solution to construct t/o classes one for the half semester andone for the term but the more fa'orite solution is to construct one class and

    change the label according to the choice of the button or

    The code of the choice issemisterScript semister"ne# semisterScript(,);

    semister.set isible(true);this.set isible(false);orfor full semester'semisterScript semister"ne# semisterScript(*); semister.set isible(true); this.set isible(false);

    And the constructor decide /hich frame to sho/ the code of the constructor:

    , in the semester V total scri(t frames the

    75

  • 8/10/2019 Full Thesis.pdf

    76/109

    The name of the student is entered in the field and by (ushing the 2D button itcom(aring all the names e?isted in the system to the entered name to be sure ofthe 'alidation of this name if it e?ist it sho/s its id in the combo bo?

    2f there is a re(etition of this name it sho/ all the ids that related to this re(eatedname.

    2f the name isnGt e?ist it sho/s a /arning message telling the user to reenter thename2ts code is:

    cmbStudent d.removeAll tems(); String student ame* " nameField.get/e1t(); int student d,"L; int counter " L; String first ame " null; String middle ame " null; String last ame " null; String reservedFirst ame " null; String reserved8iddle ame " null;

    String reserved6ast ame " null; tr+ { String student ame " String.format(!selectfirst=name$middle=name$last=name ! !from dev.students!); 0esultSet rs "db.con.createStatement().e1ecute5uer+(student ame); #hile (rs.ne1t()) { first ame " rs.getString(!first=name!); middle ame " rs.getString(!middle=name!); last ame " rs.getString(!last=name!);

    String fullStudent ame " String.format(!IsIs Is!$ rs.getString(!first=name!)$rs.getString(!middle=name!)$ rs.getString(!last=name!)); if(student ame*.equals gnoreCase(fullStudent ame)) { counter ; reservedFirst ame " first ame; reserved8iddle ame " middle ame;

    76

  • 8/10/2019 Full Thesis.pdf

    77/109

    reserved6ast ame " last ame; 2 2 if (counter "" *) { String st, " String.format(!select

    student=id ! !from dev.students ! !#here first=name"HIsHA %middle=name"HIsH A % last=name"HIsH!$ reservedFirst ame$reserved8iddle ame$ reserved6ast ame); nameField.setEditable(false); 0esultSet rs, "db.con.createStatement().e1ecute5uer+(st,); if (rs,.ne1t()) { student d, " rs,.get nt(!student=id!); cmbStudent d.add tem(rs,.get nt(!student=id!)); cmbStudent d.setEditable(false); 2 2 if (counter " ,) { 9 ptionPane.sho#8essage%ialog(null$ !thethere are a duplication in the name please choose an %from! !the combo bo1!$ !@arning! !!$ 9 ptionPane.P6A =8ESSA E); String st, " String.format(!selectstudent=id ! !from dev.students ! !#here first=name"HIsH A %middle=name"HIsH A % last=name"HIsH!$ reservedFirst ame$reserved8iddle ame$ reserved6ast ame); 0esultSet rs, "db.con.createStatement().e1ecute5uer+(st,); #hile (rs,.ne1t()) { student d, " rs,.get nt(!student=id!); cmbStudent d.add tem(rs,.get nt(!studen

    t=id!));

    2 2 if (counter "" L) { 9 ptionPane.sho#8essage%ialog(null$ !Sorr+there isnHt an+ student #ith this name please ret+pe thename again!$ !@arning!

    77

  • 8/10/2019 Full Thesis.pdf

    78/109

    !!$ 9 ptionPane.P6A =8ESSA E); 2

    2 catch (S56E1ception e1) { S+stem.err.println(e1.get8essage() !in !

    this.getClass().get ame()); 2

    so by this /ay /e be sure that the user doesnGt enter an in'alid name or student2d.

    0,

    2n the e?am frame :

    The course name is loaded in the combo bo? at the beginning of the (rogram soas to a'oid any (robable mista3e of entering in'alid course name.The code of loading is:initComponents(); db " ne# %atabaseConnection(); db.open%atabaseConnection(); String st " String.format(!select course=name from

    dev.courses!); tr+ { 0esultSet rs "db.con.createStatement().e1ecute5uer+(st); int counter " L; #hile (rs.ne1t()) { counter ; 2

    78

  • 8/10/2019 Full Thesis.pdf

    79/109

    rs " db.con.createStatement().e1ecute5uer+(st); cmbCourse ame.removeAll tems(); for (int i " L; i : counter; i ) { rs.ne1t(); cmbCourse ame.add tem(rs.getString(*));

    2 2 catch (S56E1ception e1) { S+stem.err.println(e1.get8essage() !in ! this.getClass().get ame()); 2

    After choosing the course and (ushing the button the course ide>ui'alent to the course name /ill a((ear in the course id field

    2f you (ush button the e?am date combo bo? is acti'ated

    this combo bo? is used /hen you /ant tochoose the students /ho entered the e?am of this course in a chosen date theacti'ate button code is:

    cmbE1am%ate.setEditable(true); cmbE1am%ate.removeAll tems(); tr+ { String st " String.format(!select e1am=datefrom dev.e1ams #here course=id"HIsH!$ course d); 0esultSet rs "db.con.createStatement().e1ecute5uer+(st); #hile (rs.ne1t()) { cmbE1am%ate.add tem(rs.getString(!e1am=date!)); 2 2 catch (S56E1ception e1) { S+stem.err.println(e1.get8essage() !in !

    this.getClass().get ame()); 2

    After chosen a specific date push the choose button toselect this date and choose the students according to thisdate'

    String date " cmbE1am%ate.getSelected tem().toString();

    79

  • 8/10/2019 Full Thesis.pdf

    80/109

    String e1am d, " null; nteger student d " L; String name " null; %ouble e1amScore " L.L; %ouble mid/ermScore " L.L;

    %ouble activit+ " L.L; %ouble %eg " L.L; %ouble attendance " L.L; String grade " null; String table7eaderWX " {!Student ame!$ !8id /ermScore!$ !Attendance!$ !Activit+ /otal Score!$ !E1am Score!$!/otal Score!$ !8a1 Score!$ ! rade!2; table8odel " ne# %efault/able8odel(null$table7eader); table " ne# 9/able(table8odel); tr+ {

    String st " String.format(!select student=id ! !from dev.student=courses ! !#here course=id"HIsH A %! ! upper(status)"HIsH !$ course d$!C>00E /6< E 0 66E%!); 0esultSet rs "db.con.createStatement().e1ecute5uer+(st); #hile (rs.ne1t()) { student d " rs.get nt(!student=id!); String st* " String.format(!selectfirst=name$middle=name$last=name from dev.students #herestudent=id"HIdH!$ student d); 0esultSet rs, "db.con.createStatement().e1ecute5uer+(st*); if (rs,.ne1t()) { name " String.format(!Is Is Is!$rs,.getString(!first=name!)$ rs,.getString(!middle=name!)$rs,.getString(!last=name!)); 2 String st, " String.format(!select

    attendance=pct$! !activit+=score! !from dev.student=courses! !#here course=id"HIsH A %student=id"HIdH!$ course d$ student d); String mid/erm"String.format(!select scorefrom dev.student=e1ams #here e1am=id"!

    80

  • 8/10/2019 Full Thesis.pdf

    81/109

  • 8/10/2019 Full Thesis.pdf

    82/109

    if (( Q :" %eg) MM (%eg : RL)) { grade " !C!; 2 if ((RL :" %eg) MM (%eg : RQ)) { grade " !C !;

    2 if ((RQ :" %eg) MM (%eg : TL)) { grade " !B-!; 2 if ((TL :" %eg) MM (%eg : TQ)) { grade " !B!; 2 if ((TQ :" %eg) MM (%eg : UL)) { grade " !B !; 2 if ((UL :" %eg) MM (%eg : UQ)) { grade " !A-!; 2 if ((UQ :" %eg) MM (%eg : *LL)) { grade " !A!; 2

    2 table8odel.add0o#(ne# b4ectWX{name$mid/ermScore$ attendance$ activit+$ e1amScore$ %eg$ *LL$grade2); 2 4ScrollPane*.set ie#port ie#(table); 2 catch (S56E1ception e1) { S+stem.err.println(e1.get8essage() !in ! this.getClass().get ame()); 2

    82

  • 8/10/2019 Full Thesis.pdf

    83/109

    Chapter &Ahmed Saad Contribution

    )raduate Module

    2n the coding of the raduate module the 8a'a Persistence %uery &anguage isused.

    8P%&

    The 8a'a Persistence %uery &anguage )8P%&, is a (latform-inde(endent object-oriented >uery language defined as (art of the 8a'a Persistence AP2s(ecification.8P%& is used to ma3e >ueries against entities stored in a relational database. 2tis hea'ily ins(ired by S%&= and its >ueries resemble S%& >ueries in synta?= buto(erate against 8PA entity objects rather than directly /ith database tables.2n addition to retrie'ing objects ) S#"T >ueries,= 8P%& su((orts bul3 $PDAT#and D#T# >ueries.

    !ole of the raduate

    The raduate can 'ie/ some data in Tables from the database V can edit hiscontact information.The raduate can 'ie/ the archi'e and can #dit some data in his archi'e byusing the follo/ing buttons )ne/= delete= refresh= sa'e, in order to be able tou(date his contact information /hich facilitates the communication /ith hiscolleagues.

    83

  • 8/10/2019 Full Thesis.pdf

    84/109

    A SBAPSH*T *7 TH# !AD$AT# A!"H2 #

    A SBAPSH*T *7 TH# !AD$AT# A!"H2 # @H2"H A&&*@STH# #D2T2B *7 TH# "*BTA"T 2B7*!MAT2*B

    84

  • 8/10/2019 Full Thesis.pdf

    85/109

    The raduate can 'ie/ the list of (rofessors and courses in order to be u(dated/ith the ne/ trends in his technology researches.

    A SBAPSH*T *7 TH# &2ST *7 P!*7#SS*!S

    A SBAPSH*T *7 TH# &2ST *7 "*$!S#S

    85

  • 8/10/2019 Full Thesis.pdf

    86/109

    7*! TH# ST$D#BT A!"H2 # ) 2#@ @2TH*$T #2DT2B ,

    The WBamed%ueries:

    7or e?am(le the follo/ing WBamed%uery annotation defines a >uery /hose

    name is StudentArchi'e.findAll that retrie'es all the StudentArchi'e objects in

    the database

    WY amed5uer+ (name " !StudentArchive.findAll!$ quer+ "

    !SE6EC/ s F0 8 StudentArchive s!)$X.

    #'ery WBamed%uery annotation is attached to e?actly one entity class and

    attaching multi(le named >ueries to the same entity class re>uires /ra((ing

    them in a WBamed%ueries annotation.

    2n the follo/ing select >ueries i use the (ath e?(ressions= such as s.

    enrollment Eear= /hich referred to as (rojection. The field 'alues are e?tracted

    from )or (rojected out of, entity objects to form the >uery results.

    7or e?am(le here in the belo/ >ueries s.g(a /here s re(resents a Student

    Archi'e entity object uses the PA (ersistent field in the Student Archi'e class to

    na'igate to the associated PA entity object.

    The WBamed%uries are

    Entity Ta-le (name "ST/DE$T '#0&1E", catalog "", schema

    "DE1"*Y amed5ueries({ Y amed5uer+(name "

    !StudentArchive.findAll!$ quer+ " !SE6EC/ s F0 8StudentArchive s!)$Y amed5uer+(name " !StudentArchive.findB+Enrollment

  • 8/10/2019 Full Thesis.pdf

    87/109

    Y amed5uer+(name "!StudentArchive.findB+0eason f/ermination!$ quer+ " !SE6EC/s F0 8 StudentArchive s @7E0E s.reason f/ermination "'reason f/ermination!)$Y amed5uer+(name " !StudentArchive.findB+First ame!$ quer+

    " !SE6EC/ s F0 8 StudentArchive s @7E0E s.first ame "'first ame!)$Y amed5uer+(name " !StudentArchive.findB+8iddle ame!$ quer+" !SE6EC/ s F0 8 StudentArchive s @7E0E s.middle ame "'middle ame!)$Y amed5uer+(name " !StudentArchive.findB+6ast ame!$ quer+ "!SE6EC/ s F0 8 StudentArchive s @7E0E s.last ame "'last ame!)$Y amed5uer+(name " !StudentArchive.findB+Email!$ quer+ "!SE6EC/ s F0 8 StudentArchive s @7E0E s.email " 'email!)$Y amed5uer+(name " !StudentArchive.findB+8obile o!$ quer+ "!SE6EC/ s F0 8 StudentArchive s @7E0E s.mobile o "'mobile o!)$Y amed5uer+(name " !StudentArchive.findB+AddrStreet!$ quer+" !SE6EC/ s F0 8 StudentArchive s @7E0E s.addrStreet "'addrStreet!)$Y amed5uer+(name " !StudentArchive.findB+AddrCit+!$ quer+ "!SE6EC/ s F0 8 Stu!ent 2chi3e s W0E'E s.a!!2#ity 4a!!2#ity"*,Y amed5uer+(name " !StudentArchive.findB+AddrState!$ quer+" !SE6EC/ s F0 8 StudentArchive s @7E0E s.addrState "'addrState!)$Y amed5uer+(name " !StudentArchive.findB+AddrCountr+!$quer+ " !SE6EC/ s F0 8 StudentArchive s @7E0E s.addrCountr+" 'addrCountr+!)$Y amed5uer+(name " !StudentArchive.findB+Pro4ectScore!$quer+ " !SE6EC/ s F0 8 StudentArchive s @7E0Es.pro4ectScore " 'pro4ectScore!)$Y amed5uer+(name " !StudentArchive.findB+ pa!$ quer+ "!SE6EC/ s F0 8 StudentArchive s @7E0E s.gpa " 'gpa!)2) .The annotations are defined as follo/sYColumn (name " !E 0 668E /=

  • 8/10/2019 Full Thesis.pdf

    88/109

    YColumn(name " !6AS/= A8E!)private String last ame;YBasic(optional " false)YColumn(name " !E8A 6!)private String email;

    Y dYBasic(optional " false)YColumn(name " !8 B 6E= !)private 6ong mobile o;YColumn(name " !A%%0=S/0EE/!)private String addrStreet;YColumn(name " !A%%0=C / /0

    @2TH #TT#! ABD S#TT#! M#TH*DS AS 7*&&*@S

    public StudentArchive() { 2 public StudentArchive(6ong mobile o) { this.mobile o " mobile o; 2 public StudentArchive(6ong mobile o$ String last ame$String email) { this.mobile o " mobile o; this.last ame " last ame; this.email " email; 2 public Short getEnrollment

  • 8/10/2019 Full Thesis.pdf

    89/109

    public void set/ermination

  • 8/10/2019 Full Thesis.pdf

    90/109

  • 8/10/2019 Full Thesis.pdf

    91/109

    public void setAddrCountr+(String addrCountr+) { String oldAddrCountr+ " this.addrCountr+; this.addrCountr+ " addrCountr+; changeSupport.firePropert+Change(!addrCountr+!$oldAddrCountr+$ addrCountr+);

    2 public Big%ecimal getPro4ectScore() { return pro4ectScore; 2 public void setPro4ectScore(Big%ecimal pro4ectScore) { Big%ecimal oldPro4ectScore " this.pro4ectScore; this.pro4ectScore " pro4ectScore; changeSupport.firePropert+Change(!pro4ectScore!$oldPro4ectScore$ pro4ectScore); 2 public Big%ecimal get pa() { return gpa; 2 public void set pa(Big%ecimal gpa) { Big%ecimal old pa " this.gpa; this.gpa " gpa; changeSupport.firePropert+Change(!gpa!$ old pa$ gpa);2

    "lass rdLstdAbout o?

    ja'a.lang.*bject ja'a.a/t."om(onent

    ja'a.a/t."ontainer ja'a.a/t.@indo/ ja'a.a/t.Dialog ja'a?.s/ing.8Dialog grdLstd. rdLstdAbout o?

    All Implemented Inter*ace'

    ja'a.a/t.image.2mage*bser'er= ja'a.a/t.Menu"ontainer= ja'a.io.Seriali;able= ja'a?.accessibility.Accessible= ja'a?.s/ing.!ootPane"ontainer= ja'a?.s/ing.@indo/"ons

    +e'ted Cla'' Summar+e'ted cla''e',inter*ace' inherited *rom cla'' -avax.'%ing. /ialog

    ja'a?.s/ing.8Dialog.Accessible8Dialog

    +e'ted cla''e',inter*ace' inherited *rom cla'' -ava.a%t./ialog

    91

  • 8/10/2019 Full Thesis.pdf

    92/109

    ja'a.a/t.Dialog.AccessibleA@TDialog= ja'a.a/t.Dialog.Modal#?clusionTy(e= ja'a.a/t.Dialog.ModalityTy(e

    +e'ted cla''e',inter*ace' inherited *rom cla'' -ava.a%t.0indo%

    ja'a.a/t.@indo/.AccessibleA@T@indo/

    +e'ted cla''e',inter*ace' inherited *rom cla'' -ava.a%t.Container ja'a.a/t."ontainer.AccessibleA@T"ontainer

    +e'ted cla''e',inter*ace' inherited *rom cla'' -ava.a%t.Component

    ja'a.a/t."om(onent.AccessibleA@T"om(onent= ja'a.a/t."om(onent. aseline!esi;e eha'ior= ja'a.a/t."om(onent. lt ufferStrategy= ja'a.a/t."om(onent.7li( ufferStrategy

    Method /etailcloseAboutBo1

    YActionpublic void closeAboutBox ()

    Cla'' )rd 'tdApp ja'a.lang.*bject org.jdes3to(.a((lication.Abstract ean org.jdes3to(.a((lication.A((lication org.jdes3to(.a((lication.Single7rameA((lication grd 'td.)rd 'tdApp(ublic class )rd 'tdAppe?tends org.jdes3to(.a((lication.Single7rameA((lication

    +e'ted Cla'' Summar+e'ted cla''e',inter*ace' inherited *rom cla''org.-de' top.application.Applicationorg.jdes3to(.a((lication.A((lication.#?it&istener

    Con'tructor Summar

    )rd 'tdApp ),

    Method Summar(rotected 'oid con*igure0indo% )ja'a.a/t.@indo/ root,

    This method is to initiali;e the s(ecified /indo/ byinjecting resources.

    static rdLstdA(( getApplication ), A con'enient static getter for the a((lication instance.

    static 'oid main )ja'a.lang.StringXY args, Main method launching the a((lication.

    92

    http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/Grd_stdApp.html#Grd_stdApp()http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/Grd_stdApp.html#configureWindow(java.awt.Window)http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/Grd_stdApp.htmlhttp://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/Grd_stdApp.html#getApplication()http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/Grd_stdApp.html#main(java.lang.String[])http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/Grd_stdApp.html#Grd_stdApp()http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/Grd_stdApp.html#configureWindow(java.awt.Window)http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/Grd_stdApp.htmlhttp://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/Grd_stdApp.html#getApplication()http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/Grd_stdApp.html#main(java.lang.String[])
  • 8/10/2019 Full Thesis.pdf

    93/109

    (rotected 'oid 'tartup ), At startu( create and sho/ the main frame of the

    a((lication.

    "lass rdLstd ie/ ja'a.lang.*bject org.jdes3to(.a((lication.Abstract ean org.jdes3to(.a((lication. ie/ org.jdes3to(.a((lication.7rame ie/ grd 'td.)rd 'td ie%(ublic class )rd 'td ie%e?tends org.jdes3to(.a((lication.7rame ie/The a((licationGs main frame.

    Con'tructor Summar

    )rd 'td ie% )org.jdes3to(.a((lication.Single7rameA((lication a((,

    Method Summar 'oid 'ho%About4ox ),

    Con'tructor /etail

    )rd 'td ie%(ublic )rd 'td ie% )org.jdes3to(.a((lication.Single7rameA((lication a((,Method /etail

    'ho%About4oxWAction(ublic 'oid 'ho%About4ox ),

    Cla'' StudentArchive ja'a.lang.*bject grd 'td.StudentArchiveAll Implemented Inter*ace':

    ja'a.io.Seriali;ableW#ntity

    (ublic class StudentArchivee?tends ja'a.lang.*bjectim(lements ja'a.io.Seriali;able

    Con'tructor Summar

    StudentArchive ),

    93

    http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/Grd_stdApp.html#startup()http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/Grd_stdView.html#Grd_stdView(org.jdesktop.application.SingleFrameApplication)http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/Grd_stdView.html#showAboutBox()http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/StudentArchive.html#StudentArchive()http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/Grd_stdApp.html#startup()http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/Grd_stdView.html#Grd_stdView(org.jdesktop.application.SingleFrameApplication)http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/Grd_stdView.html#showAboutBox()http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/StudentArchive.html#StudentArchive()
  • 8/10/2019 Full Thesis.pdf

    94/109

    StudentArchive )ja'a.lang.&ong mobileBo,

    StudentArchive )ja'a.lang.&ong mobileBo= ja'a.lang.String lastBame= ja'a.lang.String email

    Method Summar 'oidaddPropert Change5i'tener )ja'a.beans.Pro(erty"hange&istener lis

    tener,

    booleane6ual' )ja'a.lang.*bject object,

    ja'a.lang.StringgetAddrCit ),

    ja'a.lang.StringgetAddrCountr ),

    ja'a.lang.StringgetAddrState ),

    ja'a.lang.StringgetAddrStreet ),

    ja'a.lang.Stringget#mail ),

    ja'a.lang.Shortget#nrollment7ear ),

    ja'a.lang.Stringget8ir't+ame ),

    ja'a.math. igDecimalget)pa ),

    ja'a.lang.Stringget5a't+ame ),

    ja'a.lang.StringgetMiddle+ame ),

    ja'a.lang.&onggetMobile+o ),

    ja'a.math. igDecimalgetPro-ectScore ), ja'a.lang.StringgetRea'on9* ermination ),

    ja'a.lang.Shortget ermination7ear ),

    intha'hCode ),

    94

    http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/StudentArchive.html#StudentArchive(java.lang.Long)http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/StudentArchive.html#StudentArchive(java.lang.Long,%20java.lang.String,%20java.lang.String)http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/StudentArchive.html#addPropertyChangeListener(java.beans.PropertyChangeListener)http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/StudentArchive.html#equals(java.lang.Object)http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/StudentArchive.html#getAddrCity()http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/StudentArchive.html#getAddrCountry()http://c/Users/Amro/Documents/NetBeansProjects/grd_std/dist/javadoc/grd_std/StudentArchive.html#getAddrState()http