FACULTY OF SCIENCE, PHYSICAL EDUCATION AND INFORMATICS DOMAIN OF DISSERTATION : ADVANCED TECHNIQUES FOR INFORMATION PROCESSING LUCRARE DE DISERTA ȚIE… [631470]
UNIVERSITY OF PITEȘTI
FACULTY OF SCIENCE, PHYSICAL EDUCATION AND INFORMATICS
DOMAIN OF DISSERTATION : ADVANCED TECHNIQUES FOR INFORMATION PROCESSING
LUCRARE DE DISERTA ȚIE
Coordi nator:
Lect. univ. dr . Doru C ONSTANTIN
Student: [anonimizat]
2018
UNIVERSITY OF PITEȘTI
FACULTY OF SCIENCE, PHYSICAL EDUCATION AND INFORMATICS
DOMAIN OF DISSERTATION: ADVANCED TECHNIQUES FOR INFORMATION PROCESSING
Angular application with RESTful web
services for the management of a cars
factory. Comparative study of RESTful web
services and SOAP web services
Coordi nator:
Lect. univ. dr . Doru CONSTANTIN
Student: [anonimizat],2018
Chapter 1
Oracle Database
1.1 Relational Databases
A database is an organized collection of data, stored and accessed electronically . Data is
organized into rows, columns and tables, and it is indexed to make it easier to find relevant
infor mation. Data gets updated, expanded and deleted as new information is added. Databases
process workloads to create and update themselves, querying the data they contain and running
applications against it.
A relational database is a collective set of mult iple data sets organized by tables, records
and columns. Relational databases determine a well -defined relationship between database
tables. Tables communicate and share information, which facilitates data searchability,
organization and reporting.
Relational databases use Structured Query Language (SQL), which is a standard user
application that offer an easy programming interface for database interaction.
Relational databases is derived from the mathematical function concept of mapping data
sets and was developed by Edgar F. Codd. [1]
Relational databases organize data in different ways. Each table is known as a relation,
which have one or more data category columns. Each table record (or row) contains a unique
data instance defined for a corre sponding column category. One or more data or record
characteristics associate to one or many records to form functional dependencies. These are
classified as follows:
One to One: One table record associate s to another record in another table;
One to Many: One table record associates to many records in another table;
Many to One: More than one table record associates to another table record;
Many to Many: More than one table record associates to more t han one record in another
table;
Relational databases execute "select", "project" and "join" database operations, where
select is used for brings data , project identifies data attributes, and join combines tables .
Relational databases have many other advantages, including:
Easy extendability, new data will be added without modifying existing records. Th is is
known as scalability;
Technology performance, power and flexibility with multipl e data requirement
capabilities;
Data security, which is important when data shari ng is based on privacy;
1.2 Database Management System (DBMS)
A database management system (DBMS) is software that manage the storage,
organization, and retrieval of data. Typically, a DBMS has the following elements:
Kernel code;
This code manages memory and storage for the DBMS.
Repository of metadata ;
This repository is usually called a data dictionary.
Query language ;
This language enables applications to access and manipulate the data.
A database application is a software program that work with a database to access and manipulate
data. [1]
The first generation of database management systems included the following types:
Hierarchical A hierarchical database manage data in a tree structure. Each parent
record has one or more child records, similar to the structure of a file system; [1]
Network A network database is like a hierarchical database, except records have
a many -to-many rather than a one -to-many relations hip. The preceding database
management systems stored data in rigid, predetermined relationships. Because
no data definition language existed, changing the structure of the data was
difficult. Also, these systems lacked a simple query language, which hinde red
application development ;[1]
The preceding database management systems stored data in rigid, predetermined
relationships. Because no data definition language existed, changing the structure of the data was
difficult. Also, these systems lacked a simpl e query language, which hindered application
development.
1.3 Relational Database Management System (RDBMS)
The relational model is the base for a relational database management system (RDBMS).
RDBMS moves data into a database, stores the data, and retrieves it so that it can be manipulated
by applications.
RDBMS types of operations:
Logical operations
An application specifies what content is required. For example, an application request s an
person firstname or add a person record to a table;
Physical operations
An application q ueries a table, the database will use an index to retrieve the requested
rows, read t he data into memory, and execute many other steps before returning a result
to the user. The RDBMS stores and retrieves data so that physical operations are
transparent to database applications.
1.4 D ata Access
A general requirement for a DBMS is to adhere to accepted industry standards for a data
access language.
1.4.1 Structured Query Language (SQL)
SQL is a set -based declarative language that offer an interface to an RDBMS such as
Oracle Database. Users specify the result that they want (for example, the names of current
person ), not how to derive it. SQL is the ANSI standard language for relational databases. [2]
SQL statements are used for performing different operati ons on the data.
SELECT name, age FROM person ;
SQL statements allow you t o perform the following tasks:
Query data
Insert, upda te, and delete rows in a table
Create, replace, alter, and d rop objects
Control access to the database and its objec ts
Guarantee database consistency and integrity
SQL unifies the preceding tasks in one consistent language .Oracle SQL is an implementation of
the ANSI standard.
1.4.2 PL/SQL
PL/SQL is an extension to Oracle SQL. PL/SQL is integrate d with Oracle Database,
allowing you to use all of the Oracle Database SQL statements, functio ns, and data types.
PL/SQL can be used to control the flow of a SQL program, use variables, and write error –
handling procedures.
A key benefit of PL/SQL is the ability to store application logic in the database itself. A
PL/SQL procedure or function is a schema object that consists of a set of SQL statements and
other PL/SQL constructs, grouped together, stored in the database, and run as a unit to solve a
specif ic problem or to execute a set of tasks . [2]
Oracle Database can store program units written in Java. A Java stored procedure is a
Java method published to SQL and stored in the database for general use. You can call existing
PL/SQL programs from Java and Java programs from PL/SQL.
1.5 Oracle Data Types
All the values that is manipulated by Oracle Database has a data type. The data type of a
value associates a fixed set of properties with the value. Using these properties Oracle treats
values of one data type differently from values of another. For example, you can a dd values of
NUMBER data type, but not values of CHAR data type. [1]
Oracle Database provides a number of built -in data types as well as several categories for
user-defined types that can be used as data types.
Oracle data types:
VARCHAR2(size [BYTE | CH AR]) – Variable -length character string ;
NVARCHAR2(SIZE) – Variable -length Unicode character string having maximum size
characters ;
NUMBER [(p[,s])] – Number having precision p and scale s ;
FLOAT [(p)] – A FLOT value is represented internally as NUMBER range of p: From 1
to 126 binary digits;
LONG – Character data of variable length up to 2 gigabytes, used for backward
compatibility ;
DATE – Valid date range : From January 1, 4712 BC, to December 31, 9999 AD ;
CHAR [(size [BYTE | CHAR])] – Fixed -length character data of length size bytes or
character s;
NCHAR[(size)] – Fixed -length character data of length size characters. The number of
bytes can be up to two times size for AL16UTF16 encoding and three times size for
UTF8 encoding.
BLOB – A binary larg e object.
1.6 Oracle Constraints
A constraint clause is an option of a “CREATE TABLE” statement or “ALTER TABLE”
statement . A constraint is a rule that allow you to control the data in your table.
Types of constraints :
a column constraint
A column constraints report to a single column in the table;
a table constraint
Table constraints report to one or more c olumns in the table . Table check
constraints can refer to one or more columns in the table. [1]
Column constraints are :
NOT NULL
Column do not allow NULL values
PRIMARY KEY
Refer to c olumn that uniquely identifies a row in the table. The identified columns
must be defined as NOT NULL.
If a table is alterated to add a primary key to a column and the column contains
null values, an error wil l be occoured and the constraint not be added .
UNIQUE
Mark that all the values in the column must be unique.
FOREIGN KEY
The values in the column must correspond to values in a referenced primary key
or unique key column or that they are NULL.
CHECK
Add rules for values in the column.
Table constraints include:
PRIMARY KEY
Specifies the column or columns that uniquely identify a row in the table. NULL
values are not allowed.
UNIQUE
Specifies that values in the columns must be unique.
FOREIGN KEY
Specifies that the values in the columns must correspond to values in referenced
primary key or unique columns or that they are NULL.
If the foreign key consists of multiple columns, and any column is NULL, the
whole key is considered NULL. The insert is permitted no matter what is on the non -null
columns.
CHECK
Specifies a wide range of rules for values in the table.
Primary key constraints
A primary key refer to the set of columns that uniquely identifies rows in a table.
If you create a primary key constraint, none of the columns included in the primary key
allow NULL value ;
The statement ALTER TABLE ADD PRIMARY KEY allows you to include existing
columns in a primary key if they we re first defined as NOT NULL . If the columns contain
NULL values, the system will not add the primary key constraint.
A table can have only one PRIMARY KEY constraint.
Unique constraints
A UNIQUE constraint defines a set of columns that uniquely identify rows in a table only
if all the ke y values are not NULL. If one or more key parts are NULL, duplicate keys are
allowed.
For example, if there is a UNIQUE constraint on col1 and col2 of a table, the
combination of the values held by col1 and col2 will be unique as long as these values are not
NULL. If one of col1 and col2 have a NULL value, there can be another identical row in the
table.
A table can have one or more UNIQUE constraints.
Foreign key constraints
Foreign keys offer a way to impose the referential integrity of a database. A foreign key
is a column or group of columns in a table tha t references a key in other table . The foreign key
should always contains the columns of which the types exactly match those in the referenced
primary key or unique constraint. [1]
A foreign key constraint is satisfied if there is a matching value in the referenced unique
or primary key column. If the foreign key consists of multiple columns, the foreign key value is
considered NULL if any of its columns co ntains a NULL. [1]
Chapter 2
Description of the technologies used
2.1 JBoss Developer Studio
JBoss Developer Studio is a development environment created and currently developed
by JBoss (a division of Red Hat) . It integrates and certifies both tooling and runtime components
by combining Eclipse , Eclipse Tooling, and the JBoss Enterprise Application Platform . JBoss
Developer Studio includes many technologies like : Java Enterprise Edition 7, JavaScript and
Node.js, JavaServer Faces (JSF), Enterprise JavaBeans (EJB), Java Persistence API (JPA) and
Hibernate, JAX -RS with RESTEasy , HTML.
Fig. 2.1.1 Jboss Developer Studio
2.2 Java Program ming Language
Java is an innovative technology launched by Sun Microsystems in 1995, which has had
a remarkable impact on the entire community of software developers, requiring special qualities
such as simplicity, robustness and last but not least portability. Original ly called OAK, Java
technology is comprised of a high -level programming language that builds a series of platforms
for application deployment across of all segme nts of the software industry. [3 ]
Java language contains two types of variables:
• Primitive
• References (objects)
2.2.1 Types of primitive data
There are eight primitive data types in Java.
Integer primitives :
• Byte – 8 bit, with sign (Minimum value -128, Maximum value 127)
• Short – 16 bit, with sign (Minimum value -32768, Maximum value 32767)
• Int -32 bit, with sign (Minimum value -2147483648, Maximum value 2147483647)
• Long -64 bit, with sign (Minimum value -9223372036854775808,
Maximum value 9223372036854775807)
• Char – 16 bit, no sign (Unicode 16 -bit character)
Real Data Types :
• Float – 32 bit, floating -point type, simple precision
• Double -64 bit, floating -point type, double precision
Logical Type
• Boolean – boolean data type, true and false values
There are approximately 50 keywords in Java. These can not be u sed as variable name (Fig
2.2.1.1)
Fig 2.2.1.1 Keywords
2.2.2 Classes
Classes are user -defined reference types. A class can inherit a single class and can
implement multiple interfaces.
Classes can contain constants, fields, methods, properties, events, indexers, operators,
instantiators, destructors, class builders. Each member can contain a level of access that controls
access.
Access modifiers for members of a class are:
• public – can be accessed from any class
• protected – can be accessed only from the class of which it belongs and from the derived classes
• private – limited access to the class
The access modifiers of a class are:
• public – public classes are accessible from anywhere
• protected – can be used for internal classes (defined types are available only in current class and
in derived classes.
• private – limited access to the content class
• abstract – is used to define a class that is incompletely defined and can not be instantiated
2.4 Hibernate
Hibernate ORM (Hibernate in Short) is an object -relational mapping tool for the Java
programming language. It provides a framework for mapping an object -oriented domain model
to a relational database. Hibernate handles object -relational impedance mismatc h problems by
replacing direct, persistent database accesses with high -level object handling functions.
Hibernate not only takes care of the mapping from Java classes to database tables (and from Java
data types to SQL data types), but also provides data q uery and retrieval facilities. [4]
2.5 Java Persistence API (JPA)
Java Persistence API is a collection of classes and methods to persistently store the vast
amounts of data into a database.
Mapping Java objects to database tables and vice versa is called Object -relational
mapping (ORM). The Java Persistence API (JPA) is one possible approach to ORM. Via JPA the
developer can map, store, update and retrieve data from relational databases to Java objects and
vice versa. JPA can be used in Java -EE and Java-SE applications.
JPA is a specification and several implementations are available. Popular implementations
are Hibernate, EclipseLink and Apache OpenJPA. The reference implementation of JPA is
EclipseLink.
JPA permits the developer to work directly with objects rather than with SQL statements.
The JPA implementation is typically called persistence provider.
The mapping between Java objects and database tables is defined via persistence
metadata. The JPA provider will use the persistence metadata inf ormation to perform the correct
database operations.
JPA metadata is typically defined via annotations in the Java class. Alternatively, the metadata
can be defined via XML or a combination of both. A XML configuration overwrites the
annotations.
Entity
A class that should be persisted in a database must be annotated with
javax.persistence.Entity. Such a class is called Entity. JPA uses a database table for each entity.
Persisted instances of the class will be represented as one row in the table.
All e ntity classes must define a primary key, must have a non -arg constructor and or not allowed
to be final. Keys can be a single field or a combination of fields.
JPA allows you to auto -generate the primary key in the database via the @GeneratedValue
annotat ion.
By default, the table name corresponds to the class name. You can change this with the addition
to the annotation @Table (name = "NEWTABLENAME").
Persistence of fields
The fields of the Entity will be saved in the database. JPA can use either your instance
variables (fields) or the corresponding getters and setters to access the fields. You are not
allowed to mix both methods. If you want to use the setter and getter met hods, the Java class
must follow the Java Bean naming conventions. JPA persists for all fields of an Entity, if fields
should not be saved they must be marked with @Transient.
By default, each field is mapped to a column with the name of the field. You ca n change the
default name via @Column (name = "newColumnName").
Field annotations:
@Id -Identifies the unique ID of the database entry
@GeneratedValue -Together with an ID this annotation defines that this value is generated
automatically.
@Transi ent – Field will not be saved in the database
Relationship Mapping
JPA allows you to create relationships between classes, e.g. it can be defined that a class
is part of another class (containment). Classes can have one to one, one to many, many to one,
and ma ny to many relationships with other classes.
A relationship can be bidirectional or unidirectional, e.g. in a bidirectional relationship both
classes store and reference to each other while in a unidirectional case only one class has a
reference to the ot her class. Within a bidirectional relationship, you must specify the owning side
of this relationship in the other class with the attribute "mappedBy", e.g. @ManyToMany
(mappedBy = "attributeOfTheOwningClass".
Relationship annotations:
@OneToOne – Define s a single -valued association to another entity that has one -to-one
multiplicity.
@OneToMany – Defines a many -valued association with one -to-many multiplicity.
@ManyToOne – Defines a single -valued association to another entity class that has many -to-one
multiplicity.
@ManyToMany – Defines a many -valued association with many -to-many multiplicity.
Entity Manager
The entity manager javax.persistence.EntityManager provides the operations from and to
the database, e.g. find objects, persist them, remove objects from the database, etc.
In a JavaEE application, the entity manager is automatically inserted into the web application.
Outside JavaEE you need to manage your entity manager yourself.
Entities that are managed by an Entity Manager w ill automatically propagate these changes to
the database (if this happens within a commit statement). If the Entity Manager is closed (via
close ()) then the managed entities are in a detached state. If you synchronize them again with the
database and Ent ity Manager provides the merge () method.
The persistence context describes all Entities of one Entity manager.
Persistence units
The EntityManager is created by the EntityManagerFactory which is configured by the
persistence unit. The persistence unit is described through the persistence.xml file in the META –
INF directory of the source folder. A set of entities that are logically connected will be grouped
through a persistence unit. The persistence.xml file defines the connection data to the database,
e.g. the driver, the user and the password.
2.6 RESTful Services
REST web services (Representational state transfer) or RESTful Web Services allow the
interconnection of computer systems based on web standards. The main features of a REST
service are:
Has a URI based on which it can be uniquely identified and accessed.
A resource can be represented in multiple media (media type). It includes
mechanisms that allow the client and server to "negotiate" the type of information are
going to be changed.
Uses standard HTTP methods to expose the services offered:
GET: Getting the resource
POST: create resource
PUT: update resource
DELETE: Delete the resource
The customer -service interaction is stateless.
There are mechanisms (URI rewriting, cookies, and hidden form fields) that allow
stateful conversations.
JAX-RS is a Java programming language API designed to make it easy to develop applications
that use the REST architecture.
JAX-RS (the RESTf Java API service) allows the definition of REST services starting with Java
POJO classes annotated with specific annotations.
The JAX -RS API uses Java programming language annotations to simplify the development of
RESTful web services. Developers decorat e Java programming language class files with JAX –
RS annotations to define resources and the actions that can be performed on those resources.
JAX-RS annotations are runtime annotations; therefore, runtime reflection will generate
the helper classes and artifacts for the resource. A Java EE application archive containing JAX –
RS resource classes will have the resources configured, the helper classes and artifacts generated,
and the resource exposed to clients by deploying the archive to a Java EE server.
JAX-RS Annotations
@Path – is a relative URI path indicating where the Java class will be hosted ;
@GET – the Java method annotated with this request method designator will process HTTP
GET requests.
@POST – The Java method annotated with this request meth od designator will process HTTP
POST requests
@ PUT – The @PUT annotation is a method of identifying a request and corresponds to the
similarly named HTTP method. The Java method annotated with this request method will
process HTTP PUT requests. The behavi or of a resource is determined by the HTTP method the
resource responds to.
@ DELETE – is a method of identifying the request and corresponds to the similarly designed
HTTP method. The Java method annotated with this request method will process the HTTP
DELETE requests. The behavior of a resource is determined by the HTTP method the resource
responds to.
@HEAD – is a method of identifying a request and corresponds to the similarly named HTTP
method. The Java method annotated with this request method designa tor will process the HTTP
HTTP requests. The behavior of a resource is determined by the HTTP method the resource
responds to.
@PathParam – is a type of parameter that you can extract for use in the resource class. URI
route parameters are extracted from the URI request and the parameter names match the URI
path template variable names specified in the @Path class annotation.
@QueryParam – is a type of parameter that you can extract for use in the resource class. Query
parameters are extracted from the que ry URI query parameters.
@Consumes – is used to specify the MIME media types of representations that a resource can
consume that were sent by the client.
@Produces – is used to specify the MIME support types of representations a resource can
produce and s end back to the client: for example, "text / plain".
@Provider – is used for anything that is of interest for JAX -RS execution time, such as
MessageBodyReader and MessageBodyWriter. For HTTP requests, MessageBodyReader is used
to make a set of HTTP entitie s to the method parameters. In the response, a return value is
mapped to an HTTP response entity entity using a MessageBodyWriter. If the application needs
to provide additional metadata, such as HTTP headers or another status code, a method can
return a r esponse that scatters the entity and can be built using Response.ResponseBuilder.
2.7 JBoss EAP Server
An application server is software that offer an environment to run web applications. Most
app servers also provide functionality to web applications running in their environment through a
set of APIs. For example, an app server can provide an API for connecting to a database.
Java EE (Java Platform , Enterprise Edition) is a standards -based enterprise platform that
provides both an API and runtime environment for running and developing Java applications.
The goal is to improve developer productivity by providing rich enterprise capabilities in easy t o
consume frameworks that eliminate boilerplate and reduce technical burden. The frameworks
that compose Java EE are heavily tested in combination.
Red Hat JBoss E nterprise Application Platform (JBoss EAP ) is a middleware platform
built on open standards and compliant wi th the Java Enterprise Edition specification. It
integ rates JBoss Application Server with high -availability clustering, messaging, distributed
caching, and other technologies.
JBoss EAP includes a new, modular structure that al lows service enabling only when required,
improving start -up speed.
Copyright Notice
© Licențiada.org respectă drepturile de proprietate intelectuală și așteaptă ca toți utilizatorii să facă același lucru. Dacă consideri că un conținut de pe site încalcă drepturile tale de autor, te rugăm să trimiți o notificare DMCA.
Acest articol: FACULTY OF SCIENCE, PHYSICAL EDUCATION AND INFORMATICS DOMAIN OF DISSERTATION : ADVANCED TECHNIQUES FOR INFORMATION PROCESSING LUCRARE DE DISERTA ȚIE… [631470] (ID: 631470)
Dacă considerați că acest conținut vă încalcă drepturile de autor, vă rugăm să depuneți o cerere pe pagina noastră Copyright Takedown.
