SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Downloaden Sie, um offline zu lesen
ANKARA UNIVERSITY
ENGINEERING FACULTY
DEPARTMENT OF COMPUTER ENGINEERING
INTERNSHIP REPORT
A Web Application with Primefaces
Kübra SEZER
11290367
2014
ABSTRACT
During the summer internship , worked with an application which is
needed with some land consolidation project , the project which is conducted
by 'Mekansal Bilgi Teknolojileri' company.This application is a java application
which returns the farming method on the field due to given farming parcel
number.
This application developed with JSF (Java Server Faces) and MVC
(Model View Controller) architecture.In the report programing language(JSF)
and architecture(MVC) is mostly explained and refered.Beside with JSF and
MVC , open source SQL which is used as database and Primefaces which is
used as framework is also explained.
Project is developed with Netbeans platform , with Glassfish as an
server.First of all In the report ; programing language will be explained by
refering to it's architecture property , after that : steps that have been followed
, encountered problems , solution methods and necassary components in the
entire project will be explained.
Application is an only tiny piece of land consolidation project which is
conducted by the company.By checking the given parcel number through the
relevant ministry's system , which one of the ; watery farming or dry farming is
used on the land is determined.Beside with these ; like those differences
(watery and dry farming) in the consolidation project , It's aimed to gather
farming lands which have similar speciality.
INSTITUTION INFORMATION
Institutions;
Name : (Intergis)Mekansal Bilgi Teknolojileri GIS ve CAD Çöz.
Bilg. Yazılım Eğt. Tic. LTD ŞTİ
Deparment (if it can be : Software Department
stated)
Address : Ankara University Technology Development Area
Telephone : +90 312 484 22 75
E-mail : info@mekansalyazilim.com
Web Page (if exists) : www.mekansalyazilim.com
Company is developing and consulting software , automation
applications , gis projects and beyond with these the company gives service
about education intelligent systems.
TABLE OF CONTENTS
ABSTRACT ................................................................................................................ i
INSTITUTION INFORMATION .................................................................................. ii
TABLE OF CONTENTS ........................................................................................... iii
1. INTRODUCTION .................................................................................................... 1
2. USED STRUCTURES, PROGRAMING LANGUAGES ......................................... 2
2.1. MVC (Model View Controller)......................................................................... 2
2.1.1. Model ........................................................................................................ 2
2.1.2. View ...........................................................................................................3
2.1.3.Controller .................................................................................................. 3
2.2. JSF (Java Server Faces) ............................................................................... 3
2.3. Primefaces ...................................................................................................... 4
3. FORMİNG THE PROJECT..................................................................................... 5
4. RELEVANT CONCEPTS ABOUT DATABASE .....................................................8
4.1. ORM (Object Relational Mapping) ................................................................8
4.1.1. Mapping .....................................................................................................8
4.2. JPA (Java Persistence API) ...........................................................................9
4.3. Persistence Unit ..............................................................................................9
4.4. Entity ..............................................................................................................10
5. DEVELOPMENT OF THE PROJECT ..................................................................11
5.1. View (Interface) Design ................................................................................11
5.1.1 Ajax .........................................................................................................13
5.2. Controller Design ..........................................................................................15
5.3. Model Design .................................................................................................16
6.CONCLUSION ......................................................................................................18
7.BIBLIOGRAPHY ...................................................................................................19
8.APPENDICES .......................................................................................................20
1. INTRODUCTION
This application is a part of the land consolidation project which is conducted
with the company and relevant ministries and private corporations.This long time
continuing project is occured because of the needs in development phase.Briefly ,
with the land consolidation project it's aimed to gather the farming lands of different
people at different places.For this consolidation parcel's hydrologic , physical and
similar environmental aspects are analyzed with software and techonolgies.At this
analyzing step , the company's support is taken.
With the referring "Parcel Case Application" you can make returning and other
processes with reference numbers.Such as : given parcel's database recordings ,
deleting process at database , queries at databes and farming methods applied on
the land.
When the application is informed to me I was lack of JSF , Primefaces
educations and information.Because of that with the responsible engineer
researching step has begun. Steps followed during the research and development
process is exactly transferred to report. Firstly both theoretically and practical
information about the programming language and the architecture which is used is
refered.After that the ide and software requirements , concepts about database and
database connection's setup is refered. Lastly code development process is refered
and with that report ends.
2. USED STRUCTURES , PROGRAMING LANGUAGES
Here for understand the application better , information about used language ,
architecture , framework and structures is explained. Unimportant parts are counted
as known already.
2.1. MVC (Model View Controller)
MVC (Model View Controller) is a architecture pattern which makes readability
and controlling easier, It is used with software engineering. While this architecture
pattern enables the classification of the codes also it enables better performance
and higher security structures.MVC is preferred at wider and more than one person
working projects because It makes the codes easier to understand and change. It
has three layers; model, view and controller.
2.1.1. Model:
Model is a part where database processing is done. In this part
reading,updating,deleting data from database and adding new data to
database processes are done.Data acquired from the database is also
processed here.It can have only one layer also multiple layers.Also
Business Logic and Validation occurs here. It will be mentioned with detail
about this layer's design in the project expression part.
2.1.2. View:
This is the place where the communication occurs with the system and the
user. So it's the part the user sees. All of the static and dynamic
variable(html,css,javasicript etc...) of the interface which returns to user is here. User
gets his/her request and transfer it to controller. Changes in the design can only
occur here because MVC architecture design enables to spare of the application's
main part and the interface. In our project It is designed with .html extension.
2.1.3. Controller:
This part enables communication between view and the model. This is the
layer where the interaction from the user at interface is evaluated , sending request to
server and after the process at the model informs a response. Also the methods
which will run is decided here , by creating objects to variables; flow of the work is
provided.
As mentioned before this architecture design is more functional for wider
projects. With this structure different software developers with different thinking of
algorithmic can work together. This and this kind of architecture designs occurs for
making the loss of time, source and working lesser. Also these designs forces to
achieve a standard in software so project's continuity can move forward. We can call
MVC the most preferred one along with the all designs.Like in our project It can be
effectively used with jsp,php,asp.net not only with jsf.
2.2. JSF (Java Server Faces)
For making java based applications' development easier It's a developed
framework proper to MVC architecture.JSF can develop web applications with Its
own standard framework. Also there are open-source libraries which are proper to
JSF standards; PrimeFaces, RichFaces, Ajax4JSF, MyFaces etc.The main difference
between JSF and Its older technology JSP(Java Server Pages) is; JSF is more
suitable to MVC model, Ajax integration is easier and supports third party libraries.
Despite to JSP's script base JSF is component based.JSF provides event driven
framework which means ; with an interaction a method works.(For an example:
Mouse click , keyboard button click etc.).Developing web applications can be shown
in different clients(For an example: HTML browsers,Wireless,WAP,mobile etc.)
*In our project we used PrimeFaces' libraries instead of JSF's libaries.The main reason is; In
PrimeFaces lots of component is prepared and composite components are easier to use.
2.3. Primefaces
PrimeFaces is developed by a Turkish company "Prime Teknoloji".It's an open
source framework.It is preferred in the project because of having lots of components ,
can work with any platform.Another reason is; from the support forums you can
contact directly to Its developers.With enabling fast and productive interface
developing , this technology saves the user from details like html, css, javascript so
making you to concentrate on the core of the work.
On the web site of the product you can try and use all of Its components. By
this way PrimeFaces is popular in software developer forums.Also supporting Ajax is
another reason makes PrimeFaces essential.
In the project Version3.5 is used. With altering Its components It is prepared to
suit to project.
3. FORMING THE PROJECT
In this part base information like; how to create an empty project in Netbeans
which we will use in our project , how to add PrimeFaces library , how to create
interface to develop our project will be explained. After that progress in the project will
be explained step by step.
In this part simple information is explained like; how to create JSF project
which we use in our project, how to add PrimeFaces library in to project. As for Ide
Netbeans 7.3 version is taken as a basis. Eclipse and other users also can progress
with similar steps and create a project.
Firstly It must be assured that JDK(Java Development Kit) is installed on the
operating system.For this on the Windows operating systems; Firstly Windows+R
shortcut is used after that work cmd code on the screen lastly within the black screen
type javac and press enter.If similiar screenshot is acquired like given below it can be
continued with the next steps.If not it can be download due to Windows operating
system and after that altering path options it can be continued with the next
steps.However on the Linux operating system with easier packet installing
commands like sudo apt-get install , it can be installed as needed.
*Path options given with screenshots on the next page.
Right-click to Computer  Settings 
Advanced System Options  Advance
 Environment Variables  New;
We assign the bin folder of the java file
which is downloaded to variable value.
After Netbeans is opened , respectively choose File->New Project.On the
screen that shows up; at "Categories" part choose "Java Web" and from "Projects"
part choose "Web Application" and press "Next" button.On the next screen that
shows up enter the project name and decide the files' save location. Again after
clicking "Next" button you have to choose a proper server for the Web Application to
create and indicate Javaee(enterprise edition)version in this screen. In this project
Glassfish 3.1.2 is preferred but also like Tomcat, etc. can be preferred.At this screen
by clicking "Finish" button can create a project and with "Next" can move to
framework adding screen.In the project by clicking "Next" Java Server Faces
framework has been added to project.After choosing Java Server Faces at the
bottom part, from the active menu; from "Components" tab PrimeFaces can be added
which comes with Netbeans or with other way; By right clicking "Libraries" folder after
that clicking "Add jar files" can add jar files which received from the PrimeFaces'
official web-site so by this way same process can be made.(Relevant screenshot is
on the next page due to technical reasons)
By clicking "Finish" button for the last time , It creates empty project which will
be develpoed with PrimeFaces while using JSF.For getting through the Turkish
character problem; "Right" click to project , "Properties" and from here change the
"Encoding" section to "UTF-8" which locates on the bottom of the screen.
After completing base steps for creating a project , can be moved to interface
designing part.
4. RELATED CONCEPTS OF DATABASE
There are lots of process related to database because of application's base is;
questioning the farming parcel in the system which is given with its' reference number
by this way finding it's farming method and returning it. Because of that database
must be used effectively.How to use Persistence and entity concepts which are used
for making the process easier which includes Netbeans and lots of software
developing platform and ide's database will be explained, and orm(object relational
mapping), jpa(java persistence api) concepts will be also explained. It will be
assumed that database's drivers is introduced to ide and database is ready for use.
*Postgre sql is used as database with the project which is mentioned in the report.
4.1. ORM (Object Relational Mapping)
Concepts is based on , programming language which is used as base
language and processing in database. It's primitive status can be assumed as
persistence storage. Also this technology is preferred because of searching
and bringing query without discarding the list and such positive sides without
needing sql questioning.
4.1.1. Mapping:
Identifying an object in the application response to object which is created in the
database, is called mapping.
Mapping process are mostly done with using metadata. For Hibernate tool,
annotation based metadatas are used. For an example from the parcel case project;
keywords which starts with @ in the ParselDurumService class are hibernate
annotations.
“public class ParselDurumService {
@Inject
private TarimparselleriService parselService;
@PersistenceContext(unitName = "ParselEslestirPU")
private EntityManager em;
…}”
While doing mapping; classed with table, properties with colon, relations with foreign
keys, primitive types with sql types are matched.
4.2. JPA (Java Persistence Api)
JPA (Java Persistence Api) is one of the ORM (Object Relational Mapping)
Api.JPA is a standard which is created by gathering the best sides of the persistence
processing libraries in Java programming language.JPA is a technology mostly
making the code developers draw away from the database process and focus on
business logic. Without striving SQL , with the help of JPA database communication
can be provided with classes and objects. One of the important concepts in JPA is
"entity". Entities are the objects which Provides communication with database and
the software .
4.3. Persistence Unit
Java class (entity class) with the same name with database is occurs when
Persistence unit is added to the project.This java class includes information of
the database table which will be used with database.Database process which
will be done will be done with the entity class without directly communicating
with database.
“…import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;…”
By right-clicking "Source Files" folder of the project respectively; NewBy
selecting Persistence Unit, give a name to Persistence unit in the upcoming screen.
Select the latest version of JPA in the provider sections. Data SourceBy clicking
New Source and giving a name to connection, Selecting proper driver to server from
"Database Connection" part, OKBy clicking Finish connection is provided.
4.4. Entity
Entity is a permanent object in the database which is done by using JPA (Java
Persistence API).For calling an object entity; that object must be noted as
@Entity from the class which is also created from that object. Same situation
is in the ParselDurumDO public class of the application. After connecting to
server, creating an entity for which table after database selection is
determined. Right click is done to "Source File" folder, by clicking NewEntity
Classes From Database, selecting the identified connection from the data
source section of the upcoming screen is done.From the left part desired table
is selected and added to right place by pressing "Add" button.When clicked to
NextFinish entity is finally created.
5. DEVELOPİNG OF THE PROJECT AND DESİGN
5.1. View (Interface) Design
Html,jsf,PrimeFaces and ajax technologies are used in the designing the
interface phase of the "Parsel Durum Uygulaması" project. Interface is the
screen as known as interaction between user and the program is occurred, in
a word; choosing the questioning process by giving the parcel's reference
number.
When JSF projects is created, under the "Web Pages" folder; "index.xhtml"
file's existence is automatically founded.Process is done on the same
extension folder where the project's interface is designed.
All the components which are used here are the PrimeFaces technology's
components. Statements which will be inside of the "<html"tag on the top of
the existing "index.xhtml" file when the "Web Application" project is created
are like on the given screenshot here.
This html tag is trying to tell; Html tags which are using as default will have "h:"
statement on their head(start).These front tags' reason will make sense in the
upcoming places of the report when the codes for the PrimeFaces are added.
Code blog which needed to insert for using PrimeFaces components are as
given below.
For using PrimeFaces components "p:" front tags must be exists like html tags
which are used as default must have "h:" at their head(start).This code blog explains
that; more than one graphic library can be used in a page or any desired front tags
can be appointed. The main reason of these front tags are; beside making an order,
ending the confusion of the components with same tag which belongs to different
libraries.
In this part of the report; How to use some of the PrimeFaces components will
be shown and explained after that will move to other layer designs of the architecture.
Unfortunately not all of the codes are given of this part of project which is conducted
by both Ministry and the Company but still will try to explain it with examples.
“<p:commandButton value=’Search’ update=’process-
button’onclick=’cd.hide()’ action=’#{parselDurumService.saveData()}’/>”
This component has lots of input and output parameters. In the report only the
parameters which are used in the project will be given.
Update: In this component there is an unused "id" parameter and this
parameter is used as references which belongs to component in the form. And this
update command is after component's "onclick" or if it has "action" command works,
will tell which components in the form with which references will be update.
Value: This parameter indicated which text will be shown on the button. As
you can write a constant value here , another variable from the MVC (Model View
Controller) architecture's controller layer can be call.
Onclick: Indicated as function which will be called after the situation occurs on
this component (If necessary function from the controller layer can be called).There
are options such as Onkeydown, onkeypress, onstart etc.
Action: When any of the other parameters work this command works. In a
word let's say; both "onclick" and "onkeypress" parameters are used in a component
and there is also "action" parameter. Such a situation like this when the button is
pressed both "onkeypress" and "action" commands will work. So "onclick" condition
will not be waited for "action" event to occur. This command also have differences
due to taken parameter. Starting with "#" and class function "{ }" are written inside. So
this means this isn't a JavaScript code and you must go to this function in the class.
Here occurs a communication between the controller layer.
When inputMask is examined for an another component;
“<p:inputMask id="reference" required="true"
value="#{parselDurumService.reference}" mask="999999999"
requiredMessage="'ReferenceNumber Alanı Boş Bırakılamaz!"/>”
Mask: The only difference of the Mask component to another PrimeFaces
component "input Text" is; It has an aim of use. “999999999” value which is entered
to parameter, the reference number which will be going to enter here must be a
number and this number must be nine digit. There is no way to enter a character
here. If a letter or special character enters here It is impossible to sense it.
If we come to aim of use of this component; move options from the
"controller"'s layer to "value" value. The important point here is; variable or an object
or again a parameter which is appointed by object type to a value must be same
type, which is sent to controller layer.
5.1.1. Ajax:
Ajax cannot be think as a parameter but because of It's a method which is
referenced with interface design phase, in the describing state it's in this under title. It
is used with "p:" front tag and It is a component take from PrimeFaces' Library.
Functions are assigned from "controller" layer to more than one parameter in the
View layer. As seen in the given addition; In the ".html" extension file (.js extension
files are not given due to company policy.) ".js" extension files are imported. By using
JavaScript and XMLhttpRequest, Ajax (Asynchronous JavaScript and XML) is a web
programming technique which creates interactive web applications. By small data
change with server, It enables fast updating speed for the pages. It uses; for forming
the information XHTML, HTML, CSS; For providing the dynamic JavaScript,
ECMAScript, For interaction of the server XMLhpptRequest objects, IFrame etc.
technologies are used.
“</p:dataTable>”
Selection: It is a created parameter which adds one apiece checkbox to lines.
This parameter used for indicating chosen lines which are transferred to variable.
RowKey: For assigning variable names which will be used in the "Datatable"
areas.
RowIndexVar: This parameter used as indicating variable names which line
indexes are going to assign.
SelectionMode: With this parameter; creating a checkbox for every line which
is included in "dataable" and provided selecting more than one lines by giving
"multiple" value to this parameter. In this project "single" value will be enough
because chosen line will be transferred to "OrderList" and after that It will be deleted
from the "dataTable". If parameter value is "single" It would make a delay for the
process if it's multiple because of that multiple option is activated.
If components are placed as required, It would be seen as the given
screenshot of the application in the addition (Screenshot is given with more detail in
the CD).
5.2. Controller Design
In this part; commands which are assigned from user to view (interface) layer
communicating with the model layer and after having processed, how processed
value is again returned to view will be explained. Not all of the code blocks in the
controller layer will be processed, only the parts which will help to understand
project's base logic will be explained. Project's name mentioned "Controller" layer
name is "ParselDurumService". This layer is the controller part which mentions many
times of data interchange while view design is explaining. After object is given to
entity manager, functions is called and the necessary processes are done.
“ public void create(ParselDurumDO entity) {
try {
if (entity.getDurum().equals(ParselDurum.PARSEL_SULU_ALAN.toString()))
{
parselService.setSuluAlan(entity.getParselId().intValue());
} else if
(entity.getDurum().equals(ParselDurum.PARSEL_KURU_ALAN.toString())) {
parselService.setKuruAlan(entity.getParselId().intValue());
}
em.persist(entity);
em.flush();
} catch (Exception ex) {
throw new EJBException(ex);
}
}”
"Start" button in the application is an approval button. So if the land information which
is entered from user doesn't exist, a reference point will be given and saved to
database. While in this saving process; watery farming, dry farming difference will be
seen. With the first "if" condition; controlling watery area option for the parcel; on the
second condition it will control for the dry farming area.
“…public void edit(ParselDurumDO entity) {
try {
em.merge(entity);
} catch (Exception ex) {
throw new EJBException(ex);
} }…”
On the upper part explaining a function which is equalled to "create" function,
with this function some options of the farming parcel is updated which is created
before and saved to database.
If we examine the “ParselDurumService.java” folder; with "public void remove"
function parcel will be deleted, with "public ParsemDurumDO find" function there will
be search with the parcel's reference number, with "public void remove All" function
all of the parcel information will deleted; can be seen.
5.3. Model Design
Controller layer and how does it work is tried to explained with its' basic form.
Lastly will mention to the model part and will move to conclusion in the report. All of
the examples given are override methods and firstly attention must be paid to that.
“…@Override
public int hashCode() {
int hash = 0;
hash += (recId != null ? recId.hashCode() : 0);
return hash;
}…”
If the object's record id (recid) is null are not is controlled in the first function. If
it's null; hashCode function is called and moved to hash and returns it. If it is null
returns zero.
“... @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ParselDurumDO)) {
return false;
}
ParselDurumDO other = (ParselDurumDO) object;
if ((this.recId == null && other.recId != null) || (this.recId != null &&
!this.recId.equals(other.recId))) {
return false;
}
return true;
}…”
In this function equals function is overridden. Controlling if the objects are
same or not. With "instanceof" command checking if the received object is derived
from the ParselDurumDO object. If it's not a derived object "false" returns. After that
"other" named ParselDurumDO object is created as null and compared with the
received object. If the received object is null "false" returns. If none of the condition
are ensured "true" returns.
“… @Override
public String toString() {
return "lnr.parsel.eslestir.entity.ParselDurumDO[ recId=" + recId + " ]";
}
}…”
In this function "toString" overridden. Because of it's an obj.toString, object's
class address is given.
6. CONCLUSION
During the report what is MVC (Model, View , Controller), this architecture
pattern's properties, what advantages does it provides, how to perform, what
easiness does PrimeFaces' provides, how to add components, how to create JSF
(java server faces) project on the Netbeans ide is explained by step by step,
examples given for making it easier to understand."Parsel Durum Uygulaması" is
also explained.
During summer internship the most important thing I believe that I will use it,
see the advantages of it in the future is MVC architecture's structure. Oracle ADF and
PrimeFaces (Product of a Turkish Company) which are proper to MVC are the other
positive sides that I have learned. However other architectures become widespread;
these architecture effects are undeniably important on the bigger projects working
with groups of software developers.
Even though "Parsel Durum Uygulaması" project report is a guide for how to
use ; MVC architecture, JSF programming language and PrimeFaces framework;
without practicing on the project they are impossible to comprehend.
Summer internship started with researching for MVC architecture and
continued with working with Oracle adf. Because of some technical failures working
with Oracle adf is stopped; After needing an application on the company's "Land
Consolidation" project, started working on "Parsel Durum Uygulaması".
Although there is no lack in the usage of the project; can be worked more on
the interface. Because of the company's policy and official corporations, ministry and
private company conducted part of the mutual project; working copy of the application
or all of the source codes are not given but still the digital copy of the report will be
given which will be enough to understand the architecture.
7. BIBLIOGRAPHY
o PrimeFaces components;
http://www.primefaces.org/showcase/ui/home.jsf
o http://forum.primefaces.org/
o http://www.tutorialspoint.com/jsf/
o http://stackoverflow.com/
o http://tr.wikipedia.org/
o https://developer.chrome.com/home
o http://hibernate.org/
o https://javaserverfaces.java.net/
o https://netbeans.org/
For the images;
o http://tr.wikipedia.org/
o http://project67555.appspot.com/
8. APPENDICES
CD which will be given with the report includes digital copy of the report
also; screenshots, some parts of the codes will be included. Due to company
policy all of the codes are not given. Other addition information are given in the
report for not breaking the expression structure of the report.

Weitere ähnliche Inhalte

Was ist angesagt?

Web Design Project Report
Web Design Project ReportWeb Design Project Report
Web Design Project ReportMJ Ferdous
 
mLearn Project 2012 Full Report
mLearn Project 2012 Full ReportmLearn Project 2012 Full Report
mLearn Project 2012 Full ReportmLearn
 
Project Management - Web Application Report
Project Management - Web Application ReportProject Management - Web Application Report
Project Management - Web Application ReportNakul Sharma
 
Intro to Front-End Web Devlopment
Intro to Front-End Web DevlopmentIntro to Front-End Web Devlopment
Intro to Front-End Web Devlopmentdamonras
 
Online News Portal System
Online News Portal SystemOnline News Portal System
Online News Portal SystemRajib Roy
 
6 Week / Month Industrial Training in Hoshiarpur Punjab- PHP Project Report
6 Week / Month Industrial Training in Hoshiarpur Punjab- PHP Project Report 6 Week / Month Industrial Training in Hoshiarpur Punjab- PHP Project Report
6 Week / Month Industrial Training in Hoshiarpur Punjab- PHP Project Report c-tac
 
Soft Tech Innovation Ltd Web Development Plan 2013
Soft Tech Innovation Ltd Web Development Plan 2013Soft Tech Innovation Ltd Web Development Plan 2013
Soft Tech Innovation Ltd Web Development Plan 2013A.M. Ishtiaque Sarwar
 
Six Months Industrial Training11
Six Months Industrial Training11Six Months Industrial Training11
Six Months Industrial Training11Manoj Rao
 
online blogging system
online blogging systemonline blogging system
online blogging system001vaibhav
 
Webinar: Front End Web Development - Trendy Web Designs Using HTML5
Webinar: Front End Web Development - Trendy Web Designs Using HTML5Webinar: Front End Web Development - Trendy Web Designs Using HTML5
Webinar: Front End Web Development - Trendy Web Designs Using HTML5Edureka!
 
Develop Mobile App Using Android Lollipop
Develop Mobile App Using Android LollipopDevelop Mobile App Using Android Lollipop
Develop Mobile App Using Android LollipopEdureka!
 
How DotNet, SharePoint, and Azure helps to build a Custom Web Application wi...
 How DotNet, SharePoint, and Azure helps to build a Custom Web Application wi... How DotNet, SharePoint, and Azure helps to build a Custom Web Application wi...
How DotNet, SharePoint, and Azure helps to build a Custom Web Application wi...Aimore Technologies
 
Mi0041 java and web design
Mi0041  java and web designMi0041  java and web design
Mi0041 java and web designsmumbahelp
 

Was ist angesagt? (20)

Web Design Project Report
Web Design Project ReportWeb Design Project Report
Web Design Project Report
 
Report on web development
Report on web developmentReport on web development
Report on web development
 
Web developnment
Web developnment Web developnment
Web developnment
 
mLearn Project 2012 Full Report
mLearn Project 2012 Full ReportmLearn Project 2012 Full Report
mLearn Project 2012 Full Report
 
Project Management - Web Application Report
Project Management - Web Application ReportProject Management - Web Application Report
Project Management - Web Application Report
 
Intro to Front-End Web Devlopment
Intro to Front-End Web DevlopmentIntro to Front-End Web Devlopment
Intro to Front-End Web Devlopment
 
Online News Portal System
Online News Portal SystemOnline News Portal System
Online News Portal System
 
6 Week / Month Industrial Training in Hoshiarpur Punjab- PHP Project Report
6 Week / Month Industrial Training in Hoshiarpur Punjab- PHP Project Report 6 Week / Month Industrial Training in Hoshiarpur Punjab- PHP Project Report
6 Week / Month Industrial Training in Hoshiarpur Punjab- PHP Project Report
 
Soft Tech Innovation Ltd Web Development Plan 2013
Soft Tech Innovation Ltd Web Development Plan 2013Soft Tech Innovation Ltd Web Development Plan 2013
Soft Tech Innovation Ltd Web Development Plan 2013
 
Report html5
Report html5Report html5
Report html5
 
College Web Site HTML PROJECT
College Web Site HTML PROJECTCollege Web Site HTML PROJECT
College Web Site HTML PROJECT
 
Six Months Industrial Training11
Six Months Industrial Training11Six Months Industrial Training11
Six Months Industrial Training11
 
Web engineering lecture 4
Web engineering lecture 4Web engineering lecture 4
Web engineering lecture 4
 
online blogging system
online blogging systemonline blogging system
online blogging system
 
Webinar: Front End Web Development - Trendy Web Designs Using HTML5
Webinar: Front End Web Development - Trendy Web Designs Using HTML5Webinar: Front End Web Development - Trendy Web Designs Using HTML5
Webinar: Front End Web Development - Trendy Web Designs Using HTML5
 
2ND REPORT
2ND REPORT2ND REPORT
2ND REPORT
 
Develop Mobile App Using Android Lollipop
Develop Mobile App Using Android LollipopDevelop Mobile App Using Android Lollipop
Develop Mobile App Using Android Lollipop
 
report
reportreport
report
 
How DotNet, SharePoint, and Azure helps to build a Custom Web Application wi...
 How DotNet, SharePoint, and Azure helps to build a Custom Web Application wi... How DotNet, SharePoint, and Azure helps to build a Custom Web Application wi...
How DotNet, SharePoint, and Azure helps to build a Custom Web Application wi...
 
Mi0041 java and web design
Mi0041  java and web designMi0041  java and web design
Mi0041 java and web design
 

Andere mochten auch

Internship final presentation
Internship final presentationInternship final presentation
Internship final presentationMeme Whisper
 
INTERNSHIP BASED ON PHP-MY SQL-WORDPRESS-CODE IGNITOR-ANDROID-IOS DEV.-JAVA (...
INTERNSHIP BASED ON PHP-MY SQL-WORDPRESS-CODE IGNITOR-ANDROID-IOS DEV.-JAVA (...INTERNSHIP BASED ON PHP-MY SQL-WORDPRESS-CODE IGNITOR-ANDROID-IOS DEV.-JAVA (...
INTERNSHIP BASED ON PHP-MY SQL-WORDPRESS-CODE IGNITOR-ANDROID-IOS DEV.-JAVA (...DOCC Group
 
BSC CSIT Final Year Internship Experience Report on SEO
BSC CSIT Final Year Internship Experience Report on SEOBSC CSIT Final Year Internship Experience Report on SEO
BSC CSIT Final Year Internship Experience Report on SEOSirish Paudel
 
Internship Report
Internship Report Internship Report
Internship Report zahurul88
 
BI Internship Presentation
BI Internship PresentationBI Internship Presentation
BI Internship PresentationKyle Estepa
 
I phone programming project report
I phone programming project reportI phone programming project report
I phone programming project reportDhara Shah
 
BSC CSIT Final Year Internship PPT Presentation on SEO
BSC CSIT Final Year Internship PPT Presentation on SEOBSC CSIT Final Year Internship PPT Presentation on SEO
BSC CSIT Final Year Internship PPT Presentation on SEOSirish Paudel
 
Final Web Design Project
Final Web Design ProjectFinal Web Design Project
Final Web Design ProjectJeana Bertoldi
 
WORKING AND PROGRAMMING OF KUKA ROBOT
WORKING AND PROGRAMMING OF KUKA ROBOTWORKING AND PROGRAMMING OF KUKA ROBOT
WORKING AND PROGRAMMING OF KUKA ROBOTShahid Faizee
 
Summer Internship Report on Developing business promotional strategies and ma...
Summer Internship Report on Developing business promotional strategies and ma...Summer Internship Report on Developing business promotional strategies and ma...
Summer Internship Report on Developing business promotional strategies and ma...Kartik Mehta
 
Oracle XML Publisher / BI Publisher
Oracle XML Publisher / BI PublisherOracle XML Publisher / BI Publisher
Oracle XML Publisher / BI PublisherEdi Yanto
 
Internship Final Report
Internship Final ReportInternship Final Report
Internship Final ReportAnisa Yahdi
 

Andere mochten auch (20)

Internship final presentation
Internship final presentationInternship final presentation
Internship final presentation
 
INTERNSHIP BASED ON PHP-MY SQL-WORDPRESS-CODE IGNITOR-ANDROID-IOS DEV.-JAVA (...
INTERNSHIP BASED ON PHP-MY SQL-WORDPRESS-CODE IGNITOR-ANDROID-IOS DEV.-JAVA (...INTERNSHIP BASED ON PHP-MY SQL-WORDPRESS-CODE IGNITOR-ANDROID-IOS DEV.-JAVA (...
INTERNSHIP BASED ON PHP-MY SQL-WORDPRESS-CODE IGNITOR-ANDROID-IOS DEV.-JAVA (...
 
BSC CSIT Final Year Internship Experience Report on SEO
BSC CSIT Final Year Internship Experience Report on SEOBSC CSIT Final Year Internship Experience Report on SEO
BSC CSIT Final Year Internship Experience Report on SEO
 
internship report
internship reportinternship report
internship report
 
Internship Report
Internship Report Internship Report
Internship Report
 
BI_Internship_Final
BI_Internship_FinalBI_Internship_Final
BI_Internship_Final
 
BI Internship Presentation
BI Internship PresentationBI Internship Presentation
BI Internship Presentation
 
Malik 2
Malik 2Malik 2
Malik 2
 
I phone programming project report
I phone programming project reportI phone programming project report
I phone programming project report
 
BSC CSIT Final Year Internship PPT Presentation on SEO
BSC CSIT Final Year Internship PPT Presentation on SEOBSC CSIT Final Year Internship PPT Presentation on SEO
BSC CSIT Final Year Internship PPT Presentation on SEO
 
Problem statements
Problem statementsProblem statements
Problem statements
 
Modele rapport pfe esprit
Modele rapport pfe  espritModele rapport pfe  esprit
Modele rapport pfe esprit
 
IIM intern report
IIM intern reportIIM intern report
IIM intern report
 
Java project-presentation
Java project-presentationJava project-presentation
Java project-presentation
 
Final Web Design Project
Final Web Design ProjectFinal Web Design Project
Final Web Design Project
 
WORKING AND PROGRAMMING OF KUKA ROBOT
WORKING AND PROGRAMMING OF KUKA ROBOTWORKING AND PROGRAMMING OF KUKA ROBOT
WORKING AND PROGRAMMING OF KUKA ROBOT
 
Summer Internship Report on Developing business promotional strategies and ma...
Summer Internship Report on Developing business promotional strategies and ma...Summer Internship Report on Developing business promotional strategies and ma...
Summer Internship Report on Developing business promotional strategies and ma...
 
Internship Report
Internship ReportInternship Report
Internship Report
 
Oracle XML Publisher / BI Publisher
Oracle XML Publisher / BI PublisherOracle XML Publisher / BI Publisher
Oracle XML Publisher / BI Publisher
 
Internship Final Report
Internship Final ReportInternship Final Report
Internship Final Report
 

Ähnlich wie 2014_report

A report on mvc using the information
A report on mvc using the informationA report on mvc using the information
A report on mvc using the informationToushik Paul
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts frameworks4al_com
 
National%20 online%20examination%20system%20an%20architectural%20perspective
National%20 online%20examination%20system%20an%20architectural%20perspectiveNational%20 online%20examination%20system%20an%20architectural%20perspective
National%20 online%20examination%20system%20an%20architectural%20perspectivekalimullahmohd89
 
National%20 online%20examination%20system%20an%20architectural%20perspective
National%20 online%20examination%20system%20an%20architectural%20perspectiveNational%20 online%20examination%20system%20an%20architectural%20perspective
National%20 online%20examination%20system%20an%20architectural%20perspectivekalimullahmohd89
 
IT 8003 Cloud ComputingFor this activi.docx
IT 8003 Cloud ComputingFor this activi.docxIT 8003 Cloud ComputingFor this activi.docx
IT 8003 Cloud ComputingFor this activi.docxvrickens
 
Programming is Fun with ASP.NET MVC
Programming is Fun with ASP.NET MVCProgramming is Fun with ASP.NET MVC
Programming is Fun with ASP.NET MVCIan Carnaghan
 
Ora_Case_Study_Oracle Application Development Framework
Ora_Case_Study_Oracle Application Development FrameworkOra_Case_Study_Oracle Application Development Framework
Ora_Case_Study_Oracle Application Development FrameworkNeha Singh
 
Navya_Resume_New (1)
Navya_Resume_New (1)Navya_Resume_New (1)
Navya_Resume_New (1)Navya MP
 
College information management system.doc
College information management system.docCollege information management system.doc
College information management system.docKamal Acharya
 
Mvc architecture driven design and agile implementation of a web based softwa...
Mvc architecture driven design and agile implementation of a web based softwa...Mvc architecture driven design and agile implementation of a web based softwa...
Mvc architecture driven design and agile implementation of a web based softwa...ijseajournal
 
KiranGara_JEE_7Yrs
KiranGara_JEE_7YrsKiranGara_JEE_7Yrs
KiranGara_JEE_7YrsKiran Gara
 
COMP6210 Web Services And Design Methodologies.docx
COMP6210 Web Services And Design Methodologies.docxCOMP6210 Web Services And Design Methodologies.docx
COMP6210 Web Services And Design Methodologies.docxwrite31
 
Struts & hibernate ppt
Struts & hibernate pptStruts & hibernate ppt
Struts & hibernate pptPankaj Patel
 
Building Enterprise Application with J2EE
Building Enterprise Application with J2EEBuilding Enterprise Application with J2EE
Building Enterprise Application with J2EECalance
 

Ähnlich wie 2014_report (20)

Onine exam 1
Onine exam 1Onine exam 1
Onine exam 1
 
Design and functional_specification
Design and functional_specificationDesign and functional_specification
Design and functional_specification
 
A report on mvc using the information
A report on mvc using the informationA report on mvc using the information
A report on mvc using the information
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
 
Prakash_Ganapathy
Prakash_GanapathyPrakash_Ganapathy
Prakash_Ganapathy
 
National%20 online%20examination%20system%20an%20architectural%20perspective
National%20 online%20examination%20system%20an%20architectural%20perspectiveNational%20 online%20examination%20system%20an%20architectural%20perspective
National%20 online%20examination%20system%20an%20architectural%20perspective
 
National%20 online%20examination%20system%20an%20architectural%20perspective
National%20 online%20examination%20system%20an%20architectural%20perspectiveNational%20 online%20examination%20system%20an%20architectural%20perspective
National%20 online%20examination%20system%20an%20architectural%20perspective
 
IT 8003 Cloud ComputingFor this activi.docx
IT 8003 Cloud ComputingFor this activi.docxIT 8003 Cloud ComputingFor this activi.docx
IT 8003 Cloud ComputingFor this activi.docx
 
Programming is Fun with ASP.NET MVC
Programming is Fun with ASP.NET MVCProgramming is Fun with ASP.NET MVC
Programming is Fun with ASP.NET MVC
 
Resume
ResumeResume
Resume
 
Ora_Case_Study_Oracle Application Development Framework
Ora_Case_Study_Oracle Application Development FrameworkOra_Case_Study_Oracle Application Development Framework
Ora_Case_Study_Oracle Application Development Framework
 
Sedna space philosophy
Sedna space philosophySedna space philosophy
Sedna space philosophy
 
Navya_Resume_New (1)
Navya_Resume_New (1)Navya_Resume_New (1)
Navya_Resume_New (1)
 
College information management system.doc
College information management system.docCollege information management system.doc
College information management system.doc
 
Mvc architecture driven design and agile implementation of a web based softwa...
Mvc architecture driven design and agile implementation of a web based softwa...Mvc architecture driven design and agile implementation of a web based softwa...
Mvc architecture driven design and agile implementation of a web based softwa...
 
KiranGara_JEE_7Yrs
KiranGara_JEE_7YrsKiranGara_JEE_7Yrs
KiranGara_JEE_7Yrs
 
Final paper
Final paperFinal paper
Final paper
 
COMP6210 Web Services And Design Methodologies.docx
COMP6210 Web Services And Design Methodologies.docxCOMP6210 Web Services And Design Methodologies.docx
COMP6210 Web Services And Design Methodologies.docx
 
Struts & hibernate ppt
Struts & hibernate pptStruts & hibernate ppt
Struts & hibernate ppt
 
Building Enterprise Application with J2EE
Building Enterprise Application with J2EEBuilding Enterprise Application with J2EE
Building Enterprise Application with J2EE
 

2014_report

  • 1. ANKARA UNIVERSITY ENGINEERING FACULTY DEPARTMENT OF COMPUTER ENGINEERING INTERNSHIP REPORT A Web Application with Primefaces Kübra SEZER 11290367 2014
  • 2. ABSTRACT During the summer internship , worked with an application which is needed with some land consolidation project , the project which is conducted by 'Mekansal Bilgi Teknolojileri' company.This application is a java application which returns the farming method on the field due to given farming parcel number. This application developed with JSF (Java Server Faces) and MVC (Model View Controller) architecture.In the report programing language(JSF) and architecture(MVC) is mostly explained and refered.Beside with JSF and MVC , open source SQL which is used as database and Primefaces which is used as framework is also explained. Project is developed with Netbeans platform , with Glassfish as an server.First of all In the report ; programing language will be explained by refering to it's architecture property , after that : steps that have been followed , encountered problems , solution methods and necassary components in the entire project will be explained. Application is an only tiny piece of land consolidation project which is conducted by the company.By checking the given parcel number through the relevant ministry's system , which one of the ; watery farming or dry farming is used on the land is determined.Beside with these ; like those differences (watery and dry farming) in the consolidation project , It's aimed to gather farming lands which have similar speciality.
  • 3. INSTITUTION INFORMATION Institutions; Name : (Intergis)Mekansal Bilgi Teknolojileri GIS ve CAD Çöz. Bilg. Yazılım Eğt. Tic. LTD ŞTİ Deparment (if it can be : Software Department stated) Address : Ankara University Technology Development Area Telephone : +90 312 484 22 75 E-mail : info@mekansalyazilim.com Web Page (if exists) : www.mekansalyazilim.com Company is developing and consulting software , automation applications , gis projects and beyond with these the company gives service about education intelligent systems.
  • 4. TABLE OF CONTENTS ABSTRACT ................................................................................................................ i INSTITUTION INFORMATION .................................................................................. ii TABLE OF CONTENTS ........................................................................................... iii 1. INTRODUCTION .................................................................................................... 1 2. USED STRUCTURES, PROGRAMING LANGUAGES ......................................... 2 2.1. MVC (Model View Controller)......................................................................... 2 2.1.1. Model ........................................................................................................ 2 2.1.2. View ...........................................................................................................3 2.1.3.Controller .................................................................................................. 3 2.2. JSF (Java Server Faces) ............................................................................... 3 2.3. Primefaces ...................................................................................................... 4 3. FORMİNG THE PROJECT..................................................................................... 5 4. RELEVANT CONCEPTS ABOUT DATABASE .....................................................8 4.1. ORM (Object Relational Mapping) ................................................................8 4.1.1. Mapping .....................................................................................................8 4.2. JPA (Java Persistence API) ...........................................................................9 4.3. Persistence Unit ..............................................................................................9 4.4. Entity ..............................................................................................................10 5. DEVELOPMENT OF THE PROJECT ..................................................................11 5.1. View (Interface) Design ................................................................................11 5.1.1 Ajax .........................................................................................................13 5.2. Controller Design ..........................................................................................15 5.3. Model Design .................................................................................................16 6.CONCLUSION ......................................................................................................18 7.BIBLIOGRAPHY ...................................................................................................19 8.APPENDICES .......................................................................................................20
  • 5. 1. INTRODUCTION This application is a part of the land consolidation project which is conducted with the company and relevant ministries and private corporations.This long time continuing project is occured because of the needs in development phase.Briefly , with the land consolidation project it's aimed to gather the farming lands of different people at different places.For this consolidation parcel's hydrologic , physical and similar environmental aspects are analyzed with software and techonolgies.At this analyzing step , the company's support is taken. With the referring "Parcel Case Application" you can make returning and other processes with reference numbers.Such as : given parcel's database recordings , deleting process at database , queries at databes and farming methods applied on the land. When the application is informed to me I was lack of JSF , Primefaces educations and information.Because of that with the responsible engineer researching step has begun. Steps followed during the research and development process is exactly transferred to report. Firstly both theoretically and practical information about the programming language and the architecture which is used is refered.After that the ide and software requirements , concepts about database and database connection's setup is refered. Lastly code development process is refered and with that report ends.
  • 6. 2. USED STRUCTURES , PROGRAMING LANGUAGES Here for understand the application better , information about used language , architecture , framework and structures is explained. Unimportant parts are counted as known already. 2.1. MVC (Model View Controller) MVC (Model View Controller) is a architecture pattern which makes readability and controlling easier, It is used with software engineering. While this architecture pattern enables the classification of the codes also it enables better performance and higher security structures.MVC is preferred at wider and more than one person working projects because It makes the codes easier to understand and change. It has three layers; model, view and controller. 2.1.1. Model: Model is a part where database processing is done. In this part reading,updating,deleting data from database and adding new data to database processes are done.Data acquired from the database is also processed here.It can have only one layer also multiple layers.Also Business Logic and Validation occurs here. It will be mentioned with detail about this layer's design in the project expression part.
  • 7. 2.1.2. View: This is the place where the communication occurs with the system and the user. So it's the part the user sees. All of the static and dynamic variable(html,css,javasicript etc...) of the interface which returns to user is here. User gets his/her request and transfer it to controller. Changes in the design can only occur here because MVC architecture design enables to spare of the application's main part and the interface. In our project It is designed with .html extension. 2.1.3. Controller: This part enables communication between view and the model. This is the layer where the interaction from the user at interface is evaluated , sending request to server and after the process at the model informs a response. Also the methods which will run is decided here , by creating objects to variables; flow of the work is provided. As mentioned before this architecture design is more functional for wider projects. With this structure different software developers with different thinking of algorithmic can work together. This and this kind of architecture designs occurs for making the loss of time, source and working lesser. Also these designs forces to achieve a standard in software so project's continuity can move forward. We can call MVC the most preferred one along with the all designs.Like in our project It can be effectively used with jsp,php,asp.net not only with jsf. 2.2. JSF (Java Server Faces) For making java based applications' development easier It's a developed framework proper to MVC architecture.JSF can develop web applications with Its own standard framework. Also there are open-source libraries which are proper to JSF standards; PrimeFaces, RichFaces, Ajax4JSF, MyFaces etc.The main difference between JSF and Its older technology JSP(Java Server Pages) is; JSF is more suitable to MVC model, Ajax integration is easier and supports third party libraries. Despite to JSP's script base JSF is component based.JSF provides event driven framework which means ; with an interaction a method works.(For an example:
  • 8. Mouse click , keyboard button click etc.).Developing web applications can be shown in different clients(For an example: HTML browsers,Wireless,WAP,mobile etc.) *In our project we used PrimeFaces' libraries instead of JSF's libaries.The main reason is; In PrimeFaces lots of component is prepared and composite components are easier to use. 2.3. Primefaces PrimeFaces is developed by a Turkish company "Prime Teknoloji".It's an open source framework.It is preferred in the project because of having lots of components , can work with any platform.Another reason is; from the support forums you can contact directly to Its developers.With enabling fast and productive interface developing , this technology saves the user from details like html, css, javascript so making you to concentrate on the core of the work. On the web site of the product you can try and use all of Its components. By this way PrimeFaces is popular in software developer forums.Also supporting Ajax is another reason makes PrimeFaces essential. In the project Version3.5 is used. With altering Its components It is prepared to suit to project.
  • 9. 3. FORMING THE PROJECT In this part base information like; how to create an empty project in Netbeans which we will use in our project , how to add PrimeFaces library , how to create interface to develop our project will be explained. After that progress in the project will be explained step by step. In this part simple information is explained like; how to create JSF project which we use in our project, how to add PrimeFaces library in to project. As for Ide Netbeans 7.3 version is taken as a basis. Eclipse and other users also can progress with similar steps and create a project. Firstly It must be assured that JDK(Java Development Kit) is installed on the operating system.For this on the Windows operating systems; Firstly Windows+R shortcut is used after that work cmd code on the screen lastly within the black screen type javac and press enter.If similiar screenshot is acquired like given below it can be continued with the next steps.If not it can be download due to Windows operating system and after that altering path options it can be continued with the next steps.However on the Linux operating system with easier packet installing commands like sudo apt-get install , it can be installed as needed. *Path options given with screenshots on the next page.
  • 10. Right-click to Computer  Settings  Advanced System Options  Advance  Environment Variables  New; We assign the bin folder of the java file which is downloaded to variable value. After Netbeans is opened , respectively choose File->New Project.On the screen that shows up; at "Categories" part choose "Java Web" and from "Projects" part choose "Web Application" and press "Next" button.On the next screen that shows up enter the project name and decide the files' save location. Again after clicking "Next" button you have to choose a proper server for the Web Application to create and indicate Javaee(enterprise edition)version in this screen. In this project Glassfish 3.1.2 is preferred but also like Tomcat, etc. can be preferred.At this screen by clicking "Finish" button can create a project and with "Next" can move to framework adding screen.In the project by clicking "Next" Java Server Faces framework has been added to project.After choosing Java Server Faces at the bottom part, from the active menu; from "Components" tab PrimeFaces can be added which comes with Netbeans or with other way; By right clicking "Libraries" folder after that clicking "Add jar files" can add jar files which received from the PrimeFaces' official web-site so by this way same process can be made.(Relevant screenshot is on the next page due to technical reasons)
  • 11. By clicking "Finish" button for the last time , It creates empty project which will be develpoed with PrimeFaces while using JSF.For getting through the Turkish character problem; "Right" click to project , "Properties" and from here change the "Encoding" section to "UTF-8" which locates on the bottom of the screen. After completing base steps for creating a project , can be moved to interface designing part.
  • 12. 4. RELATED CONCEPTS OF DATABASE There are lots of process related to database because of application's base is; questioning the farming parcel in the system which is given with its' reference number by this way finding it's farming method and returning it. Because of that database must be used effectively.How to use Persistence and entity concepts which are used for making the process easier which includes Netbeans and lots of software developing platform and ide's database will be explained, and orm(object relational mapping), jpa(java persistence api) concepts will be also explained. It will be assumed that database's drivers is introduced to ide and database is ready for use. *Postgre sql is used as database with the project which is mentioned in the report. 4.1. ORM (Object Relational Mapping) Concepts is based on , programming language which is used as base language and processing in database. It's primitive status can be assumed as persistence storage. Also this technology is preferred because of searching and bringing query without discarding the list and such positive sides without needing sql questioning. 4.1.1. Mapping: Identifying an object in the application response to object which is created in the database, is called mapping. Mapping process are mostly done with using metadata. For Hibernate tool, annotation based metadatas are used. For an example from the parcel case project;
  • 13. keywords which starts with @ in the ParselDurumService class are hibernate annotations. “public class ParselDurumService { @Inject private TarimparselleriService parselService; @PersistenceContext(unitName = "ParselEslestirPU") private EntityManager em; …}” While doing mapping; classed with table, properties with colon, relations with foreign keys, primitive types with sql types are matched. 4.2. JPA (Java Persistence Api) JPA (Java Persistence Api) is one of the ORM (Object Relational Mapping) Api.JPA is a standard which is created by gathering the best sides of the persistence processing libraries in Java programming language.JPA is a technology mostly making the code developers draw away from the database process and focus on business logic. Without striving SQL , with the help of JPA database communication can be provided with classes and objects. One of the important concepts in JPA is "entity". Entities are the objects which Provides communication with database and the software . 4.3. Persistence Unit Java class (entity class) with the same name with database is occurs when Persistence unit is added to the project.This java class includes information of the database table which will be used with database.Database process which will be done will be done with the entity class without directly communicating with database. “…import javax.persistence.Basic; import javax.persistence.Column;
  • 14. import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table;…” By right-clicking "Source Files" folder of the project respectively; NewBy selecting Persistence Unit, give a name to Persistence unit in the upcoming screen. Select the latest version of JPA in the provider sections. Data SourceBy clicking New Source and giving a name to connection, Selecting proper driver to server from "Database Connection" part, OKBy clicking Finish connection is provided. 4.4. Entity Entity is a permanent object in the database which is done by using JPA (Java Persistence API).For calling an object entity; that object must be noted as @Entity from the class which is also created from that object. Same situation is in the ParselDurumDO public class of the application. After connecting to server, creating an entity for which table after database selection is determined. Right click is done to "Source File" folder, by clicking NewEntity Classes From Database, selecting the identified connection from the data source section of the upcoming screen is done.From the left part desired table is selected and added to right place by pressing "Add" button.When clicked to NextFinish entity is finally created.
  • 15. 5. DEVELOPİNG OF THE PROJECT AND DESİGN 5.1. View (Interface) Design Html,jsf,PrimeFaces and ajax technologies are used in the designing the interface phase of the "Parsel Durum Uygulaması" project. Interface is the screen as known as interaction between user and the program is occurred, in a word; choosing the questioning process by giving the parcel's reference number. When JSF projects is created, under the "Web Pages" folder; "index.xhtml" file's existence is automatically founded.Process is done on the same extension folder where the project's interface is designed. All the components which are used here are the PrimeFaces technology's components. Statements which will be inside of the "<html"tag on the top of the existing "index.xhtml" file when the "Web Application" project is created are like on the given screenshot here. This html tag is trying to tell; Html tags which are using as default will have "h:" statement on their head(start).These front tags' reason will make sense in the upcoming places of the report when the codes for the PrimeFaces are added. Code blog which needed to insert for using PrimeFaces components are as given below. For using PrimeFaces components "p:" front tags must be exists like html tags which are used as default must have "h:" at their head(start).This code blog explains
  • 16. that; more than one graphic library can be used in a page or any desired front tags can be appointed. The main reason of these front tags are; beside making an order, ending the confusion of the components with same tag which belongs to different libraries. In this part of the report; How to use some of the PrimeFaces components will be shown and explained after that will move to other layer designs of the architecture. Unfortunately not all of the codes are given of this part of project which is conducted by both Ministry and the Company but still will try to explain it with examples. “<p:commandButton value=’Search’ update=’process- button’onclick=’cd.hide()’ action=’#{parselDurumService.saveData()}’/>” This component has lots of input and output parameters. In the report only the parameters which are used in the project will be given. Update: In this component there is an unused "id" parameter and this parameter is used as references which belongs to component in the form. And this update command is after component's "onclick" or if it has "action" command works, will tell which components in the form with which references will be update. Value: This parameter indicated which text will be shown on the button. As you can write a constant value here , another variable from the MVC (Model View Controller) architecture's controller layer can be call. Onclick: Indicated as function which will be called after the situation occurs on this component (If necessary function from the controller layer can be called).There are options such as Onkeydown, onkeypress, onstart etc. Action: When any of the other parameters work this command works. In a word let's say; both "onclick" and "onkeypress" parameters are used in a component and there is also "action" parameter. Such a situation like this when the button is pressed both "onkeypress" and "action" commands will work. So "onclick" condition will not be waited for "action" event to occur. This command also have differences
  • 17. due to taken parameter. Starting with "#" and class function "{ }" are written inside. So this means this isn't a JavaScript code and you must go to this function in the class. Here occurs a communication between the controller layer. When inputMask is examined for an another component; “<p:inputMask id="reference" required="true" value="#{parselDurumService.reference}" mask="999999999" requiredMessage="'ReferenceNumber Alanı Boş Bırakılamaz!"/>” Mask: The only difference of the Mask component to another PrimeFaces component "input Text" is; It has an aim of use. “999999999” value which is entered to parameter, the reference number which will be going to enter here must be a number and this number must be nine digit. There is no way to enter a character here. If a letter or special character enters here It is impossible to sense it. If we come to aim of use of this component; move options from the "controller"'s layer to "value" value. The important point here is; variable or an object or again a parameter which is appointed by object type to a value must be same type, which is sent to controller layer. 5.1.1. Ajax: Ajax cannot be think as a parameter but because of It's a method which is referenced with interface design phase, in the describing state it's in this under title. It is used with "p:" front tag and It is a component take from PrimeFaces' Library. Functions are assigned from "controller" layer to more than one parameter in the View layer. As seen in the given addition; In the ".html" extension file (.js extension
  • 18. files are not given due to company policy.) ".js" extension files are imported. By using JavaScript and XMLhttpRequest, Ajax (Asynchronous JavaScript and XML) is a web programming technique which creates interactive web applications. By small data change with server, It enables fast updating speed for the pages. It uses; for forming the information XHTML, HTML, CSS; For providing the dynamic JavaScript, ECMAScript, For interaction of the server XMLhpptRequest objects, IFrame etc. technologies are used. “</p:dataTable>” Selection: It is a created parameter which adds one apiece checkbox to lines. This parameter used for indicating chosen lines which are transferred to variable. RowKey: For assigning variable names which will be used in the "Datatable" areas. RowIndexVar: This parameter used as indicating variable names which line indexes are going to assign. SelectionMode: With this parameter; creating a checkbox for every line which is included in "dataable" and provided selecting more than one lines by giving "multiple" value to this parameter. In this project "single" value will be enough because chosen line will be transferred to "OrderList" and after that It will be deleted
  • 19. from the "dataTable". If parameter value is "single" It would make a delay for the process if it's multiple because of that multiple option is activated. If components are placed as required, It would be seen as the given screenshot of the application in the addition (Screenshot is given with more detail in the CD). 5.2. Controller Design In this part; commands which are assigned from user to view (interface) layer communicating with the model layer and after having processed, how processed value is again returned to view will be explained. Not all of the code blocks in the controller layer will be processed, only the parts which will help to understand project's base logic will be explained. Project's name mentioned "Controller" layer name is "ParselDurumService". This layer is the controller part which mentions many times of data interchange while view design is explaining. After object is given to entity manager, functions is called and the necessary processes are done. “ public void create(ParselDurumDO entity) { try { if (entity.getDurum().equals(ParselDurum.PARSEL_SULU_ALAN.toString())) { parselService.setSuluAlan(entity.getParselId().intValue()); } else if (entity.getDurum().equals(ParselDurum.PARSEL_KURU_ALAN.toString())) { parselService.setKuruAlan(entity.getParselId().intValue()); } em.persist(entity); em.flush(); } catch (Exception ex) {
  • 20. throw new EJBException(ex); } }” "Start" button in the application is an approval button. So if the land information which is entered from user doesn't exist, a reference point will be given and saved to database. While in this saving process; watery farming, dry farming difference will be seen. With the first "if" condition; controlling watery area option for the parcel; on the second condition it will control for the dry farming area. “…public void edit(ParselDurumDO entity) { try { em.merge(entity); } catch (Exception ex) { throw new EJBException(ex); } }…” On the upper part explaining a function which is equalled to "create" function, with this function some options of the farming parcel is updated which is created before and saved to database. If we examine the “ParselDurumService.java” folder; with "public void remove" function parcel will be deleted, with "public ParsemDurumDO find" function there will be search with the parcel's reference number, with "public void remove All" function all of the parcel information will deleted; can be seen. 5.3. Model Design Controller layer and how does it work is tried to explained with its' basic form. Lastly will mention to the model part and will move to conclusion in the report. All of the examples given are override methods and firstly attention must be paid to that. “…@Override public int hashCode() { int hash = 0; hash += (recId != null ? recId.hashCode() : 0);
  • 21. return hash; }…” If the object's record id (recid) is null are not is controlled in the first function. If it's null; hashCode function is called and moved to hash and returns it. If it is null returns zero. “... @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof ParselDurumDO)) { return false; } ParselDurumDO other = (ParselDurumDO) object; if ((this.recId == null && other.recId != null) || (this.recId != null && !this.recId.equals(other.recId))) { return false; } return true; }…” In this function equals function is overridden. Controlling if the objects are same or not. With "instanceof" command checking if the received object is derived from the ParselDurumDO object. If it's not a derived object "false" returns. After that "other" named ParselDurumDO object is created as null and compared with the received object. If the received object is null "false" returns. If none of the condition are ensured "true" returns. “… @Override public String toString() { return "lnr.parsel.eslestir.entity.ParselDurumDO[ recId=" + recId + " ]"; } }…” In this function "toString" overridden. Because of it's an obj.toString, object's class address is given.
  • 22. 6. CONCLUSION During the report what is MVC (Model, View , Controller), this architecture pattern's properties, what advantages does it provides, how to perform, what easiness does PrimeFaces' provides, how to add components, how to create JSF (java server faces) project on the Netbeans ide is explained by step by step, examples given for making it easier to understand."Parsel Durum Uygulaması" is also explained. During summer internship the most important thing I believe that I will use it, see the advantages of it in the future is MVC architecture's structure. Oracle ADF and PrimeFaces (Product of a Turkish Company) which are proper to MVC are the other positive sides that I have learned. However other architectures become widespread; these architecture effects are undeniably important on the bigger projects working with groups of software developers. Even though "Parsel Durum Uygulaması" project report is a guide for how to use ; MVC architecture, JSF programming language and PrimeFaces framework; without practicing on the project they are impossible to comprehend. Summer internship started with researching for MVC architecture and continued with working with Oracle adf. Because of some technical failures working with Oracle adf is stopped; After needing an application on the company's "Land Consolidation" project, started working on "Parsel Durum Uygulaması". Although there is no lack in the usage of the project; can be worked more on the interface. Because of the company's policy and official corporations, ministry and private company conducted part of the mutual project; working copy of the application or all of the source codes are not given but still the digital copy of the report will be given which will be enough to understand the architecture.
  • 23. 7. BIBLIOGRAPHY o PrimeFaces components; http://www.primefaces.org/showcase/ui/home.jsf o http://forum.primefaces.org/ o http://www.tutorialspoint.com/jsf/ o http://stackoverflow.com/ o http://tr.wikipedia.org/ o https://developer.chrome.com/home o http://hibernate.org/ o https://javaserverfaces.java.net/ o https://netbeans.org/ For the images; o http://tr.wikipedia.org/ o http://project67555.appspot.com/
  • 24. 8. APPENDICES CD which will be given with the report includes digital copy of the report also; screenshots, some parts of the codes will be included. Due to company policy all of the codes are not given. Other addition information are given in the report for not breaking the expression structure of the report.