You are on page 1of 120

Industrial Project Report

On
“Online Art Gallery” At
Wepanther global limited

Submitted in for the partial fulfillment of the


degree of
Bachelor Of Computer Application
By
Bhaskar kumawat
Student Reg. No. 20BCYN028

We panther

Department of IT & CA
JECRC UNIVERSITY, JAIPUR

Under the Guidance of

Faculty Internship Guide Industry Guide


Name : Krishna kumar sharma Name: Rahul dangi
Designation: Assistant Professor Designation: Hr
Declaration
I hereby declare that the project work entitled “Online art gallery” is an
authentic record of my own work carried out at “Wepanther Global limited” as
requirements of Three months industrial project for the award of degree of
BCA”,
from JECRC University

Signature of student
Name of student
Student reg no.

It is certified that the above statement made by the student is correct to the best
of our knowledge

Signature
Mr. Rahul dangi

1|Page
ACKNOWLEDGEMENT

I have undergone an Industrial Project which was meticulously


planned and guided at every stage so that it became a life time
experience for me. This could not be realized without the help from
numerous sources and people in the WePanther globalsoft. I am very
grateful to Mr. Rahul dangi sir for their kind support and guidance. I
would like to take this opportunity to show my gratitude towards my
professors and the whole department of IT who helped me in
successful completion of my Industrial project. They have been a
guide, motivator & source of inspiration for me to carry out the
necessary proceedings for completing this project and related activities
successfully and grateful for their guidance and support. I am thankful
for their kind support and providing us expertise of the domain to
develop the project. Lastly, I would like to acknowledge the support of
my family and friends who have provided unwavering encouragement
and understanding throughout this endeavor. Thank you all for your
invaluable contribution to this report.

2|Page
Online Art Gallery
TABLE OF CONTENTS

1. INTRODUCTION

2. DESIGN PRINCIPLES & EXPLANATION

2.1. MODULES

2.2. MODULE DESCRIPTIOIN

3. PROJECT DICTIONARY

3.1. DATAFLOW DIAGRAMS

3.2. E-R DIAGRAMS

3.3. DATA DICTIONARY

4. FORMS & REPORTS

4.1. I/O SAMPLES

5. MAIN INDEX

.......................................................................
1 INTRODUCTION
1.1 PROJECT BACKGROUND

1.2 RESEARCH STATUS AT CHINA AND ABROAD


1.3 THE PURPOSE AND SIGNIFICANCE OF THIS PROJECT

1.4 MAIN WORK OF THIS PAPER


1.5 THE STRUCTURE OF THIS PAPER

2 SYSTEM REQUIREMENT ANALYSIS


2.1 FUNCTIONAL REQUIREMENT ANALYSIS
3|Page
2.1.1 Photo sharing subsystem
2.1.2 Photography competition management subsystem

2.2 NON-FUNCTIONAL REQUIREMENT ANALYSIS


2.2.1 Feasibility
2.2.2 Scalability and maintainability

2.2.3 Security

2.2.4 System performance

2.3 USE CASE ANALYSIS FOR THE SYSTEM


2.3.1 Use case analysis of User and Authorization Management module
2.3.2 Use case analysis of Personal Homepage

2.3.3 Use case analysis of Photo Management module

2.3.4 Use case analysis of Album Management module


2.3.5 Use case analysis of Collection Management module

2.3.6 Use case analysis of Competition Management module


2.3.7 Use case analysis for Contribution module
2.3.8 Use case analysis of Review module
2.3.9 Use case analysis of Display of Competition module
2.3.10 Use case analysis of the Display of Competition Result module

2.4 SUMMARY OF THIS CHAPTER

3 SYSTEM DESIGN
3.1 THE OVERALL STRUCTURE OF THE SYSTEM

3.2 MODULE DIVISION AND FUNCTION DESIGN

3.3 THE DETAILED DESIGN OF MAIN FUNCTION MODULES


3.3.1 User and Authorization Management module

3.3.2 Personal Homepage


3.3.3 Photo management module

3.3.4 Album management module


3.3.5 Collection management module
3.3.6 Competition management module
3.3.7 Contribution module

3.3.8 Review module

3.3.9 Display of competition module


4|Page
3.3.10 Display of competition result module
3.4 THE DESIGN OF BACKGROUND SYSTEM

3.4.1 The design of system role and authorization mechanism


3.4.2 Database tree structure
3.4.3 Storage space management subsystem

3.5 DATABASE DESIGN

3.6 SUMMARY OF THIS CHAPTER

4 IMPLEMENTATION OF THE SYSTEM


4.1 COMMON MODULE IMPLEMENTATION
4.1.1 Directory Tree Resource Management Interface

4.1.2 Storage space management subsystem


4.2 IMPLEMENTATION OF THE MAJOR MODULES
4.2.1 Implementation of the User and Authorization Management module

4.2.2 Implementation of the Personal homepage


4.2.3 Implementation of the Photo Management module

4.2.4 Implementation of the Album Management module


4.2.5 Implementation of Collection Management module

4.2.6 Implementation of the Competition Management module

4.2.7 Implementation of the Contribution module


4.2.8 Implementation of the Review module
4.2.9 Implementation of the Display of Competition module

4.2.10 Implementation of the Display of Competition Result module

5 SYSTEM TEST

5.1 RUNNING ENVIRONMENT


5.2 SYSTEM FUNCTION TEST

6 CONCLUSION AND FUTURE WORK


6.1 CONCLUSION
6.2 THE DIRECTION OF FURTHER WORK
6. BIBLIOGRAPHY

5|Page
ABSTRACT

Category:
HTML CSS -Web Application.

Objective:

Online Art Gallery is an online application, which is used to display and


sell art works of artist irrespective of their nationality, gender and other narrow
consideration, through auction.

Purpose of the system:


ONLINE ART GALLERY is a application software and it is very helpful
for the art lovers and others who wants to know the addresses where this kind of
arts will we sold.
This application helps the end-users to search their arts and paintings and
they can place order for the selected pieces. The enduser can also get the
information about the art exhibition and the respective address, so, that they can
visit to those exhibitions.
Art Gallery brings you an opportunity to view online art exhibitions at our
Online Art Gallery we bring you details of all art exhibitions held in the past and
the forthcoming show. The Online Art Gallery is updated daily, so the user can
view and buy the latest collection of contemporary art online from any where in
the world. You can view and buy the latest Indian contemporary art collection
available at their exhibitions and also at their online gallery.
MODULES:

• User Registration
• Art Exhibition
• Artist Directory
• Contact Us

6|Page
ADMIN Modules:
1. Admin Login module.
2. Admin Order Management module.
3. Add Artist information module.
4. Add System user module.
5. Artist Login module.
6. Customer Login Module.
7. Customer Payment Module.
8. Advanced Search module.

HARDWARE AND SOFTWARE SPECIFICATIONS


SOFTWARE REQUIREMENTS:
Operating System : Windows 10
Language : js
Technologies : HTML , CSS
Data Bases : Microsoft Sql Server
IDE : Visual Studio

HARDWARE REQUIREMENTS:
Processor : Any Processor above 500 MHz.
Ram : 128Mb.
Hard Disk : 10 Gb.
Compact Disk : 650 Mb.
Input device : Standard Keyboard and Mouse.
Output device : High Resolution Monitor.

7|Page
1. INTRODUCTION
Online Art Gallery is an online application, which is used to display and sell art
works of artist irrespective of their nationality, gender and other narrow
consideration, through auction. Artist can register online for being a member in
the art gallery and each artist can upload the digital copy of their art work under
the respective categories. They can host their art work either for auction or for
fixed price. The artist is liable to pay a fraction of the price of each art work to
the web site to find the running fund for site. Art lovers have to go to the art
exhibition to collect their favorite arts or painting. But now-a-days they are not
getting enough time to go to the galleries and collect the arts and paintings.
Existing System:
Customer can also register online and they can browse art works that are
arranged in different categories scientifically. Each Customer can create their
own gallery to see his favorite art works with out much difficult. And each user
has the right to purchase an art work using the integrated payment gateway and
participate in auction by submitting their bids. Qualified bidder should remit the
amount using payment gateway and after each valid payment the art work will
be shipped within some days.

Proposed System:
ONLINE ART GALLERY is a application software and it is very helpful
for the art lovers and others who wants to know the addresses where this kind of
arts will we sold.This application helps the end-users to search their arts and
paintings and they can place order for the selected pieces. The end-user can also
get the information about the art exhibition and the respective address, so, that
they can visit to those exhibitions.
Art Gallery brings you an opportunity to view online art exhibitions at our
Online Art Gallery we bring you details of all art exhibitions held in the past and
the forthcoming show. The Online Art Gallery is updated daily, so the user can
view and buy the latest collection of contemporary art online from any where in
the world. You can view and buy the latest Indian contemporary art collection
available at their exhibitions and also at their online gallery.

2. System Analysis
8|Page
After analyzing the requirements of the task to be performed, the next step
is to analyze the problem and understand its context. The first activity in the phase is
studying the existing system and other is to understand the requirements and domain of the
new system. Both the activities are equally important, but the first activity serves as a basis
of giving the functional specifications and then successful design of the proposed system.
Understanding the properties and requirements of a new system is more difficult and
requires creative thinking and understanding of existing running system is also difficult,
improper understanding of present system can lead diversion from solution.

2.1 Analysis Model


The model that is basically being followed is the WATER FALL MODEL,
which states that the phases are organized in a linear order. First of all the feasibility study
is done. Once that part is over the requirement analysis and project planning begins. If
system exists one and modification and addition of new module is needed, analysis of
present system can be used as basic model.
The design starts after the requirement analysis is complete and the coding
begins after the design is complete. Once the programming is completed, the testing is done.
In this model the sequence of activities performed in a software development project are :-

• Requirement
• Analysis
• System design
• Implementation
• Testing
• Maintenance

9|Page
Fig: 2.1 Analysis Model
Problem Definition
Existing System:
Customer can also register online and they can browse art works that are
arranged in different categories scientifically. Each Customer can create their
own gallery to see his favorite art works with out much difficult. And each user
has the right to purchase an art work using the integrated payment gateway and
participate in auction by submitting their bids. Qualified bidder should remit the
amount using payment gateway and after each valid payment the art work will
be shipped within some days.

Proposed System:
ONLINE ART GALLERY is a application software and it is very helpful
for the art lovers and others who wants to know the addresses where this kind of
arts will we sold.This application helps the end-users to search their arts and
paintings and they can place order for the selected pieces. The end-user can also
get the information about the art exhibition and the respective address, so, that
they can visit to those exhibitions.
Art Gallery brings you an opportunity to view online art exhibitions at our
Online Art Gallery we bring you details of all art exhibitions held in the past and
the forthcoming show. The Online Art Gallery is updated daily, so the user can
view and buy the latest collection of contemporary art online from any where in

10 | P a g e
the world. You can view and buy the latest Indian contemporary art collection
available at their exhibitions and also at their online gallery.

Software Requirements Specification


3.1 What is SRS ?
Software Requirements Specification (SRS) is the starting point of the
software developing activity. As system grows more complex it becomes evident
that the goal of the entire system cannot be easily comprehended. Hence the need
for the requirement phase arose. The software project is initiated by the client
needs. The SRS is the means of translating the ideas of the minds of clients (the
input) into a formal document (the output of the requirement phase).
The SRS phase consist of two basic activities:

3.1.1 Problem/Requirement Analysis:


The process is order and more nebulous of the two, deals with understand the problem,
the goal and constraints.

3.1.2 Requirement Specification:


Here, the focus is on specifying what has been found giving analysis such as
representation, specification languages and tools, and checking the specifications are
addressed during this activity.
The requirement phase terminates with the production of the validate SRS document.
Producing the SRS document is the basic of this phase.

3.1.3 Role of SRS:

11 | P a g e
The purpose of the SRS is to reduce the communication gap between the clients and
the developers. SRS is the medium though which the client and user needs are accurately
specified.
It forms the basis of software development. A good SRS should satisfy all the parties
involved in the system.
HARDWARE AND SOFTWARE SPECIFICATIONS
SOFTWARE REQUIREMENTS:
Operating System : Windows 10,11.
Language : Javascript
Technologies : Html , CSS
Data Bases : Microsoft Sql Server
IDE : Visual Studio

HARDWARE REQUIREMENTS:
Processor : Any Processor above 500 MHz.
Ram : 128Mb.
Hard Disk : 10 Gb.
Compact Disk : 650 Mb.
Input device : Standard Keyboard and Mouse.
Output device : High Resolution Monitor.

12 | P a g e
Microsoft.NET Framework

The .NET Framework is a new computing platform that simplifies application development
in the highly distributed environment of the Internet. The .NET Framework is designed to
fulfill the following objectives:

• To provide a consistent object-oriented programming environment whether object


code is stored and executed locally, executed locally but Internet-distributed, or
executed remotely.
• To provide a code-execution environment that minimizes software deployment and
versioning conflicts.
• To provide a code-execution environment that guarantees safe execution of code,
including code created by an unknown or semitrusted third party.
• To provide a code-execution environment that eliminates the performance problems
of scripted or interpreted environments.
• To make the developer experience consistent across widely varying types of
applications, such as Windows-based applications and Webbased applications.
• To build all communication on industry standards to ensure that code based on the
.NET Framework can integrate with any other code.

The .NET Framework has two main components: the common language runtime and the
.NET Framework class library. The common language runtime is the foundation of the .NET
Framework. You can think of the runtime as an agent that manages code at execution time,
providing core services such as memory management, thread management, and remoting,
while also enforcing strict type safety and other forms of code accuracy that ensure security
and robustness. In fact, the concept of code management is a fundamental principle of the
runtime. Code that targets the runtime is known as managed code, while code that does not
target the runtime is known as unmanaged code. The class library, the other main component
of the .NET Framework, is a comprehensive, object-oriented collection of reusable types
that you can use to develop applications ranging from traditional commandline or graphical
user interface (GUI) applications to applications based on the latest innovations provided by
ASP.NET, such as Web Forms and XML Web services.

The .NET Framework can be hosted by unmanaged components that load the common
language runtime into their processes and initiate the execution of managed code, thereby
creating a software environment that can exploit both managed and unmanaged features.
The .NET Framework not only provides several runtime hosts, but also supports the
development of thirdparty runtime hosts.

For example, ASP.NET hosts the runtime to provide a scalable, server-side environment for
managed code. ASP.NET works directly with the runtime to enable Web Forms applications
and XML Web services, both of which are discussed later in this topic.
13 | P a g e
Internet Explorer is an example of an unmanaged application that hosts the runtime (in the
form of a MIME type extension). Using Internet Explorer to host the runtime enables you to
embed managed components or Windows Forms controls in HTML documents. Hosting the
runtime in this way makes managed mobile code (similar to Microsoft® ActiveX® controls)
possible, but with significant improvements that only managed code can offer, such as semi-
trusted execution and secure isolated file storage.

The following illustration shows the relationship of the common language runtime and the
class library to your applications and to the overall system. The illustration also shows how
managed code operates within a larger architecture.

Features of the Common Language Runtime


The common language runtime manages memory, thread execution, code execution, code
safety verification, compilation, and other system services. These features are intrinsic to
the managed code that runs on the common language runtime.

With regards to security, managed components are awarded varying degrees of trust,
depending on a number of factors that include their origin (such as the Internet, enterprise
network, or local computer). This means that a managed component might or might not be
able to perform file-access operations, registry-access operations, or other sensitive
functions, even if it is being used in the same active application.

The runtime enforces code access security. For example, users can trust that an executable
embedded in a Web page can play an animation on screen or sing a song, but cannot access
their personal data, file system, or network. The security features of the runtime thus enable
legitimate Internet-deployed software to be exceptionally feature rich.

The runtime also enforces code robustness by implementing a strict typeand code-
verification infrastructure called the common type system (CTS). The CTS ensures that all
managed code is self-describing. The various Microsoft and third-party language compilers

Generate managed code that conforms to the CTS. This means that managed code can
consume other managed types and instances, while strictly enforcing type fidelity and type
safety.

In addition, the managed environment of the runtime eliminates many common software
issues. For example, the runtime automatically handles object layout and manages
references to objects, releasing them when they are no longer being used. This automatic
memory management resolves the two most common application errors, memory leaks and
invalid memory references.

14 | P a g e
The runtime also accelerates developer productivity. For example, programmers can write
applications in their development language of choice, yet take full advantage of the runtime,
the class library, and components written in other languages by other developers. Any
compiler vendor who chooses to target the runtime can do so. Language compilers that target
the .NET Framework make the features of the .NET Framework available to existing code
written in that language, greatly easing the migration process for existing applications.

While the runtime is designed for the software of the future, it also supports software of
today and yesterday. Interoperability between managed and unmanaged code enables
developers to continue to use necessary COM components and DLLs.

The runtime is designed to enhance performance. Although the common language runtime
provides many standard runtime services, managed code is never interpreted. A feature
called just-in-time (JIT) compiling enables all managed code to run in the native machine
language of the system on which it is executing. Meanwhile, the memory manager removes
the possibilities of fragmented memory and increases memory locality-of-reference to
further increase performance.

Finally, the runtime can be hosted by high-performance, server-side applications, such as


Microsoft® SQL Server™ and Internet Information Services (IIS). This infrastructure
enables you to use managed code to write your business logic, while still enjoying the
superior performance of the industry's best enterprise servers that support runtime hosting.

.NET Framework Class Library


The .NET Framework class library is a collection of reusable types that tightly integrate with
the common language runtime. The class library is object oriented, providing types from
which your own managed code can derive functionality. This not only makes the .NET
Framework types easy to use, but also reduces the time associated with learning new

features of the .NET Framework. In addition, third-party components can integrate


seamlessly with classes in the .NET Framework.

For example, the .NET Framework collection classes implement a set of interfaces that you
can use to develop your own collection classes. Your collection classes will blend seamlessly
with the classes in the .NET Framework.

As you would expect from an object-oriented class library, the .NET Framework types
enable you to accomplish a range of common programming tasks, including tasks such as
string management, data collection, database connectivity, and file access. In addition to
these common tasks, the class library includes types that support a variety of specialized

15 | P a g e
development scenarios. For example, you can use the .NET Framework to develop the
following types of applications and services:

• Console applications.
• Scripted or hosted applications.
• Windows GUI applications (Windows Forms).
• ASP.NET applications.
• XML Web services.
• Windows services.

For example, the Windows Forms classes are a comprehensive set of reusable types that
vastly simplify Windows GUI development. If you write an ASP.NET Web Form
application, you can use the Web Forms classes.

Client Application Development


Client applications are the closest to a traditional style of application in Windows-based
programming. These are the types of applications that display windows or forms on the
desktop, enabling a user to perform a task. Client applications include applications such as
word processors and spreadsheets, as well as custom business applications such as data-
entry tools, reporting tools, and so on. Client applications usually employ windows, menus,
buttons, and other GUI elements, and they likely access local resources such as the file
system and peripherals such as printers.

Another kind of client application is the traditional ActiveX control (now replaced by the
managed Windows Forms control) deployed over the Internet as a Web page. This
application is much like other client applications: it is executed natively, has access to local
resources, and includes graphical elements.

In the past, developers created such applications using C/C++ in conjunction with the
Microsoft Foundation Classes (MFC) or with a rapid application development (RAD)
environment such as Microsoft® Visual Basic®. The .NET Framework incorporates aspects
of these existing products into a single, consistent development environment that drastically
simplifies the development of client applications.

The Windows Forms classes contained in the .NET Framework are designed to be used for
GUI development. You can easily create command windows, buttons, menus, toolbars, and
other screen elements with the flexibility necessary to accommodate shifting business needs.

16 | P a g e
For example, the .NET Framework provides simple properties to adjust visual attributes
associated with forms. In some cases the underlying operating system does not support
changing these attributes directly, and in these cases the .NET Framework automatically
recreates the forms. This is one of many ways in which the .NET Framework integrates the
developer interface, making coding simpler and more consistent.

Unlike ActiveX controls, Windows Forms controls have semi-trusted access to a user's
computer. This means that binary or natively executing code can access some of the
resources on the user's system (such as GUI elements and limited file access) without being
able to access or compromise other resources. Because of code access security, many
applications that once needed to be installed on a user's system can now be safely deployed
through the Web. Your applications can implement the features of a local application while
being deployed like a Web page.

C#.Net for Windows Application

Overview of the .NET Framework

The .NET Framework is a managed type-safe environment for application development and
execution. The .NET Framework manages all aspects of your program’s execution. It
allocates memory for the storage of data and instructions, grants or denies the appropriate
permissions to your application, initiates and manages application execution, and manages
the reallocation of memory from resources that are no longer needed. The .NET Framework
consists of two main components: the common language runtime and the .NET Framework
class library.

The common language runtime can be thought of as the environment that manages code
execution. It provides core services, such as code compilation, memory allocation, thread
management, and garbage collection. Through the common type system (CTS), it enforces
strict type-safety and ensures that code is executed in a safe environment by also enforcing
code access security.

The .NET Framework class library provides a collection of useful and reusable types that
are designed to integrate with the common language runtime. The types provided by the
.NET Framework are object-oriented and fully extensible, and they allow you to seamlessly
integrate your applications with the .NET Framework. Languages and the .NET Framework

The .NET Framework is designed for cross-language compatibility, which means, simply,
that .NET components can interact with each other no matter what supported language they
were written in originally. So, an application written in Microsoft Visual Basic .NET might
reference a dynamic-link library (DLL) file written in Microsoft Visual C#, which in turn
might access a resource written in managed Microsoft Visual C++ or any other .NET

17 | P a g e
language. This language interoperability extends to full object-oriented inheritance. A
Visual Basic .NET class might be derived from a C# class, for example, or vice versa.

This level of cross-language compatibility is possible because of the common language


runtime. When a .NET application is compiled, it is converted from the language in which
it was written (Visual Basic .NET, C#, or any other .NET-compliant language) to Microsoft
Intermediate Language (MSIL or IL). MSIL is a low-level language that the common
language runtime can read and understand. Because all .NET executables and DLLs exist as
MSIL, they can freely interoperate. The Common Language Specification (CLS) defines the
minimum standards to which .NET language compilers must conform. Thus, the CLS
ensures that any source code successfully compiled by a .NET compiler can interoperate
with the .NET Framework.

The CTS ensures type compatibility between .NET components. Because .NET applications
are converted to IL prior to deployment and execution, all primitive data types are
represented as .NET types. Thus, a Visual Basic Integer and a C# int are both represented in
IL code as a System.Int32. Because both languages use a common type system, it is possible
to transfer data between components and avoid time-consuming conversions or hard-tofind
errors.

Visual Studio .NET ships with languages such as Visual Basic .NET, Visual C#, and Visual
C++ with managed extensions, as well as the JScript scripting language. You can also write
managed code for the .NET Framework in other languages. Third-party tools and compilers
exist for Fortran, Cobol, Perl, and a host of other languages. All of these languages share the
same cross-language compatibility and inheritability. Thus, you can write code for the .NET
Framework in the language of your choice, and it will be able to interact with code written
for the .NET Framework in any other language.

.NET Framework Architecture


The Structure of a .NET Application

To understand how the common language runtime manages code execution, you must
examine the structure of a .NET application. The primary unit of a .NET application is the
assembly. An assembly is a self-describing collection of code, resources, and metadata. The
assembly manifest contains information about what is contained within the assembly. The
assembly manifest provides:

• Identity information, such as the assembly’s name and version number


• A list of all types exposed by the assembly

• A list of other assemblies required by the assembly

18 | P a g e
• A list of code access security instructions, including permissions required by the
assembly and permissions to be denied the assembly

Each assembly has one and only one assembly manifest, and it contains all the description
information for the assembly. However, the assembly manifest can be contained in its own
file or within one of the assembly’s modules.

An assembly contains one or more modules. A module contains the code that makes up your
application or library, and it contains metadata that describes that code. When you compile
a project into an assembly, your code is converted from high-level code to IL. Because all
managed code is first converted to IL code, applications written in different languages can
easily interact. For example, one developer might write an application in Visual C# that
accesses a DLL in Visual Basic .NET. Both resources will be converted to IL modules before
being executed, thus avoiding any languageincompatibility issues.

Each module also contains a number of types. Types are templates that describe a set of data
encapsulation and functionality. There are two kinds of types: reference types (classes) and
value types (structures). These types are discussed in greater detail in Lesson 2 of this
chapter. Each type is described to the common language runtime in the assembly manifest.
A type can contain fields, properties, and methods, each of which should be related to a
common functionality. For example, you might have a class that represents a bank account.
It contains fields, properties, and methods related to the functions needed to implement a
bank account. A field represents storage of a particular type of data. One field might store
the name of an account holder, for example. Properties are similar to fields, but properties
usually provide some kind of validation when data is set or retrieved. You might have a
property that represents an account balance. When an attempt is made to change the value,
the property can check to see if the attempted change is greater than a predetermined limit.
If the value is greater than the limit, the property does not allow the change. Methods
represent behavior, such as actions taken on data stored within the class or changes to the
user interface. Continuing with the bank account example, you might have a Transfer
method that transfers a balance from a checking account to a savings account, or an Alert
method that warns users when their balances fall below a predetermined level.

CLR Execution Model


Compilation and Execution of a .NET Application

When you compile a .NET application, it is not compiled to binary machine code; rather, it
is converted to IL. This is the form that your deployed application takes—one or more
assemblies consisting of executable files and DLL files in IL form. At least one of these
assemblies will contain an executable file that has been designated as the entry point for the
application.

19 | P a g e
When execution of your program begins, the first assembly is loaded into memory. At this
point, the common language runtime examines the assembly manifest and determines the
requirements to run the program. It examines security permissions requested by the
assembly and compares them with the system’s security policy. If the system’s security
policy does not allow the requested permissions, the application will not run. If the
application passes the system’s security policy, the common language runtime executes the
code. It creates a process for the application to run in and begins application execution.
When execution starts, the first bit of code that needs to be executed is loaded into memory
and compiled into native binary code from IL by the common language runtime’s Just-In-
Time (JIT) compiler. Once compiled, the code is executed and stored in memory as native
code. Thus, each portion of code is compiled only once when an application executes.
Whenever program execution branches to code that has not yet run, the JIT compiler
compiles it ahead of execution and stores it in memory as binary code. This way, application
performance is maximized because only the parts of a program that are executed are
compiled.

2: The .NET Base Class Library

The .NET base class library is a collection of object-oriented types and interfaces that
provide object models and services for many of the complex programming tasks you
will face. Most of the types presented by the .NET base class library are fully
extensible, allowing you to build types that incorporate your own functionality into
your managed code.

The .NET Framework base class library contains the base classes that provide many of the
services and objects you need when writing your applications. The class library is organized
into namespaces. A namespace is a logical grouping of types that perform related functions.
For example, the System.Windows.Forms namespace contains all the types that make up
Windows forms and the controls used in those forms.

Namespaces are logical groupings of related classes. The namespaces in the .NET base class
library are organized hierarchically. The root of the .NET Framework is the System
namespace. Other namespaces can be accessed with the period operator. A typical
namespace construction appears as follows:

System
System.Data
System.Data.SQLClient

The first example refers to the System namespace. The second refers to the
System.Data namespace. The third example refers to the System.Data.SQLClient namespace.
Table 1.1 introduces some of the more commonly used .NET base class namespaces.

20 | P a g e
Table 1-1. Representative .NET Namespaces

Namespace Description

This namespace is the root for many of the low-level types required by
the .NET Framework. It is the root for
System primitive data types as well, and it is the root for all the other namespaces in the
.NET base class library.

System.Collections This namespace contains classes that represent a variety Table 1-1.
Representative .NET Namespaces

Namespace Description

of different container types, such as ArrayList, SortedList, Queue, and Stack.


You also can find abstract classes, such as CollectionBase, which are useful
for implementing your own collection functionality.

This namespace contains classes involved in


System.ComponentModel component creation and containment, such as attributes, type
converters, and license providers.
System.Data This namespace contains classes required for
database access and manipulations, as well as
additional namespaces used for data access.
This namespace contains a set of classes that are
System.Data.Common
shared by the .NET managed data providers.

This namespace contains classes that make up the


System.Data.OleDb
managed data provider for OLE DB data access.

This namespace contains classes that are optimized


System.Data.SQLClient
for interacting with Microsoft SQL Server.

This namespace exposes GDI+ functionality and


System.Drawing
provides classes that facilitate graphics rendering.

In this namespace, you will find types for handling


System.IO
file system I/O.

21 | P a g e
This namespace is home to common mathematics
System.Math functions such as extracting roots and
trigonometry.
System.Reflection This namespace provides support for obtaining
information and dynamic creation of types at
runtime. implementation of multithreaded applications.

System.Security This namespace is home to types dealing with


permissions, cryptography, and code access
security.

This namespace contains classes that facilitate the


System.Threading
This
namespace contains types involved in creating standard Windows applications. Classes
System.Windows.Forms that represent forms and controls reside here as well.

The namespace names are self-descriptive by design. Straightforward names make the .NET
Framework easy to use and allow you to rapidly familiarize yourself with its contents.

Reference Types and Value Types

Types in the .NET Framework come in two varieties: value types and reference types. The
primary difference between value types and reference types has to do with the way variable
data is accessed. To understand this difference, a little background on memory dynamics is
required.

Application data memory is divided into two primary components, the stack and the heap.
The stack is an area of memory reserved by the application to run the program. The stack is
analogous to a stack of dinner plates. Plates are placed on the stack one on top of another.
When a plate is removed from the stack, it is always the last one to have been placed on top
that is removed first. So it is with program variables. When a function is called, all the
variables used by the function are pushed onto the stack. If that function calls additional
functions, it pushes additional variables onto the stack. When the most recently called
function terminates, all of its variables go out of scope (meaning that they are no longer
available to the application) and are popped off the stack. Memory consumed by those
variables is then freed up, and program execution continues.

The heap, on the other hand, is a separate area of memory reserved for the creation of
reusable objects. The common language runtime manages allocation of heap memory for
objects and controls the reclamation of memory from unused objects through garbage
collection.

22 | P a g e
All the data associated with a value type is allocated on the stack. When a variable of a value
type goes out of scope, it is destroyed and its memory is reclaimed. A variable of a reference
type, on the other hand, exists in two memory locations. The actual object data is allocated
on the heap. A variable containing a pointer to that object is allocated on the stack. When
that variable is called by a function, it returns the memory address for the object to which it
refers. When that variable goes out of scope, the object reference is destroyed but the object
itself is not. If any other references to that object exist, the object remains intact. If the object
is left without any references, it is subject to garbage collection. (See Lesson 6 of this
chapter.)

Examples of value types include primitives, such as Integer (int), Boolean (bool), Char
(char), and so on, as well as user-defined types such as Structure (struct) and Enumeration
(enum). Classes represent the majority of reference types. Other reference types include the
interface, delegate, and array types. Classes and structures are discussed in Lesson 3 of this
chapter, and other reference and value types are discussed in Chapter 3.

Using .NET Framework Types in Your Application

When you begin writing an application, you automatically begin with a reference to the
.NET Framework base class library. You reference it so that your application is aware of the
base class library and is able to create instances of the types represented by it. Value Types
int myInteger;

This line tells the runtime to allocate the appropriate amount of memory to hold an integer
variable. Although this line creates the variable, it does not assign a value to it. You can
assign a value using the assignment operator, as follows:

myInteger = 42;

You can also choose to assign a value to a variable upon creation, as shown in this example:

int myInteger = 42;

Reference Types

Creating an instance of a type is a two-step process. The first step is to declare the variable
as that type, which allocates the appropriate amount of memory for that variable but does
not actually create the object. The following syntax declares an object:

System.Windows.Forms.Form myForm;

23 | P a g e
This line tells the runtime to set aside enough memory to hold a Form variable and assigns
it the name myForm, but it does not actually create the Form object in memory. The second
step, called instantiation, actually creates the object. An example of instantiation follows:

myForm = new System.Windows.Forms.Form();

This line makes a call to the constructor method of the type System.Windows.Forms.Form
by way of the New (new) keyword. The constructor is a special method that is invoked only
at the beginning of an object’s lifetime. It contains any code that must be executed for the
object to work (assigning values to properties, for example). If any parameters were required
by the constructor, they would be contained within the parentheses at the end of the line.
The following example shows declaration and instantiation of a hypothetical Widget class
that requires a string as a parameter in the constructor.

Widget myWidget;
myWidget = new Widget("This string is required by the constructor");

If desired, you can also combine both declaration and instantiation into a single statement.
By declaring and instantiating an object in the same line, you reserve the memory for the
object and immediately create the object that resides in that memory. Although there was a
significant performance penalty for this shortcut in previous versions of Visual Basic, Visual
Basic .NET and Visual C# are optimized to allow this behavior without any performance
loss. The following example shows the one-step declaration and instantiation of a new Form:

System.Windows.Forms.Form myForm = new System.Windows.Forms.Form();

Both value types and reference types must be initialized before use. For class and structure
fields in Visual Basic .NET, types are initialized with default values on declaration. Numeric
value types (such as integer) and floatingpoint types are assigned zero; Boolean variables
are assigned False; and reference types are assigned to a null reference.

In C#, variables of a reference type have a default value of null. It is recommended that you
do not rely on the default value. These variables should not be used until they have been
initialized.

Using Value Type and Reference Type Variables

A variable that represents a value type contains all the data represented by that type. A
variable that represents a reference type contains a reference to a particular object. This
distinction is important. Consider the following example:

int x, y; x = 15; y = x;
x = 30;
// What is the value of y?
24 | P a g e
In this example, two integer variables named x and y are created. X is assigned a value of
15, and then y is assigned the value of x. Next the value of x is changed to 30, and the
question is posed: what is the value of y? The answer to this question might seem obvious,
and it is y = 15 because x and y are two separate variables and have no effect on each other
when changed. When the line y = x is encountered, the value of x is copied to the value of
y, and there is no further connection between the two variables.

This situation changes, however, in the case of reference types. Let’s reconsider the previous
example using a reference type (Form) instead of a value type.

System.Windows.Forms.Form x,y; x = new


System.Windows.Forms.Form(); x.Text = "This is
Form 1"; y = x;
x.Text = "This is Form 2";
// What value does y.Text return?

What value does y.Text return? This time, the answer is less obvious. Because
System.Windows.Forms.Form is a reference type, the variable x does not actually contain a
Form; rather, it points to an instance of a Form. When the line y = x is encountered, the
runtime copies the reference from variable x to y. Thus, the variables x and y now point to
the same instance of Form. Because these two variables refer to the same instance of the
object, they will return the same values for properties of that object. Thus, y.Text returns
“This is Form 2”.

The Imports and Using Statements

Up to this point of the chapter, if you wanted to access a type in the .NET Framework base
class library, you had to use the full name of the type, including every namespace to which
it belonged. For example:

System.Windows.Forms.Form

This is called the fully-qualified name, meaning it refers both to the class and to the
namespace in which it can be found. You can make your development environment “aware”
of various namespaces by using the Imports (Visual Basic .NET) or using (Visual C#)
statement. This technique allows you to refer to a type using only its generic name and to
omit the qualifying namespaces. Thus, you could refer to
System.Windows.Forms.Form as simply Form. In Visual Basic .NET, the Imports statement
must be placed at the top of the code window, preceding any other statement (except Option).
In Visual C#, the using statement must occur before any other namespace element, such as
a class or struct. This example demonstrates use of this statement:

using System.Windows.Forms;
25 | P a g e
When two types of the same name exist in more than one imported namespace, you must
use the fully qualified name to avoid a naming conflict. Thus, if you are using
MyNameSpaceOne and MyNameSpaceTwo, and each contains a Widget class, you would
have to refer to MyNameSpaceOne.Widget or MyNameSpaceTwo.Widget to ensure the
correct result.

In C#, you can resolve namespace conflicts such as these by creating an alias. An alias allows
you to choose one name to refer to another class. You create an alias using the using
keyword, as shown below:

using myAlias = MyNameSpaceTwo.Widget;

After implementing an alias, you can use it in code to represent the aliased class. For
example:

// You can now refer to MyNameSpaceTwo as myAlias. The // following two


lines produce the same result:
MyNameSpaceTwo.Widget anotherWidget = new MyNameSpaceTwo.Widg et() ;
myAlias anotherWidget = new myAlias() ;

You cannot create aliases for types in this manner in Visual Basic .NET.

Referencing External Libraries

You might want to use class libraries not contained by the .NET Framework, such as libraries
developed by third-party vendors or libraries you developed. To access these external
libraries, you must create a reference.

To create a reference to an external library

1. In the Solution Explorer, right-click the References node of yourproject.


2. From the pop-up menu, choose Add Reference. The Add Referencedialog box
appears.

3. Choose the appropriate tab for the library you want to reference. .NETlibraries are
available on the .NET tab. Legacy COM libraries appear on the COM tab, and local
Visual Studio projects appear on the Projects tab.

4. Locate the library you want to reference, and double-click it to add itto the Selected
components box. Click OK to confirm the choice of that reference.

Introduction to Object-Oriented Programming

26 | P a g e
Programming in the .NET Framework environment is done with objects. Objects are
programmatic constructs that represent packages of related data and functionality. Objects
are self-contained and expose specific functionality to the rest of the application
environment without detailing the inner workings of the object itself. Objects are created
from a template called a class. The .NET base class library provides a set of classes from
which you can create objects in your applications. You also can use the Microsoft Visual
Studio programming environment to create your own classes. This lesson introduces you to
the concepts associated with objectoriented programming.

Objects, Members, and Abstraction

An object is a programmatic construct that represents something. In the real world, objects
are cars, bicycles, laptop computers, and so on. Each of these items exposes specific
functionality and has specific properties. In your application, an object might be a form, a
control such as a button, a database connection, or any of a number of other constructs. Each
object is a complete functional unit, and contains all of the data and exposes all of the
functionality required to fulfill its purpose. The ability of programmatic objects to represent
real-world objects is called abstraction.

Classes Are Templates for Objects

Classes can be thought of as blueprints for objects: they define all of the members of an
object, define the behavior of an object, and set initial values for data when appropriate.
When a class is instantiated, an in-memory instance of that class is created. This instance is
called an object. To review, a class is instantiated using the New (new) keyword as follows:

When an instance of a class is created, a copy of the instance data defined by that class is
created in memory and assigned to the reference variable. Individual instances of a class are
independent of one another and represent separate programmatic constructs. There is
generally no limit to how many copies of a single class can be instantiated at any time. To
use a real-world analogy, if a car is an object, the plans for the car are the class. The plans
can be used to make any number of cars, and changes to a single car do not, for the most
part, affect any other cars.

Objects and Members

Objects are composed of members. Members are properties, fields, methods, and events, and
they represent the data and functionality that comprise the object. Fields and properties
represent data members of an object. Methods are actions the object can perform, and events
are notifications an object receives from or sends to other objects when activity happens in
the application.

27 | P a g e
To continue with the real-world example of a car, consider that a Car object has fields and
properties, such as Color, Make, Model, Age, GasLevel, and so on. These are the data that
describe the state of the object. A Car object might also expose several methods, such as
Accelerate, ShiftGears, or Turn. The methods represent behaviors the object can execute.
And events represent notifications. For example, a Car object might receive an
EngineOverheating event from its Engine object, or it might raise a Crash event when
interacting with a Tree object.

Object Models

Simple objects might consist of only a few properties, methods, and perhaps an event or two.
More complex objects might require numerous properties and methods and possibly even
subordinate objects. Objects can contain and expose other objects as members. For example,
the TextBox control exposes a Font property, which consists of a Font object. Similarly,
every instance of the Form class contains and exposes a Controls collection that comprises
all of the controls contained by the form. The object model defines the hierarchy of contained
objects that form the structure of an object.

An object model is a hierarchical organization of subordinate objects contained and exposed


within a main object. To illustrate, let’s revisit the example of a car as an object. A car is a
single object, but it also consists of subordinate objects. A Car object might contain an
Engine object, four Wheel objects, a Transmission object, and so on. The composition of
these subordinate objects directly affects how the Car object functions as a whole. For
example, if the Cylinders property of the Engine subordinate object is equal to 4, the Car
will behave differently than a Car whose Engine has a Cylinders property value of 8.
Contained objects can have subordinate objects of their own. For example, the contained
Engine object might contain several SparkPlug objects.

Encapsulation

Encapsulation is the concept that implementation of an object is independent of its interface.


Put another way, an application interacts with an object through its interface, which consists
of its public properties and methods. As long as this interface remains constant, the
application can continue to interact with the component, even if implementation of the
interface was completely rewritten between versions.

Objects should only interact with other objects through their public methods and properties.
Thus, objects should contain all of the data they require, as well as all of the functionality
that works with that data. The internal data of an object should never be exposed in the
interface; thus, fields rarely should be Public (public).

Returning to the Car example. If a Car object interacts with a Driver object, the Car interface
might consist of a GoForward method, a GoBackward method, and a Stop method. This is
28 | P a g e
all the information that the Driver needs to interact with the Car. The Car might contain an
Engine object, for example, but the Driver doesn’t need to know about the Engine object—
all the Driver cares about is that the methods can be called and that they return the
appropriate values. Thus, if one Engine object is exchanged for another, it makes no
difference to the Driver as long as the interface continues to function correctly.

Polymorphism

Polymorphism is the ability of different classes to provide different implementations of the


same public interfaces. In other words, polymorphism allows methods and properties of an
object to be called without regard for the particular implementation of those members. For
example, a Driver object can interact with a Car object through the Car public interface. If
another object, such as a Truck object or a SportsCar object, exposes the same public
interface, the Driver object can interact with them without regard to the specific
implementation of that interface. There are two principal ways through which polymorphism
can be provided: interface polymorphism and inheritance polymorphism.

Interface Polymorphism

An interface is a contract for behavior. Essentially, it defines the members a class should
implement, but states nothing at all about the details of that implementation. An object can
implement many different interfaces, and many diverse classes can implement the same
interface. All objects implementing the same interface are capable of interacting with other
objects through that interface. For example, the Car object in the previous examples might
implement the IDrivable interface (by convention, interfaces usually begin with I), which
specifies the GoForward, GoBackward, and Halt methods. Other classes, such as Truck,
Forklift, or Boat might implement this interface and thus are able to interact with the Driver
object. The Driver object is unaware of which interface implementation it is interacting with;
it is only aware of the interface itself.

Inheritance Polymorphism

Inheritance allows you to incorporate the functionality of a previously defined class into a
new class and implement different members as needed. A class that inherits another class is
said to derive from that class, or to inherit from that class. A class can directly inherit from
only one class, which is called the base class. The new class has the same members as the
base class, and additional members can be added as needed. Additionally, the
implementation of base members can be changed in the new class by overriding the base
class implementation. Inherited classes retain all the characteristics of the base class and can
interact with other objects as though they were instances of the base class. For example, if
the Car class is the base class, a derived class might be Sport scar. The Sport scar class might
29 | P a g e
be the base class for another derived class, the ConvertibleSportsCar. Each newly derived
class might implement additional members, but the functionality defined in the original Car
class is retained.

4. PROJECT DICTIONARY
4.1. DATAFLOW DIAGRAMS

Data flow diagram is used to decrease analysis the movement of data through a system
store of data in the system. Data flow diagrams are the central tool basing on which
components are developed.The transformation of data from input to output, through process
may be describe logically and independently of physically components associated with the
system. They are called logical data flow diagrams. In contrast physical data flow diagrams
show the actual implementation and movement of data between people, Department, and
work station.
The data flow diagram show functional composition of the system. The first level of
conceptual level in context diagram is flowed by the description of input and output for each
of entities the next level of dfd is level 0, which shows the main functions in the system.
Level 0 is followed by the description of the main functions. The main function further
broken into functions and sub functions.

THE MAIN CONTENT-


1.1 Project Background

Along with the improvement of people's life quality in China, tourism has become more
and more popular, and it has become one of the major entertainments for people
spending their leisure time. Both domestic tourism and outbound tourism has become
increasingly common in recent years. According to statistics of the China National
Tourism Administration, about 4.12 billion people went on domestic travel or outbound
travel in 2015 [1]. With the rapid development of the tourism, the numberof people
who use photos to record the beautiful moments in their life is also increasing, and
many people have become very fond of photography [2].
Internet is rapidly developing and people's lives are constantly changed by it. The

30 | P a g e
Internet not only allows people to get the information they want easily, but also builds
a strong social network. Through the structure of social network platforms and hubs,
people can quickly and easily communicate with others, share their life moments, and
so on.
Nowadays, many photography enthusiasts expect to have a platform to share high-
quality photos with friends and manage their online storage photos more efficiently and
conveniently. Photography enthusiasts are also keen to participate in photography
competitions to get encourage from others and find their own shortcomings. However,
most of the online photography competition websites mainly focus on their own
competitions, which have a lot of limitations. This kind of website has quite a big
difficulty to meet various needs of photography enthusiasts at different levels of
expertise, and the number of systems containing both photo sharing and general
photography competition management are quite a few in China.
At the same time, with the development of technology and photographers’ higher
demand for photo resolution, the system needs a more efficient way to manage storage
space. Therefore, it is imminent to design a web-based photo sharing and photography
competition management system for photography enthusiasts, which hasmore efficient
storage space management.

31 | P a g e
1.2 Research status at China and abroad
Most of photo sharing or photography competition platforms appeared around the early
2000, and have become increasingly popular in recent years.
Flickr and Imgur are well-known international photo-sharing websites. Flickr has
social contact and photo management functions, allowing users to easily share photos
with their friends, interact with other users, and effectively manage uploaded resources.
Imgur is more inclined to resource storage and image search platform. So uploaded
images can be searched and viewed by other users, and the system will record the
viewing number of these images, and push images, which have a large click numbers,
to the website’s homepage. WPO (World Photography Organization), World Press
Photo and POYi (Photos of the Year International) are internationally famous
photography competition websites, but they are mostly established for their own
competitions.
In China, most famous photo-sharing websites belong to the kinds of forum
website, resource website or community website, such as POCO and Fengniao. Both
are community photo-sharing websites with forum and photo viewing functions. Their
users can post text to communicate with other users, upload photos to a unified photo
library for sharing, and simply manage uploaded photos. Global Photography and
Photo Inter are prestigious photography competition websites in China. They both have
photo viewing and photography competition management functions, so users can
upload photos to a unified photo library and view them online, or participate in the
designated competitions after payment. At present, there are relatively few platforms
containing both photo sharing and photography competition management functions.
The aim of our project is to build a system for photographers with excellent photo
sharing, photo management and photography competition managementfunctions. Also,
a good storage space management subsystem is to be built for efficient resource use
and system expansion, which will be incorporated into the system.

1.3 The purpose and significance of this project


With vigorous development of tourism and the change of people’s viewpoints,

32 | P a g e
recording and enjoying excellent moments with photos has become more and more
popular. Therefore, a large number of photography enthusiasts appeared. Photography
enthusiasts are eager to communicate, share high-quality photos with others, and
participate in photography competition to find out their own shortcomings or get
approval from others. However, the platforms, which contain both photo sharing and
photography competition management, are relatively few at present. So the system is
developed to meet these needs, which not only allows people to upload and share high-
quality photos more easily, but also narrows the distance among photographers and
photography enthusiast by interaction on the system, allowing enthusiasts to learnfrom
each other. This system also allows all photography enthusiasts to participate in, and
get more evaluation, encouragement and support from other people.
A good photo sharing and photography competition management system must be
intuitive, convenient and easy to use. Users with different backgrounds can use its
functions efficiently. At the same time, a better solution is needed to make the storage
space management subsystem more efficient, stable and expansible, because of the
storage of large number of high-quality photos and a lot of potential users. The project
aims to develop a photo sharing and photography competition management system for
photographic enthusiasts by using J2EE, MVC and other related technologies. We
also realized the system's easy using, security, efficiently and expansibility. At the same
time, the realization of the system not only has great potential value of commerce, but
also promotes spread and development of photography.

1.4 Main work of this paper


The main contribution of our project is the design and implementation of the photo
sharing and photography competition management system based on the J2EE and
MVC, which adopt MySQL as its relationship database management system. We
finished the following work:
1. Research was conducted on mainstream photo-sharing websites and
photography competition management systems existed on the Internet. And we
made an in-depth investigation on requirements from photography enthusiast
groups, which are very helpful in requirement analysis.
2. Requirements analysis was done for the photo sharing and photography
competition management system by using UML and object-oriented method. The
use case diagrams under various cases were drawn.

33 | P a g e
3. The overall design of the system was carried out. The system was divided into
two subsystems: photo sharing and photography competition management. The
former subsystem consists of 5 parts, which are the Personal Homepage, Photo
Management module, Album Management module, Collection Management
module, and User and Authorization Management module. The latter consists of
6 modules, which are User and Authorization Management module, Competition
Management module, Review module, Contribution module, Display of
Competition module, and Display of Competition Results module.
4. All modules were designed in detail in their functions and processing logic, and
the sequence charts for them were drawn, also giving detailed processing steps.
5. The database’s design was accomplished, and E-R charts and database tables
were given. We used a tree structure in the data classification. The tree structure
can build good relationship and structure among resources and records in the
database [3].
6. A unique storage space management module was proposed and designed, it not
only provides efficient and flexible management of storage on the server, but can
also fulfill efficient file synchronization and file transmission.
7. The UI of the system was designed and implemented. Each module of the
system was coded and debugged by using Java and MyEclipse, and then system
integration and testing are carried out.

1.5 The structure of this paper


Chapter 1, as the introduction, mainly discusses the project background, current status
at China and abroad, and the purpose and significance of this project. It is stated that
the main work and main research content of the project is the design and
implementation of a web-based photo sharing and photography competition
management system.
Chapter 2 is the requirement analysis of the photo sharing and photography
competition management system, which analyzes functional and nonfunctional
requirements of the system. Use case diagrams under various cases were drawn.
Chapter 3 describes the design of the photo sharing and photography competition
management system, including overall design and detail design. Firstly, the system is
divided into 2 subsystems, which contains 5 and 6 modules respectively. The function

34 | P a g e
of each module is described. Then, the processing logic and steps of each module is
given by using sequence diagrams. Later on, the user management mechanism,
directory tree and storage space management subsystem are described. Finally,
database design of the system is described, and detail information of database tables
and E-R charts are given.
Chapter 4 is the realization of the system, which describes the details of realization
of each module. User interface screenshots and part codes are given.
Chapter 5 describes the test of the system. Test cases and test results are given.
Chapter 6 summarizes the work done in this paper, and describes future work,
including possible improvement and extension of this system.

35 | P a g e
Chapter 2 System Requirement Analysis

2.1 Functional requirement analysis

First of all, requirements of this system are analyzed. After investigation and analysis
of related websites at China and abroad, we confirm that the system should consist of
two subsystems: the photo sharing subsystem and the photography competition
management subsystem, which play different roles, but are closed related with each
other.

2.1.1 Photo sharing subsystem

The photo sharing subsystem should provide a variety of functions for users to share
photos easily and flexibly, allowing them to upload photos, to manage the uploaded
photos, and to share photos with other users. It should also provide a variety of
operations to easily create and manage their own albums.
Based on this analysis, we determine that the subsystem contains five parts:
Personal Homepage, Photo Management, Album Management, Collection
Management, and User and Authorization Management.

1. Personal Homepage
The Personal Homepage is the “Home” of a user, for others to visit over Internet. When
visitor visit a user's homepage, the page will automatically show the user’s personal
information, representative photos, selected album and user customize, which also
functions as a guide for browsing all his photos and information. Visitors can also
comment on his photos and albums.
2. Photo Management
Users can upload, delete, move and copy photos. When uploading photos, they need
fill in metadata of the photos and can later modify the metadata. The purpose of the
metadata is to provide for better sharing and searching of the photos, through key words,
for example. At the same time, the user can also choose specified photos to participate
in the ongoing photography competitions.

36 | P a g e
3. Album Management
Album Management allows users to create and manage album, the operations include

37 | P a g e
creating, deleting, removing and modifying albums. It also allows users to manage
photos inside an album.
4. Collection Management
When viewing other people's photos or albums, a user can add his interested objects
into a collection for future access. He can manage his collection using the functions
provided by Collection Management. Operations should include: adding collection
items, deleting collection items and viewing collection items.
5. User and Authorization Management
As an important part of the system, User and Authorization Management manages users
information and access permission, which is jointly shared by the photo sharing
subsystem and the photography competition management subsystem. It provides users
with the functions of registration, login and logout. It also allows users to modify his
password and personal information, which mainly contains name, gender, avatar,
contact information.

2.1.2 Photography competition management subsystem

This subsystem mainly realizes the functions related to photography competition


management.
Through this subsystem, super administrators can easily set up and manage all
photography competitions. He or she can assign some users as competition
administrators for each competition. The competition administrator can manage a
designated competition. Operations that can be performed include: modifying
competition information, modifying review results, and locking review results. The
photography competition management subsystem consists of 6 parts, which are:
Competition Management, Contribution, Review, Display of Competition, Display of
Competition Results, and User and Authorization management.

1. Competition Management
The Competition Management has two kinds of functions: competition management
and photo management. The super administrator is responsible for managing all
competitions. Operations include: creating, modifying, deleting and other operations.
The competition administrator can only be responsible for a specific competition. He
can delete photos and block an account when the user uploads inappropriate photos
(such as a reactionary or pornographic photo).
When super administrator establishes a new competition, he should set the

38 | P a g e
competition name, start date, end date, reviewer and competition administrator.
Users can find the competitions they have taken part in through the Competition
Management, and check the photos they have submitted.
2. Review
Competition reviewers can select, evaluate and reward photos.
3. Contribution
User can submit photos to ongoing photography competitions by uploading a photo
and fill in description.
4. Display of Competition
The users and visitors can view all the photos of all competitions. While viewing, users
also can set different sorting orders for display, and give like’s (similar to the like’s in
facebook.com) to their favorite photos
5. Display of Competition Result
Display of Competition Result is used to display rewarded photos and relevant
competition information for users and visitors. They also can click “like” buttons for
them.
6. User and Authorization Management
User and Authorization Management module is jointly shared by photo sharing
subsystem and photography competition management subsystem. See Section 2.1.1 for
more details.

2.2 Non-functional requirement analysis


Non-functional requirement constitute an important component of requirement
analysis, they not only enable developers to have a more detailed and accurate
understanding of the system, but also improve product quality and make the
development more efficient [4].

2.2.1 Feasibility

Due to the diversified background of different users and the overall goal to make the
system simple and user-friendly, the system’s interface is designed to be concise and
clear. We use JavaScript and a tree structure to achieve a visual directory tree in user
interface page. In this way users can easily achieve the selecting of path, and this
improves system usability and operational efficiency [5].
39 | P a g e
2.2.2 Scalability and maintainability

The MVC framework is used in order to make the system have good scalability and
maintainability, which makes the system’s view layer, logical business layer and data
manipulation layer to be independent of each other, and also makes it easy to do future
development and system maintenance [6].

2.2.3 Security

In order to guarantee the security and integrity of the whole system, it is necessary to
verify the user's access level and login status again while logged-in users trying to
modify important information (such as password) or logged-in administrators trying
to execute high-privilege operations. This kind of examination can avoid malicious
operations and provide Anti-Leech.

2.2.4 System performance

It is easy to waste the storage space if it is not effectively managed, because the system
mainly stores large-sized high quality photos, and uploading and deleting operations
can happen very often. Besides, if the client and the server frequently interact with large
amounts of data, a lot of bandwidth will be consumed, resulting in slower respond,
worse user experience and maybe other problems. Therefore, we will use AJAX to
refresh only part of the page elements, instead of all the elements. It can improve the
response speed and user experience, and reduce the burden on the server [7]. We will
also incorporate a specific storage space management subsystem to optimize
synchronization and transmission process for files, and to make management of the
server resources more efficient.

2.3 Use case analysis for the system

2.3.1 Use case analysis of User and Authorization Management


module
The User and Authorization Management module, as a basic module of the system,
provides the registration function to visitors and allows registered users to manage their
account. Visitors do not have the relevant account information and operational
authority. Only registered users can use all these functions. Use case diagram of this

40 | P a g e
module is shown in Figure 2.1, in which functions of each role are shown. They are:

41 | P a g e
1. Visitors can register an account.
2. Registered users can log in to the system and log out of the system.
3. Registered users can change or retrieve their own password.
4. Registered users can update their personal information, including the avatar,
cover, basic information and contact information.

Figure 2.1 Use case diagram of User and Authorization Management module

2.3.2 Use case analysis of Personal Homepage

The Personal Homepage, as one of the most important parts of the system, mainly aims
to provide photo sharing and photo displaying for users. Only registered users have
personal homepages. Visitors can visit any user’s personal homepage and browse his
photos, albums and collections without registering or logging in. However, in addition
to browsing photos, the visitors have no authority to perform any other operations.
The use case diagram of Personal Homepage is shown in Figure 2.2. Thefunctions
of each role are as follows:
1. Registered users and visitors can visit and browse any users’ personal
homepage.

42 | P a g e
2. Registered users and visitors can also browse any users’ resources (photos,
albums and collections).
3. Registered users and visitors can jump to other users’ personal homepage by
searching their nickname.
4. Only registered users can perform collect, follow and comment on other users’
resources.

Figure 2.2 Use case diagram of Personal Homepage module

2.3.3 Use case analysis of Photo Management module

The Photo Management module is mainly used to manage users' photo resources. The
use case analysis diagram for this module is shown in Figure 2.3, the functions of
each role are as follows:
1. Registered users can upload photos into the system, by selecting the source files
and inputting information, which describes the photos. Each photo is regarded as
resource in the system.
2. Registered users can manage the photos. The operations that can be performed
include: moving photos, copying photos, deleting photos and modifying photo
information.
3. Registered users can also setting the sort mode for photos displaying, including
sorting by upload time, sorting by modified time, sorting by the

43 | P a g e
number of likes and sorting by the number of views
4. Registered users can take part in competitions after select uploaded photo and
select specific competition.

Figure 2.3 Use case diagram of Photo Management module

2.3.4 Use case analysis of Album Management module

The Album Management module contains not only all operations and management
functions of the album resources, but also the majority operations of the photo
resources. The use case analysis diagram of the Album Management module is shown
in Figure 2.4, the functions of each role are as follows:
1. Registered users can create a new album.
2. Registered users can edit the album, including moving the album, copying the
album, deleting the album and updating the album information.
3. Registered users can also set the sorting method for albums, including sorting
by created time, sorting by modified time, sorting by the number of likes and
sorting by the number of views.

44 | P a g e
Figure 2.4 Use case diagram of Album Management module

2.3.5 Use case analysis of Collection Management module

Similar to the previous two modules, this module contains operations andmanagement
functions of the collections. The use case analysis diagram of the Collection
Management module is shown in Figure 2.5, in which functions of each role are as
follows:
1. Registered users can add their favorite photos or albums into a collection.
2. Registered users can delete collected items from their own collection.
3. Registered users can view their own collection items by clicking the target in
the collection management page.

Figure 2.5 Use case diagram of Collection Management module

45 | P a g e
2.3.6 Use case analysis of Competition Management module

The Competition Management module, which is also an important part of the system,
mainly manages affairs related to photography competitions. The administrators
manage competitions through this module, and a normal user checks his participated
competitions through this module too. The use case diagram of the Competition
Management module is shown in Figure 2.6, in which functions of each role are as
follows:
1. Registered users can check their participated competitions through this module,
including competition information and contributions (uploaded photos).
2. The super administrator can create and delete competitions.
3. The super administrator can update the competition information, including the
name, date, reviewer, and competition administrator.
4. Both the super administrator and the competition administrator can delete
photos and lock users. The super administrator can delete photos from all
competitions, but the competition administrator can only delete photos included in
the competitions under his control.

Figure 2.6 Use case diagram of Competition Management module

46 | P a g e
2.3.7 Use case analysis for Contribution module

Registered users can submit photos for competition through this module. The functions
of this module include viewing the competition information and contribution, which is
done by uploading photos and providing information about the photos. The use case
diagram of the Contribution module is shown in the top part of Figure 2.7, in which
functions of each role are as follows:
1. Registered users can view the detail information of ongoing competitions.
2. After viewing, the user can choose a specific competition to contribute,
including upload the photos and give detail description.

2.3.8 Use case analysis of Review module

With the Review module, the reviewers can review photos and set awards, change
awards and lock competition results. The use case diagram for the Review module is
shown in the lower part of Figure 2.7, in which functions of each role are as follows:
1. The reviewer can review the photos, assess the level and set awards.
2. The reviewer can change the results of the assessment.
3. The reviewer can also lock the results of assessment. After locked, the result
cannot be changed again.

Figure 2.7 Use case diagrams of Contribution module and Review module

47 | P a g e
2.3.9 Use case analysis of Display of Competition module

The Display of Competition module is used to show all photos that have participated
in each competition. All the registered users and visitors can browse the photos. The
use case diagram of the module is shown in Figure 2.8, in which functions of each role
are as follows:
1. Registered users and visitors can view all competition lists and select one
competition.
2. Registered users and visitors can browse all the photos in the competition.
3. Registered users and visitors can give their favorite photos like’s.
4. Registered users and visitors can set different sorting orders to display all
photos, such as sorting by uploaded time, sorting by number of likes, and sorting
by number of views.

Figure 2.8 Use case diagram of Display of Competition module

2.3.10 Use case analysis of the Display of Competition Result


module
As one of main function modules of the photography competition management
subsystem, this module aims to display results and offer related operations to users. The
use case diagram of the Display of Competition module is shown in Figure 2.9, in

48 | P a g e
which functions of each role are as follows:
1. Registered users and visitors can view the winning photos, including checking
the list of finished competitions and selecting one competition to view.
2. Visitors and registered users can browse their favorite photos and give them
like’s.

Figure 2.9 Use case diagram of Display of Competition Result module

2.4 Summary of this chapter


In this chapter, detailed functional and non-functional requirements of the system are
analyzed. In the functional requirement analysis, the system is divided into two
subsystems and ten major functional modules. Then a list for main objectives and
implementing functions of each module is given. In the non-functional requirement
analysis, the feasibility, scalability, maintainability, security and system performance
are analyzed. In the last section of this chapter, the use case diagram of each module
in the system is given,which is drawn by using UML (Unified Modeling Language).
The UML not only visualize system requirements, but also illustrate each role and their
operations in use case analysis. It allows users and developers to have a more intuitive
and comprehensive understanding of the system requirements analysis and functions
[8].

49 | P a g e
Chapter 3 System Design

3.1 The overall structure of the system


We use MVC framework as the overall structure in the design of this system. And the
system is divided into 3 layers: view, control and model layer, which not only makes
functions of different levels to be independent of each other, but also achieve the
loose coupling of the system [9]. This structure greatly facilitates the system
development and testing, and lays a solid foundation for the future improvement and
expansion of the system [10]. The overall structure of the system is as shown in Figure
3.1

Figure 3.1 Overall MVC structure of the system

50 | P a g e
View layer: view layer is mainly used to provide users with visualized operations, to
facilitate interactions between users and the system. A good view layer should contain

51 | P a g e
only the user visualization interface and the data of user operation, it should avoid
containing business logic operation of the system and operation on the database [11].
Control layer: as the core of the MVC structure, control layer is mainly used to
receive data from the view layer, to perform business logic operation and to call the
functions of model layer. When the view layer sends a request to the control layer, the
web application service normally filters and match the requested URL with the
controller (xml configuration file), then sends it to the specified Servlet for relevant
logic processing, and finally the control layer and the model layer interact with each
other [12].
Model layer: model layer is mainly used for the data operation, such as CRUD
(create, retrieve, update and delete) operation. In this system, we also import DAO (data
access object) Entity, encapsulation of the database, and data objects oriented operation,
to make the model layer to be loose coupling and manageable [13].

3.2 Module division and function design


According to the results of user survey and system requirement analysis, this J2EE-
based photo sharing and photography competition management system is divided into
two subsystems, the photo-sharing subsystem and the photography competition
management subsystem, as shown in Figure 3.2. The photo sharingsubsystem is divided
into 5 modules, which are the Personal Homepage, PhotoManagement module, Album
Management module, Collection Management module, and User and Authorization
Management module. The photography competition management subsystem is divided
into 6 modules, which are Competition Management module, Contribution module,
Review module, Display of Competition module, Display of Competition Result module
and User and Authorization management module. Among the modules, there is only
one User and Authorization Management module, which is shared by the two
subsystems.

52 | P a g e
Figure 3.2 Division of system modules

The functions of each module are designed, which are described below.
1. User and Authorization Management module
This module aims to manage users and authorizations, whose functions include:
registering account, logging into the system, logging out of the system, modifying
user information, changing password, retrieving the password and authorization
verifying.
(1) Registering account
Visitors can input relevant information in the registration page, and become a user
after submit and verify. After successful registration, it will automatically login and
jump to the user's personal homepage.
(2) Logging into the system
Registered users can log into the system by providing the user name and password.
After the system verify that both of them are correct, it will automatically jump to the
user's homepage.
(3) Logging out of the system
(4) Logged-in users can log out at any time, and return to the login page to protect the Logging into
the system user account security.
53 | P a g e
(5) Modifying user information
Registered users can modify and update their personal information at any time,
including name, gender, birthday, avatar, self-introduction, contact information and so
on.
(6) Changing password
Registered users can change their password through this module. They will be
asked to enter the current password and the new password to set. If the current password
is verified to be correct, the new password will be set into the system, replacing the old
one.
(7) Retrieving the password
In case a registered user lost his password, he can retrieve his password through
Email. What he needs to do is to input his username on the login page, and click on the
“Forgot Password” link, after that the system will automatically send an email to the
user and help him reset his password.
(8) Authorization verifying
When a user (including administrator) accesses some common modules or
attempts to perform a high-privilege operation, the system will automatically verify
current user’s authority to determine whether the operation is allowed or restricted. If
allowed, the system will jump to corresponding webpage, otherwise, warning
information is displayed.
2. Personal Homepage
As a core module in the photo sharing subsystem, Personal Homepage’s main function
is to show the user's own avatars, personal information, representative photos and
selected albums. This homepage contains 5 parts: personal information display,
personal representative photo display, personal selected album display, user customize
and user operation.
(1) Personal information display
This function will automatically count the number of photos, the number of albums
and the number of collections of the user, showing them in the personal homepage. It
also displays the basic information of the user, including: name and labels.
(2) Personal representative photo display
This part displays the user’s representative photos, which are the photos with the
highest click rate and the photos selected by the user from all his photos. All users can

54 | P a g e
click on the photos for detailed viewing.
(3) Personal selected album display
This part displays the user’s selected albums, which are the albums with the
highest click rate and the albums selected by the user from all his albums. All users can
click on any album for detailed viewing.
(4) User customize
This part displays the user customize, including: avatars and background picture.
(5) User operation
Users can comment, collect and like other users’ photos and albums, and also can
follow other users.
3. Photo Management module
This module is mainly used to manage the user's photos, with operations including:
uploading photos, participating in competitions, moving photos, copying photos,
deleting photos, modifying photo information and sort setting.
(1) Uploading photos
Users can select photos in their local storage and upload and save them onto the
server side. After uploading, they can view and manipulate these photos on a web page
with a visualized directory tree.
(2) Moving photos
Users can move photos from one subdirectory to another subdirectory. This
operation is similar to Copying, except that it deletes photos copied.
(3) Copying photos
Users can copy photos from one subdirectory (called the source) to another
subdirectory (called the target).
(4) Deleting photos
Users can delete the specified photo to repair the user's operation errors, such as:
error uploading, redundant uploading and so on.
(5) Participating in competitions
Users can select photos uploaded to the system to participate in competitions.
While doing so, he needs to choose specific competitions on the competition list.
(6) Modifying photo information
Users can modify relevant information of their own photos, including: name,
category and so on.
(7) Sort setting

55 | P a g e
Sorting orders can be set by users, including sorting by upload time, sorting by
number of likes, sorting by modifying time and sorting by number of views.
4. Album Management module
This module is mainly used to operate on albums and photos, including creating albums,
moving albums, copying albums, deleting albums, modifying album information and
sort settings in addition to the same functions as the Photo Management module.
(1) Creating albums
Users can create albums to store photos and albums, which has greatly enriched
the photo and album folder structure, and made the photo and album resource
management more reasonable. When creating an album, you need to input information
about the album's name, category and so on.
(2) Moving albums
Users can move the album from one subdirectory to another subdirectory.
(3) Copying albums
Similarly, the specified album can be selected, and then the copy object of the
album is created in the current subdirectory.
(4) Deleting albums
Users can delete the specified album or delete photos in a batch way.
(5) Modifying album information
Users can modify relevant information of their own albums, including: name,
category and so on.
(6) Sort settings
Different sorting orders can be used for album display, including sorting by
uploaded time, sorting by number of likes, sorting by modified time and sorting by
number of views.
5. Collection Management module
The Collection Management module provides functions related to user collections,
including: adding collection, viewing collection, and deleting collection.
(1) Adding collection
When users are viewing photos or albums of other users, they can use this function
to add resources(photo or album) into his collection. The system will draw the
associated information from the database and insert into the collection list.
(2) Viewing collection

56 | P a g e
After collection, users can directly click on the collection items, which will
directly jump to the target photo or album display page.
(3) Deleting collection
When a user is no longer interested in some items of resource, he can simply
remove them by deleting the items from the collection.
6. Competition Management module
The super administrators are responsible for managing competitions. Operations that
can be performed include creating a new competition, modifying competition
information, deleting the competition. As to normal users, they can only use this module
to view the competitions they have participated in.
(1) Creating a new competition
The super administrators can create a new photography competition with this
function, during which he must input the relevant information about the competition,
such as the name, the dates of the competition, and assign administrators and reviewers
for the competition.
(2) Modifying the competition information
The super administrators can modify the information of each competition,
including the name, start date, end date, reviewers and administrators of the
competition.
(3) Deleting competitions
The super administrators can also delete any competitions.
(4) Viewing the competitions participated in
When a user accesses this module, he is allowed to view his contributed photos
and the associated competitions he has participated in.
(5) Deleting the photo
The super administrators and his designated competition administrator can delete
inappropriate works (such as reactionary works, pornographic works, etc.) for aspecific
competition.
(6) Locking the user
The super administrators and the competition administrators can also lock the user
who uploaded inappropriate works and prohibit him from continued uploading.
7. Contribution module
Users can contribute through this model. Operations include: viewing competitions and
contributing.

57 | P a g e
(1) Viewing competitions
Users can view all the information and photos of all the ongoing competitions.
(2) Contribution
Users can choose competitions and upload their own photos to participate in.
8. Review module
Through this module, a reviewer can review all the works in the competition and give
his evaluation results, including: setting levels of awards, changing awards level later
on and locking review result when competition administrator believes no changes will
be made in the future.
(1) Setting levels of awards
The reviewers can enter the review results into the system through this function.
(2) Changing awards level
The reviewers can change the levels of awards that they have already evaluated
to be.
(3) Locking review result
When the review function of a competition is locked, the reviewer can no longer
change review results and related information.
9. Display of Competition module
The module is mainly used for showing all photos in the competition. The operations
all users can perform are: viewing photos, giving photos like’s, browsing photos and
setting sorting order.
(1) Viewing all photos
Both the visitors and the registered users can view all photos. They first select one
competition from the competition lists, and enter into the webpage of the corresponding
competition to view all the photos in the competition.
(2) Giving photos like’s
Registered users and visitors can give their favorite photos like’s.
(3) Browsing photos
All the photos are shown in thumbnails in the showing webpages. Users can
browse the photos by clicking on the thumbnail.
(4) Setting sort order
This function is prepared for the uses to set the sorting order for displaying photos.
The orders allowed include sorting by uploaded time, sorting by the numberof likes
and sorting by number of views.

58 | P a g e
10. Display of Competition result module
The function of this module is to implement the showing of competition results.
Operations provided include: viewing winning photos, giving photos like’s and
browsing photos.
(1) Viewing winning photos
Users can view competition results by viewing the list of completed competitions
and then selecting the competition they want to view.
(2) Giving photos like’s
Registered user and visitors can click on the link below the winning photos to
give their favorite photos like’s.
(3) Browsing photos
Registered users and visitors can browse photos by clicking the target thumbnail
photos.

3.3 The detailed design of main function modules


Some modules’ functions of this system are similar, such as deleting function of
Photo Management module, Album Management module and Collection management
module, as well as moving, copying, modifying information and setting sort order
functions. Although these functions call different classes of entity and different
methods, but they are similar in sequence diagrams. To avoid repetition, sequence
diagrams are only drawn for a part of functions with a detailed process analysis in the
detailed design of each module in this section.

3.3.1 User and Authorization Management module

The User and Authorization Management module is a basic module of both the photo
sharing and the photography competition management subsystem.

In this module, the registration function is used for visitors to apply for user
accounts. After a visitor registers successfully or logs in with the correct user name and
password, the system will change the user's status and the operation authority directly.
At the same time, page’s automatically redirect function can be achieved according to
the current user’s authorization. After logging in, the user can modify the personal
information, change password, change customize settings and logged out. Therefore,
the login function is the core function of this module. The sequencediagram when a

59 | P a g e
user logs in is shown in Figure 3.3.

60 | P a g e
Figure 3.3 The sequence diagram when a user logging in

The basic flow of user login is as follows:


1. The user accesses the login page and input his account and password.
2. The login page sends the login request together with the user's input
information to the LoginServlet
3. LoginServlet calls the user DAO (data access object) to perform query
operation on the database, and returns the instance object of user.
4. loginByUserEmail method Compare and verify the input password with the
correct password (saved in the instance object).
5. If the password is wrong, login fails and then returns to the login page,
reporting an error. Otherwise, login succeeds and then jumps to the user’s
personal homepage.
The password saved in the database and user type instance objects have already
been encrypted. Therefore, the loginByUserEmail method also needs to encrypt the
input password by using MD5 before verifying them. This mechanism can avoid the
stealing of password while the database or server is being attacked.

3.3.2 Personal Homepage

The Personal Homepage mainly aims to show the user's personal information and their
resources. Figure 3.4 shows the sequence diagram of displaying a user’s representative
photos
61 | P a g e
Figure 3.4 Sequence diagram of displaying a user’s representative photos

The basic flow of displaying a user’s representative photos is as follows:


1. The user visits the personal homepage for browsing.
2.Personal homepage requests the HomepageServlet for relevant information
about the current user’s representative photos.
3. HomepageServlet calls the user data access object for query operation, and
returns a collection of picture objects containing information of the user’s
representative photos.
4. All photos’ URLs are obtained from the collection of representative photo
objects, and are returned to the personal homepage.
5. The Personal homepage requests to the server, accesses picture resources and
displays representative photos using the URLs.
The personal homepage will display the representative photos by using the URLs,
which are returned by the HomepageServlet. But if there is nothing returned, the
personal homepage will be empty. So I have adopted a mechanism for automatically
generating representative photos in case the user have not set his representative photos
yet, which will be discussed in section 4.2.2.

3.3.3 Photo management module

Users can enter the photo management page and upload their own photos for sharing.
After successfully uploading, Users can perform a variety of operations on their photos.
The sequence diagram of uploading photos is shown in Figure 3.5.

62 | P a g e
Figure 3.5 The sequence diagram of uploading photos

The basic flow of photo uploading is as follows:


1. The user triggers photo upload action in the photo management page.
2. The photo management page calls the relevant JavaScript function to visualize
the uploading window.
3. The user selects local photos and gives the related information in the uploading
window.
4. When the user chooses to upload photos and confirms, the relevant data and
request will be sent to UploadPhotoServletfor processing.
5. The UploadPhotoServletfor requests the storage space management subsystem
to allocate the corresponding storage address, and to store the photo resources in
the server.
6. By using the photo data access object method, the value of the photo object
(relevant information of input photos) is saved in the database.
7. Finally, results are returned and displayed.
The photo’s information and the photo’s store address will be saved to the
corresponding database tables after the photo has been uploaded successfully (saved
in the sever side).

3.3.4 Album management module

Similar to the Photo Management module, the Album Management module is mainly
used for the management of album resources. Through the functions of Album
Management module, users can create new albums, move albums, delete albums,
modify album information, set sorting order and so on, which makes the user's storage
63 | P a g e
and folder structure more efficient and intuitive. The sequence diagram of moving
album is shown in Figure 3.6.

Figure 3.6 The sequence diagram of moving albums

The basic flow of moving albums is as follows:


1. The user triggers moving album action in the album management page.
2. By calling the corresponding JavaScript function, the album management page
visualizes the directory tree structure and display it in the pop-up window of user
operation.
3. After the user selects the moving destination and confirm it, the album
management page will asynchronously send moving requests and related data to
the MoveItemServlet for processing.
4. The MoveItemServlet calls the tree node data access object to update the
database, and then returns the operation results.
5. The JavaScript modifies page elements of the new album management page by
the asynchronous return results, and no longer shows album files moved to other
directory.
There is a significant difference between album management and photo
management. When a user delete, move or copy an album, the JavaScript needs to
modify the directory tree’s HTML codes based on the result returned from AJAX. But
this won’t happen when a user operates on photos. This mechanism can change the
directory tree’s structure without refreshing the page, while still keeping the directory
tree’s structure synchronization between the client page and the server side.

64 | P a g e
3.3.5 Collection management module

The Collection Management module, as an auxiliary function module, provides


collection operations to users, which greatly improves the access efficiency to resources
of other users and enhances interaction among users. Users can create mirror items
mapping to other users’ photo or album files. By clicking on the items, users can
directly jump to the relevant resource page. Besides, users can delete the collection
items by using this module’s functions. The sequence diagram for deleting items is
shown in Figure 3.7.

Figure 3.7 The sequence diagram of deleting items

The basic flow for deleting items in a collection is as follows:


1. The user triggers the delete collection action in the collection management
page.
2. The collection management page calls the corresponding JavaScript function,
and uses AJAX asynchronous transfer technology to send deleting requests and
related data to the DeleteItemServlet.
3. The DeleteItemServlet calls collection data access object and user data access
object to delete information related to the item, to update database and to modify
the total number of collections.
4. Results are returned to the Servlet and JavaScript.
5. Finally, with JavaScript and AJAX asynchronous transfer technology, the
current collection page elements are refreshed, and the items that have been
deleted is no longer showed.
When the user tries to delete his collection items, the system will delete only the
collection item’s corresponding records from Collection table. The original photo
resource and other relevant information (if any) won’t be changed. This can avoid the
65 | P a g e
unauthorized operations on resource by other users and the loss of original resource.

3.3.6 Competition management module

This module provides the main functions related to competition management. Through
these functions, users and administrators can perform different operations relate to
competitions. The sequence diagram of creating competition is shown in Figure 3.8.

Figure 3.8 The sequence diagram of creating competitions

The basic flow of creating competitions is as follows:


1. The super administrator triggers creating competitions in the competition
management page, and enters the related competition information.
2. When the administrator selects the reviewer, he will trigger JavaScript function
and use AJAX asynchronous transfer technology to send request to the
QueryServlet for obtaining reviewers information.
3. The QueryServlet calls the user data access object for the database query,
returns a collection of all reviewers’ user object in the database, and extracts the
corresponding reviewer information from it.
4. The relevant reviewer options are visualized with asynchronous method and
JavaScript functions.
5. The administrator enters all the competition information for saving. The
competition management page then calls the JavaScript function to check whether
the input information format is regular. If yes, it will send request and competition
data to the CreateCompetitionServlet.
6. The CreateCompetitionServlet calls the competition data access object to store

66 | P a g e
competition information in the database, and returns saving results.
7. Finally, the page will jump to corresponding pages according to the returned
results.
This flow use AJAX to transmit data asynchronously and use JavaScript to
visualize the options of the reviewers. It is convenient for the administrator to select
reviewers since there are only a fewer reviewers in general. And this also improves
the system’s security (only the reviewers existent in the system can be selected) and
prevents the system from Hotlink attack or potential errors. But this may become
inconvenience when the reviewers need to be increased. Hence we need to add a
retrieving mechanism for quick finding of reviews in the future.

3.3.7 Contribution module

The Contribution module provides the relevant functions for participate in competitions
and contributions. The sequence diagram of competition contribution is shown in
Figure 3.9.

Figure 3.9 Sequence diagram of the competition contribution

The basic flow of the competition contribution is as follows:


1. The user selects photos that have already been uploaded to the system in the
management page and click the "Contribute" button to trigger the contribution
operation.
2. The management page calls the JavaScript function and use AJAX
asynchronous transfer technology to request competition information from a
QueryServlet.
3. The QueryServlet calls competition data access object for database query
operation, returns the collection of competition instance objects, extracts the

67 | P a g e
corresponding competition information, and then asynchronously returns to the
JavaScript.
4. JavaScript uses the relevant information to show the competition list.
5. The user chooses the competition to participate in.
6. The management page sends the relevant request information to the
ContributeServlet for processing.
7. The ContributeServlet calls the competition relation data access object for the
insert database operation, and return the results of the operation.
There are two ways for users to contribute. This flow describes the way to
contribute by through photo or album management page. Section 4.2.6 describes the
way to contribute by through competition page.

3.3.8 Review module

The Review module is used to review all users' photos, by which the reviewer can
review the winning works in the competition, and modify review results. However,
after reviewer lock the results, the review results can no longer be changed. The
sequence diagram of review is shown in Figure 3.10.

Figure 3.10 The sequence diagram of review

The basic flow of the competition review is as follows:


1. The reviewer visits the review page to review photos.
2. The reviewer selects an award and triggers review operation, calling JavaScript
function and use AJAX asynchronous transfer technology to send review request
and related data to ReviewServlet.
3.The ReviewServlet calls the competition relation data access object to update
data, records the photo award level, and then returns the result of the operation.
4. Repeat 2-3 until all photos are reviewed.

68 | P a g e
In this flow, step 2 and step 3 can be constantly repeated until all this competition’s
photos have been reviewed. And the reviewing can be interrupted or continued at any
time (unless the completion’s review function has been locked by administrator). But
currently there is no visible marker or sign showing the specific photos already
reviewed which may cause some confusion to the reviewer. Therefore, I will solve this
problem in my future work.

3.3.9 Display of competition module

Display of competition module allows the user to view all photos and related information
for all photography competitions, and sort or give likes to these photos. Since the display
function of this module is similar to the individual representative shown in 3.3.2, the
function of sorting according to given conditions is described here. The detailed
sequence diagram is shown in Figure 3.11.

Figure 3.11 The sequence diagram of sort according to given conditions

The basic flow of sorting according to given conditions is as follows:


1. The users can sort according to specific conditions in the competition display
page, such as: uploaded time, modified time and so on.
2. The photo display page sends request and related data to the
GetPicturesServlet.
3. The Servlet calls competition relation data access object for query the database
under specific conditions (for example, flashback according to uploaded time).
And then returns a collection of picture instance objects, which meet relevant
conditions and sorts.
4. Finally jump to the new page, the relevant photo information is also returned
to the new page.

69 | P a g e
When the sever intend to return the sorted page to the client, the specific JSP will
extract URLs from the obtained collection of picture instance objects, and use their
URLs to build the HTML code.

3.3.10 Display of competition result module

The Display of Competition Result module is designed to allow the user to view the
winning works of the photo competition and to give their favorite photos like’s. The
sequence diagram of display of competition result is shown in Figure 3.12.

Figure 3.12 The sequence diagram of display of competition result

The basic flow of this module is as follows:


1. The user visits the display page of competition result.
2. The competition result page sends a request to the GetPicturesServlet.
3. The GetPicturesServlet calls the competition data access object for the query
operation on the database, and returns competition information.
4. The GetPicturesServlet calls the competition relation DAO and the picture
DAO for the database query operation, and extracts the picture instance object
from awarded photos of this competition.
5. Repeat 4 until all picture instance objects from awarded photos of this
competition are gathered.
6. Return URL and relevant information of all photos to the competition result
page.
7. The competition result page requests picture resources from server and
displays them.

70 | P a g e
During repeating step 4, the Servlet will user different parameters (for different
awards) to get all wining photo’s instances, and then the specific JSP will use these
instance’s URLs to build the HTML code for the client page.

3.4 The design of Background system

3.4.1 The design of system role and authorization mechanism

There are 4 roles in the system, as shown in Table 3.1

Table 3.1 System role and privilege

Number Role Description


Can only manage their own resources or
01 Ordinary users
competitions they participated in
Can review the prizes for specified photography
02 Review users
competitions
Cannot create a competition, but can delete
Competition
03 photos of the specified competition and lock the
administrator
user
Can create the competition, modify the
competition and set competition results, and can
04 Super administrator
delete photos of the specified competition and
lock the user

The access control mechanism for this system adopts the resource privilege mode
based on system roles and system functions in table 3.1. Each page is regarded as a
separate resource. When different roles access certain resources, the system needs to
check weather the users have the privileges to access relevant pages and use relevant
functions. The setting of resource privilege prevents non-administrator users from
violating the privilege, and avoids the behavior that may damage the system [14].
The objectives of this access control mechanism:
1. After the user logs in, the system queries the user’s role information, and saves
related information in the session for later usage. When the user attempts to
execute a high-privilege operation, the system will check the user’s role
information saved in the session, avoiding frequent access to database.
2. When the user accesses specific pages and perform operations on the
71 | P a g e
resources, the system will query the user's role information to determine whether
the resources belong to this user, and whether the user has the relevant privilege
to operate. If he does not meet the conditions, he will be returned to the previous
page with a warning given. This processing can ensure the safety of system
operations.
3. Some pages are shared by different roles, and will display different modules
and content based on the current user's role and privilege. The competition
management module is an example. This scheme will achieve highly role-oriented
and flexible page functions.

3.4.2 Database tree structure

In this system, many operations involve management of photos and album folders. If
the original data rows are directly stored in the tables of the database, the correlation
among them will be poor, which is not conducive to achieve efficient operation and
management of data, and users cannot perform intuitive and convenient operation on
their own resources, which also easily leads to waste of system resources and inefficient
use of the database.
In order to improve the efficiency of the system and realize the directory tree
resource management, we introduce tree structure in the database. Every object
(including photos, albums, collections) is regarded as a tree node. At the same time, the
ID information of the parent node is added to this tree node’s information. Then the tree
structure among objects is established through corresponding node ID information, and
achieved the directory tree resource management. It highly improves the efficiency of
searching data, and the flexibility of data storage [15]. After that, we can use tree node
information in record to find their father node and child node conveniently.
The tree node records need to include the following metadata:
1. Tree node ID: used to uniquely identify a tree node records
2. Association ID: the unique ID of the object associated with the tree node.
3. Association type: the type of object associated with the tree node (photos,
albums, collections, etc.).
4. Father node ID: the unique ID of this tree node’s father node.
5. User ID: the unique ID of the user who own this node.
6. Layers: the number of layers in which the tree node is located.

72 | P a g e
Through the user ID, the tree node ID and the father node ID, the system can retrieve
the tree structure of the specified user from the database. And the combination of
association ID and association type can point to a specific object corresponding to the
node. The use of the number of layers can greatly improve the efficiency of query to
avoid unnecessary operations.
For example, to find the father object of the current album folder, only 3 steps are
needed:
1. To query the database and take out tree node records binding to the album
folder through the current album folder ID and object type (album).
2. To get the corresponding father node record through the father node ID saved
in the tree node record.
3. To extract the father object of the current album file through association ID
and association type in the father node record.

3.4.3 Storage space management subsystem

We have developed and incorporated an independent storage space management


subsystem into this system, so that photos and other resources can be stored indifferent
devices and different physical address (but the same logical storage address). The
subsystem not only provides possibility for storage space expansion and distributed
storage, but also realizes flexible management of the storage space on the server. At the
same time, we also reference rsync algorithm to design a unique file synchronization
function, it can avoid repetitive transmission of the same data and make the server
synchronization and backup more efficient. The storage space management subsystem
includes two modules: file synchronization module and resource management module.

1. File synchronization module


The file synchronization module mainly serves for data synchronization and backup
among different databases. This module uses a unique algorithm to improve the
efficiency of synchronization, reduce unnecessary data transmission, and avoid
network resources and system resources waste. By using this algorithm, the sender will
not sync all the files to the other side, but identify a different part from the receiver by
its included algorithm, and then transfer it to the other side.
In the synchronization algorithm design of this module, we reference the rsync

73 | P a g e
algorithm in the Unix-like system, which is usually used for data backup, file
synchronization between remote hosts, and network disk data update process. Rsync
algorithm can distinguish different parts of two files by operation, and then only
transmit different parts, which is the most important feature of the algorithm [16].
The main flow of the algorithm is as follows:
(1) The receiver calculates the checksum.
The receiver first divides its file into equal size blocks, and then calculates the
rolling checksum and MD5 checksum for each block, then submit the results to the
sender.
The rolling checksum used in rsync is based on the Adler-32 checksum invented
by Mark Adler, which is a 32-bit weak checksum [17]. While the MD5 checksum is a
widely used 128-bit strong checksum [18].
The reason for using the two checksums in this algorithm is that although MD5
is used to check whether the two file blocks are the same with the low probability of
collision, but its operation speed is lower because of the limitations of computer
hardware and processing speed. Therefore, it is necessary to have a faster rolling
checksum with a slightly lower accuracy rate, but sufficient to determine whether the
two blocks are different. Beyond that, the MD5 checksum used between the same
rolling checksum blocks to ensure that the two blocks are exactly the same. After
checking and comparing two checksums, it is found that the difference between the two
blocks is almost negligible, with the probability of 1/2 ^ (128 + 32) [19].
(2) The sender calculates and compares the checksum
The sender also divides the files into different blocks with the same size as the
receiver, and then quickly computes the rolling checksum of each block. If the
checksum of the block is not the same as that of any block of the receiver, it means that
the block has different content between two sides. If the rolling checksum is the same,
the sender will calculate the MD5 checksum and compare it with the receiver’s MD5
checksum, determine whether they are identical [20].
It is important to note that the file block movement on the sender side is scrolling
rather than jumping at a fixed value. If the content of the current block differs from
the content of any block on the receiver, the block will move back by 1 byte instead of
the size of the entire block before calculating the checksum. Only when the block is
exactly the same as a block on the receiver will it move back by the size of the entire
block. Specific rolling process can refer to Figure 3.13.

74 | P a g e
Figure 3.13 Scrolling diagram of the rsync algorithm

(3) The sender sends data


The sender sends contents of the blocks of checksum mismatch and their location
information to the receiving side. The receiving end updates file contents according to
the obtained data to realize the synchronization of the file.

2. Resource management module


The resource management module is applicable for a variety of resources, including
photos, text, etc. The resource management module, as the core module of the storage
space management subsystem, mainly provides functions for the CRUD operation of
the server resource, which realizes a unique and reasonable storage mechanism to
control system resources (such as disk size, block size, file size, etc.).
Resource management module’s storage structure has five layers, including
(from outside to inside)the server layer, virtual disk layer, resource type layer, block
layer and resource files. Locating and access each resource files need to know the

75 | P a g e
corresponding information of each layer. For example, the full path of a resource is
[Service]/[VirtualDisk]/[ResourceType]/[Block]/[FileName]. The detailed storage
structure is shown in Figure 3.14.

Figure 3.14 Storage structure

(1) Service layer: service layer refers to server or storage device, and it is usually
hardware with operating systems. The service layer can make the system resources
stored in different servers or storage devices, to achieve resource scalability and
distributed storage [21].
(2) Virtual disk layer: virtual disk usually is the root directory file or diskpartition
of the system. And a single service layer object can have multiple virtualdisk layer
objects at the same time.
(3) Resource type layer: the resource type layer is mainly used to divide the
resource type, in order to facilitate the administrator's browsing and management.
(4) Block layer: the block layer is established based on the resource type layer.
Each resource type has multiple block objects corresponding to its own type. At the
same time, each block limited the maximum storage resources.
(5) Resource files: stored resource files.

3.5 Database Design


The database, as the foundation of the whole system, is the key in the process of system
design and development. Efficient system development processing is often based on
the sound and detailed database structure [22]. The data in the database not only
describe the relevant information of each element in the system, but also quantize the
user operations.

76 | P a g e
After analyzing the logical relationship between the system demands and the
system, we draw the demands on data, and set up data tables to meet the demand. We
have designed the E-R relationship among data tables, which are shown in Figure 3.15.

Figure 3.15 ER diagram of main database tables of the system

1. User table
User table mainly stores the user's basic information, including: user name,
password, mailbox, user privilege level, user lock status and other fields, as shown in
Table A.1 in Appendix A. It is the major table of the database and the whole system.
2. Picture table
Picture table is used to store relevant picture information and the relationship
between albums and users, containing 13 fields: photo ID, album ID, user ID,
competition ID, photo name, upload time and total number of browse, and so on, which
are shown in Table A.2 in Appendix A. Each picture has a corresponding recordin this
table.
3. Picture resource table
The picture resource table mainly records information of the picture resource,
which contains the following fields: picture resource ID, associated picture ID,
associated space resource ID and URL, as show in Table A.3 in Appendix A. This table
records the relationship between pictures and resources. It also allows different

77 | P a g e
picture table records link to a same space resource record, which can avoid large amount
of repetition storage and save the storage space of the system. But it also makes the
resource deleting more complicated.
4. Album table
The album table is used to record basic information about the album and the
relation among users, containing 12 fields, such as album ID, album name, user ID,
album class, as shown in Table A.4 in Appendix A.
5. Collection table
Similar to the picture table and the album table, the collection table records the
user's collection information and related logical relationship, including: collection ID,
custom collection name, collected user ID, collecting user ID, and so on, which are
shown in Table A.5 in Appendix A. Combine SourceID field and Type field can define
a specific resource (e.g. a picture or an album)
6. Comment table
The table mainly stores the user's comment and content, containing following
fields: the comment ID, user ID, resource type of the commented object, and ID of the
resource corresponding to the commented object. Regardless of whether the object
being commented is a photo or an album, you can find the relevant data by looking up
the photo table or the album table, as long as you know the relevant SourceID and the
type. The specific structure of the table is shown in Table A.6 in Appendix A.
7. Competition table
Information related to the photography competition is stored in this table,
containing competition ID, competition name, sponsor ID, start date, end date,
published result date, reviewer ID, and review lock status, where reviewer ID refers to
ID information of multiple reviewers with the Varchar data type, as shown in Table
A.7 in Appendix A.
8. Competition relationship table
This table records the logical relationship among the user, the user's photo, and the
photography competition, and the winning results of the corresponding photo,
containing competition relationship ID, competition ID, user ID, picture ID, and result,
as shown in Table A.8 in Appendix A. The reason for not setting a foreign key in this
table is to prevent from disturbing when the administrator deletes the competition or
when the user deletes the photo, which can avoid the photos on the other module from
being displayed normally.

78 | P a g e
9. Tree node table
This table is mainly used to store information about the directory tree structure,
which is one of the most important tables in the database, containing: tree node ID,
node resource type, father node ID, and user ID. The detailed structure of the table is
shown in Table A.9 in Appendix A.
10. Space resource table
This table is mainly used for storing data for the space management subsystem.
Using data in the space resource table and the space block table, you can determine the
unique resource and information about its storage path. The space resource table
contains: resource ID, block ID, original name of resource, resource size, and created
time, as shown in Table A.10 in Appendix A for details.
11.Block table
This table records partial information about the location where the resource is
stored, including the block ID, VDisk, storage status, and remaining storage space. The
detailed structure is shown in Table A.11 in Appendix A.

3.6 Summary of this chapter


This chapter introduces the design of the photo sharing and photography competition
management system, including system structure, module function, background system
and database design. First of all, a detailed analysis of the process of some functions
is conducted through the sequence diagram, and then a detailed description is
performed for the background system, privilege setting and storage space management
module. Finally, the relationship among database tables and detailed table fields are
shown. All of the design processes are explained concisely and clearly.

79 | P a g e
Chapter 4 Implementation of the System

Based on demand analysis and system design of the system in the first two chapters,
we fulfilled the implementation of this photo sharing and photography competition
management system, which is described in this chapter. The implementation of each
module is described by giving corresponding user interface screenshots, procedures and
part of code line (See Appendix B: Part of System Codes).

4.1 Common module implementation


The common part of the system is extracted and encapsulated into the common module
to avoid redundant development. This can also improve the structure of the system, and
reduce the coupling between different modules or functions to achieve a more object-
oriented programming purpose [23]. This system contains two common modules,
namely the directory tree resource management interface and the storage space
management subsystem.

4.1.1 Directory Tree Resource Management Interface

The directory tree resource interface enables users to perform simple and intuitive
operations on managed resources of the system [24], which is used in the Photo
Management module, the Album Management module, the Collection Management
module and Contribution functions.

When the user does nothing, the directory tree interface displays only three
defaulted system folders: the photo folder, the album and the collection folder, as shown
in Figure 4.1 (a). When the user clicks on any one of the folders, the directory tree
interface will be expanded to show its subfolders. If the clicked folder does not contain
subfolders, the folder will be highlighted, as shown in Figure 4.1 (b) below.

80 | P a g e
Figure 4.1(a) The unexpanded directory tree Figure 4.1(b) The expanded directory tree

The main processing flow when a user accesses the directory tree resource management
interface is as follows:
1. When a logged-in user accesses a page that contains a directory tree, the client
sends a request to the server together with the information about the user
2. After the server receives the request and the user data, it submits them to the
GetTreeServlet for processing.
3.The GetTreeServlet calls getTreeByUserName method to access the database,
gets the user’s tree node collection, which is simplified after got, then only the
relevant information is extracted, such as node ID, name, type, etc., and then
passes it to the corresponding JSP.
4. The JSP extracts the relationship among each node from the received data (the
system default photo, album and collection folder as the base), and then constructs
the corresponding HTML code, and finally returns it to the client page.
5. The client page re-uses JavaScript and CSS to display directory tree.
This processing flow mainly describes the initialization of directory tree resource
management interface. But there is a foreseeable problem: some parts of the expanded
directory tree may be lost while refreshing, due to the non-real time data transmissions.
Also, how to save the current status of expanded directory tree before
81 | P a g e
sending request is an important part of this module. Therefore, I have introduced a
variable to save the expanded status of all folder nodes in the directory tree while
transmitting with service. Some background codes for accessing the directory tree
resource management interface are shown in Appendix B.1.

4.1.2 Storage space management subsystem

Storage space management subsystem is mainly used when normal users uploadphotos
and administrators perform storage management or database backup. Because this part
involves system security and key module confidentiality, only the operations when
users upload photos are described below.
The main processing flow of the storage space management subsystem when users
upload photos is as follows:
1.The upload function module calls the createResourceEntityAndURL method of
the storage space management subsystem to apply for allocation of the storage
space.
2. Using createResourceEntityAndURL method and getBlockAuto method, the
distributed block instance is obtained.
3.With getBlockAuto method, all block information stored in the database is
obtained, and then a non–full photo type resources block is picked and returned.
4. With the createResourceEntityAndURL method, the system configuration, the
block instance and URL are allocated to the photo resource, and the relevant
information is stored into the space resource table. The ResID (unique
identification ID) of the record in the space resource table is obtained. And then
the URL address and ResID are returned.
5. Finally, the uploading function module stores the photo to the specified URL
and saves the photo’s UserID, AlbID, ResID and other related data to the
corresponding database table.
This procedure describes the most important part of the resource management
module of storage space management subsystem. Before uploading, the system needs
to find a non-full block for saving the uploaded resource, and the selected block are
only allowed to save the same type resources as the uploaded one. For example, while
uploading photos, the system must find a non-full photo block. After that, the system
will extract the block’s information from database (including Service field and
VirtualDisk field), and combine them to get a complete URL. Then save the resource

82 | P a g e
to the specific URL and save relevant information in database. Otherwise, if there is
not non-full block, the system will automatically generate a new empty block, and save
block’s information in space resource table. Part of the codes for the storage
management subsystem is shown in Appendix B.2.

4.2 Implementation of the major modules

4.2.1 Implementation of the User and Authorization Management


module
The User and Authorization Management module not only realizes login, logout and
management account, but also achieves the user authorization management to improve
the system’s stability and security.

When a user accesses to a specific interface or attempts to use high-privilege


operations (such as creation of photography competition and photography competition
reviewing), the server backstage will check the user’s privilege level and determine
whether he can perform the operation. Without the corresponding operation privilege,
error prompt is popped and the control will return to the previous page. Moreover, when
the user attempts to operate on he own password, information, photos and other data,
the current user's login status will also be verified to check whether theseresources
belong to the user. If the verification is failed, the operation will not be done.This two-
tier review of privileges can avoid malicious attacks, hotlink and other system security
risks.
The user can log in by clicking the Login button at the top right of the page or by
visiting the login page directly. After successful login, users can also use drop-down
menu options at the top the page for account management and other related operations,
including changing password, modifying settings and logout. The effect of the drop-
down menu is shown in Figure 4.2.

83 | P a g e
Figure 4.2 Account Management drop-down menu

The login interface is shown in Figure 4.3, which provides not only the registration
function, but also the password retrieving function. Visitors can click on the “Create a
new account” link below to apply for becoming registered users.

Figure 4.3 Login interface

The main process of the module’s processing when a user logs in is as follows:
1. When the server receives the login request and related information submitted
by the client page, it uses URL mapping of the controller to filter URL, and
transfers them to the LoginServlet for processing.
2. The Servlet calls the doLogin method and submits the received data to it for

84 | P a g e
processing.
3. doLogin method checks the user's request and information. If there is an error,
it will return wrong message and jump to login page. If there is no error, it will
call loginByUserEmail method to verify the user name and password.
4. loginByUserEmail method first calls userDAO to retrieve the database to
determine whether the user name (email) exists. If it does not exist, it returns false,
and if it exists, it will continue to do the password verification. If the authentication
succeeds, it returns true and saves the login status of the current user in the cookie.
If the authentication fails, it returns false.
5. The doLogin method then evaluates the return value of loginByUserEmail. If
it is true, it will return the user name and ID information to the client and jump to
the user’s personal homepage, and if it is false, it will return an error prompt and
jump back to the login page.
During logging in, the User and Authorization Management module firstly needs
to check the request and input information, this can reduce the redundant access of
database and avoid malicious attack. Then it will verify password by compare input
data with database records. After successful login, the system will automatically save
current user’s login status for future authorization. And the login status also can protect
the system for Hotlinking and exceeding authorized access. The main code when the
user logs in is shown in Appendix B.3.
When the user attempts to change his password, he needs to enter the correct
current password and the new password twice. The operation page for modifying the
password is shown in Figure 4.4.

Figure 4.4 The user interface for changing the password

85 | P a g e
The main process of the module’s processing when a user changes his password is as
follows:
1. When the server receives the change password request and information
submitted by the client page, it uses URL mapping of the controller to filter URL,
and transfer them to the ChangePasswordServlet for processing.
2. The Servlet calls the updateUserPassword method and submits the received
data to it for processing.
3. updateUserPassword uses getCurrentUser method to obtain the current login
user instance, and then passes the relevant data to the changePassword method for
validation.
4. changePassword method firstly determines whether two new passwords are the
same. If not, it will interrupt and return false;; if yes, it will continue to verify the
user's old password. If the password does not match that in the database, it will
interrupt and return false. When both the two previous judgments are true, the
method will encrypt the new password, and call the user DAO update method to
update the data in the database.
5. Finally, the updateUserPassword method returns corresponding results to the
client based on the returned boolean value.
Although the client page have already verify whether the two new passwords are
the same by using JavaScript before sending request, but it is still necessary for the
server side to check it again to prevent malicious attack. And the password saved in
database has already been encrypted, so if the server wants to verify or change
password, the input data must be encrypted by the same way before verify or update.
Part of codes to change the password is shown in Appendix B.4.

4.2.2 Implementation of the Personal homepage

One of the core demands of the photo sharing and photography competition
management system is to share photos with others. The functions of this module is to
show the user's personal information and photos, and to allow others to access, view
the photos and communicate with him.
This module’s interface is the user's personal homepage. The left part of the page
shows his personal information, including the name, the number of likes obtained, the
number of followers, the total number of photos, the total number of albums and so on.
Under the user's personal information, you can also search for other users and jump to

86 | P a g e
their personal homepages. At the right of this page, there are the owner's representative
works and selected albums. The representative works is a set of photos that is selected
by the owner by moving them into a special folder or are selected by the system which
are of the top three photos in the rank of descending order of click numbers. The
selected albums are chosen in a similar way. The representative works also have a
rotation function. The layout of the personal homepage is shown in Figure4.5.

Figure 4.5 The personal homepage

The main steps for obtaining the user’s representative works are as follows:
1. When the client attempts to access the user's personal homepage, it sends
relevant requests and data to the server. The server-side backstage then submits
the requests and data to the HomepageServlet for processing according to the URL
mapping rules.
2. The Servlet calls showUserhome function, and uses incoming parameters and
getUserByUserName method for query the database to get the user's User class
instance.
3. showUserhome calls getSysTreeNodeByNodeNameAndUserID,
getAbumByTreeNodeID and getPhotosByAbumIDAndSortByViews to access

87 | P a g e
the database. Through the TreeNode table, the Album table, and the relationship
among data in the Photos table, The method obtains the user’s representative work
folder, and take outs the list of objects containing up to 3 photos in the rank of
descending order of click numbers.
4. Then the method determines the size of the list. If the photo number is less than
three, it uses getPhotoByUserIDAndSortByViews to take out the lack part, and
mergers the new list and the previous list.
5. Finally returns the list of representative photos.
The automatically generation of representative works may cause some
comprehension difficulties. Therefore I would like to explain the major parts of this
procedure (step 3 and 4). While obtaining the user’s representative works, the system
firstly will extra three photos with the highest click numbers from current user’s
representative work folder. If the photos in current user’s representative work folder
are less then three (e.g. only have two photos), then the system will extract the highest
click number photos for all the rest folders for supplement (e.g. find one from all the
rest folders for supplement). Part of the codes to obtain the main representative works
of the user is shown in Appendix B.5.
Users can also comment on the photos while browsing them. The comment
interface is shown in Figure 4.6.

Figure 4.6 The user interface for comment

88 | P a g e
The main process of the module’s processing when a user comment photos is as
follows:
1. After the user completes comments in the photo enlarge page and clicks submit,
the client sends a request and related information to the server-side designated
Servlet for processing.
2. CommentServlet calls postComment function to obtain the current logged-on
user’s instance object, create a new Comment instance object and store relevant
information submitted by the client page in it. At the same time it calls
setCreateTime method to save the time of the comment operation, and then calls
comment DAO to insert the relevant data into database table.
3. Finally, the method returns the Comment instance to servlet and JSP, so that the
newly published comments are displayed on the new page.
The process of user comment photos is quite simple, and the key point of this
process is to create an instance for the comment operation and it’s contents, then
persistent it into database. The core codes when commenting are as shown in
Appendix B.6.

4.2.3 Implementation of the Photo Management module

This module realizes user operation and management of photo resources. It is closely
related to the Album Management module and the Collection Management module, as
the basis for their implementation.

In the photo management page, the user can do operations on the photos through
directory tree on the left side and operation buttons on the upper right side, including:
uploading photos, editing information, moving, copying, deleting and participating in
competitions. The user can also click on the photos on the right to enlarge them. The
photo management page is shown in Figure 4.7.

89 | P a g e
Figure 4.7 The photo management page

When the user tries to operate on the photos, he needs to click the "Select "
button on the left side of the button bar, and the page will display the hidden check
box, so that the user can select the desired photos. Then the user can perform the 6
operations described above. In the following, only the moving function is described,
and the function interface for moving photos is shown in Figure 4.8.

90 | P a g e
Figure 4.8 The user interface for moving photos

The processing steps of moving photos is as follows:


1. After the user selects the photos to be moved and clicks the Move button. This
page will call JS function to visualize the directory tree for the user to select the
desired destination folder.
2. After the user selects the target folder and clicks OK, this module will call the
JS function again and use AJAX technology to send data and a request
asynchronously to the server.
3. They are transferred to the MoveItemServlet for processing. The Servlet uses
the incoming object file’s TreeNodeID to obtain the album's Album type instance,
and then passes PhotoID and AlbumID to the movePhoto method for processing.
4. The movePhoto method checks whether the moved photos and the destination
album are both belong to the user. If not, a false will be return directly. Then it
checks whether the destination album is the same as the one, which contains the
photos to be moved. If yes, a false will be return directly.
5. If the previous two judgments are true, the total number of photos of the album
to which the moved photo belongs is decremented by one, and the total number of
photos of the target album is incremented by one, the album ID of the

91 | P a g e
moved photo is changed to that of the target album, and the database information
is updated.
6. Finally, the MoveItemServlet will send new data back to the JS function, which
will use the data to modify page elements, with the deleted photos no longer
shown.
In this procedure, the system updates database three times in step 5, including:
updates PicNum (the total numbers of photos) of the target album’s data in Album table,
updates the PicNum of the current album’s data in Album table and updates the AlbID
(the ID of the album containing this photo) of the moved photo’s data in Picture table.
If one of three updates fails, it may cause some big mistake or bugs, because the other
two updates may still successfully finished. Therefore, I have combined these three
operations in a method, and if any update fails, the system will make roll back the other
two executed updates. Part of the codes for moving photos is shown in Appendix B.7.

4.2.4 Implementation of the Album Management module

Album Management module’s function is similar to the Photo Management module. In


the album management page, the user can perform operations such as modifying,
moving, copying, deleting photos and albums, creating albums, but cannot uploading
photos. Because the implementation detail and methods are similar to the Photo
Management module, to avoid redundancy, only the modifying function is described
below, and the user interface for modifying albums is shown in Figure 4.9.

92 | P a g e
Figure 4.9 The user interface for modifying albums

The processing steps of modifying albums is as follows:


1. After the user click the modify button, JS will use AJAX asynchronous
technology to communicate with the corresponding server, and send a request,
then new album’s information are sent to the ModifyItemServlet for processing.
2. The ModifyItemServlet calls updateAlbum method to modify the album
information.
3. Through the passed AlbumID data, the method obtains the target album class
instance, and then modifies the instance’s name, description and class attributes.
4. At the same time the method checks whether the album belongs to the current
login user, and if not, it will return error "insufficient privilege."
5. If the album belongs to the current login user, it will call DAO to update the
database, and replace the old data with the new data.
6. JS gets the results and updates the page elements.
In this process, the use of album class instance may looks like redundant, but it
can protect the original data in database before update and avoid other unexpected
errors. Furthermore, It is better to check weather the album belongs to the current login
user before createing album class instance, which can avoid unnecessary system
overhead. Part of the codes for modifying albums is shown in Appendix B.8.

93 | P a g e
4.2.5 Implementation of Collection Management module

Collection management module is defined to provide users with the collection-related


functions. When users collect their favorite photos or albums, they can manage them in
this page. Users can click on items in collection page to view or delete them. However,
the resource is not actually owned by the user who collects it, so when the user deletes
a resource, the actual photo or album is not deleted, only the collection information data
associated with the resource is deleted. The function interface for deleting collection
item is shown in Figure 4.10.

The main steps of the module’s processing when a user deletes collection items are as
follows:
1. When a user deletes a collection item, the client page will send a request to the
server. The server submits the request and data to the DeleteItemServlet for
processing.
2. The DeleteItemServlet calls removeCollection method to delete the specified
collection item and related data.
3. The method uses sourceID, sourceType and UserID to extract the
corresponding Collection instance object.
4. The method deletes the data in the database, and modifies the user's total

94 | P a g e
number of collection items.
5. The method returns the results of the operation, and uses AJAX asynchronous
transfer technology to modify the elements of the collection page, and no longer
shows the collection item deleted.
The same as discussed in 4.2.3, the delete of collection data and the update of
current user’s total number of collection items also need to be combined for potential
roll back when some error happens. Part of the codes for deleting collections is shown
in Appendix B.9.

4.2.6 Implementation of the Competition Management module

The Competition Management module mainly provides users and administrators with
photography competition-related functions. The super administrator can create a new
competition or modify/delete an existing competition through this module. And
ordinary users can view their participated competitions and contributed photos by using
this module. The competition management page is shown in Figure 4.11.

When a super administrator clicks the “Create Competition” button in the upper left

95 | P a g e
of the competition management page shown in Figure 4.11, the creating competition
page will be jumped to, which is shown in Figure 4.12.

Figure 4.12 The user interface of creating competition

The main steps of the module’s processing when a super administrator creates a new
competition is as follows:
1. The super administrator sends a request of creating competition to the server
after filling in the related information.
2. The server submits the request and the relevant data to the
CreateCompetitionServlet for processing according to URL mapping in the
controller.
3. The CreateCompetitionServlet calls newCompetition method to create a new
competition.
4. The method checks whether the current login user has the privilege to create a
new competition. If yes, the relevant information is stored into a new Competition
instance object, and the insert function of competition DAO iscalled to save the
instance object into the database.
5. Results are returned, and the interface jumps to the competition management
page.
Before the client page sends creating competition request, it will use JavaScript
and AJAX to visualize the sponsor and reviewer’s list respectively (after click “select”),
and also will use JavaScript to check weather the input information is corresponding to
the required format. Part of the codes for creating competitions is
96 | P a g e
shown is Appendix B.10.

4.2.7 Implementation of the Contribution module

By using this module, users can contribute photos in two ways. (1) select the photo they
want to submit in the photo or album management page, and then click on the
“Contribute” button, followed by selecting the competition to contribute to. (2) select
one specified competition in the competition page, then upload photos and provide
relevant information for the photos to the contribution. Figure 4.13 shows the
contribution page of the photography competition management subsystem.

Figure 4.13 The contribution page

The main steps of the module’s processing when a user contributes to a competition is
as follows:
1. When a user confirms his contribution photo, the page will calls Node.js to
process the uploaded photo, and sends a request to the server side.
2. The server sends the request and related data to the ContributeServlet for
processing according to the URL mapping saved in the controller.
3. The ContributeServlet calls uploadPhoto method for incoming data
processing.
4. The uploadPhoto method requests the storage space management subsystem to
assign storage space, URL and the corresponding space resource ID.
5. The method uploads the photo resource to the target address based on the
returned URL.
97 | P a g e
6. At the same time, the method saves the relevant photo information and
competition relationship information to the database table.
7. Finally, the contribution page will show the contribution results to the user.
In this procedure, the user must input the relevant information of uploading photo.
Otherwise, the server will deny the uploading request. Part of the codes for contributing
is shown in Appendix B.11.

4.2.8 Implementation of the Review module

The Review module is only available for reviewers. After a reviewer accesses this
module and selects a specific competition, the user interface will automatically jump to
the review page. Then reviewer can click on the drop-down box below the photo to
review and select award. The function interface for reviewing is shown in Figure 4.14.

The main steps of the module’s processing of reviewing is as follows:


1. The reviewer sends a request and related information to the server, which in
turn submits it to the ReviewServlet for processing.
2.The ReviewServlet calls the changePrize method to modify the award data.
3. The method checks the access level of the current user, and then uses the
getCompetationRelationByPhotoIDandGameID method to get the
CompetitonRelation instances of the target photos, and then modifies the Prize

98 | P a g e
attributes in the instances and update the database with the results.
4. Finally, the results of these operations are fed back to the reviewer.
Once the reviewer select an award from the drop-down box, the reviewing
request will be send to the server, and the reviewer dose not need to click any “submit”
or “confirm” buttons. After that, the server will return the operation result to the client
page, and showing the result by popup window. This way of processing is convenient
for plenty of review operations, but is also may cause some out of sync problems
between the client page and the server database when the network is poor or
interrupted. Part of the codes for reviewing is shown in Appendix B.12.

4.2.9 Implementation of the Display of Competition module

The functions of the Display of Competition module can be fulfilled by the support of
the exhibition page. When a user accesses the exhibition page and selects a specific
competition for displaying, all the thumbnails of the photos for that competition will be
displayed. The user can browse the photos or give like’s by clinking on the “View” or
the “Like” hotlinks below the thumbnails. The user can also select the sorting methods
through the drop-down selection button. The exhibition page for a specific competition
is shown in Figure

99 | P a g e
The main steps of the module’s processing when a user sets sorting by the upload time
on the exhibition page is as follows:
1. When a user selects arrange by upload time, the client page will send a request
and relevant data to the server, and the server will send it to the GetPicturesServlet
for processing.
2. The servlet calls the sortPhoto method for incoming data processing.
3. The sortPhoto method passes the passed in parameters in to the key-value pair.
4. It calls the getPhotosByCompetitionID method to retrieve the data sorted in
descending order of the upload time in the database and save the data in a
collection of Photo object.
5. The results will be transmitted to the JSP, and JSP modifies HTML page
elements based on the relevant information, and returns the new page back to the
client.

100 | P a g e
In these processing steps, only the specific photos of current page will be obtained
and displayed. For example, the first page will only request the first 15 photos ordered
by upload time, and the second page will request photos ordered by upload time from
16th-30th. This can significantly improve the efficiency of data transmission between
server and client pages and reduce the redundant query for database. Part of the codes
for arranging by upload time is shown in Appendix B.13.

4.2.10 Implementation of the Display of Competition Result module

This module mainly has three functions: to show the winning works, browsing photos
or giving photo likes through the “View” and “Like” link below. The awards page of
this module is shown in Figure 4.16.

The main steps of the module’s processing when a user gives a photo like’s is as
follows:
1. When a user gives his favorite award-winning photo like’s, the client page will
use JavaScript functions and AJAX technology to send a request and related data
to the server.
2. The server submits the request to the LikeServlet for processing.
3.The LikeServlet calls the updateLikeNum method to change relevant
information of the target photo, which is saved in the database, and then the
number of the photo’s likes is increased by one.
4. The LikeServlet returns results to the JavaScript function through
asynchronous AJAX, and then JavaScript function refreshes the number of likes
based on the returned results.
There is one thing that can be improved in the future work. For now, all the visitors
can give their favorite photo Likes, and they can like the same photo multiple times. It
will be more reasonable if one user can give at most only one Like to each photo. Part
of the codes of giving a photo like’s is shown in Appendix B.14.

101 | P a g e
5 System test

5.1 Running environment

During the development of the system, I choose Java as my programming language,


because it is object-oriented and widely used for web-based programing. Another
reason is that I am more familiar with it in comparison with other programming
languages.
And I choose MySQL as database because it is a lightweight database (compare
with Oracle or DB2) and it is free. The most important reason is that it more than
enough in meeting the demands of our system.
I choose MyEclpse as Development tool is because it is very powerful and include
a lot of tools.
I user Apache Tomcat because it is necessary for the Java web development.
And the StarUML and log4j is just widely used in their working area.

5.2 System function test


System function test, as an important part of the system development, allows
developers to detect whether the system has achieved the desired functions, and to
find out shortcomings and vulnerabilities of related functions [25]. After the test, the
developers can remove the bugs and make improvements of the system, ensuring that
the system reach the quality standard [26]. Therefore, we use a variety of test casesfor
the relevant functional testing on the system.

1. Test of the User and Authorization Management module


The User and Authorization Management module is tested by use the administrator and
ordinary user login, access to the review page, and deletion of other user photosas
test case. The details of the test are shown in Table 5.1.

102 | P a g e
Table 5.1 Test cases and results of the User and Authorization Management module

Test projects Test cases Expected results Test results


User name:Neal
Correct password: Successfully login
User login function
Administrator login 12345678 system, and jump to
is working properly
Entered password personal homepage
12345678
Login with the
Jump to false Ordinary users can
general user
Users access to the prompt page, and not access the
account, click the
review page then jump to the review interface
link of the review
personal homepage
page
Add relevant
parameters in the User can not
Delete other users’ Return an error
URL, and try to operate on other
photos message
delete the photo of user’s resources
other users

2. Test of the Personal Homepage module


Table 5.2 describes the test of the Personal Homepage module, with searching for other
users' personal homepages and viewing representative works as test cases.

Table 5.2 Test cases and results of the Personal Homepage module

Test projects Test cases Expected results Test results


Successfully jumps Search and jump to
Search other users' Enter user name:
to TinyBear's TinyBear's
personal homepage TinyBear
personal homepage homepage normally
Go to the personal Representative
Left or right can
View representative homepage and click photos’ scroll
scroll to show the
works the left and right function is working
next representative
scroll icons well

3. Test of the Photo Management module


The Photo Management module is tested by use uploading photos, moving photos,
copying photos and participating in the competition as test cases. Description and test
results are given in Table 5.3.
103 | P a g e
Table 5.3 Test cases and results of the Photo Management module

Test projects Test cases Expected results Test results


After successful
uploading, the Photo uploading
Select local photos
Uploading photos uploaded photos are function is working
to upload
displayed in the well
page
The current page no
Select photos and longer displays the Photo moving
Moving photos move to another photo, and views the function is working
album folder target album, well
including the photo
Create a new photo
Photo copying
Select the target that is the same as
Copying photos function is working
photo to copy the destination in
well
the current directory
Inquire about
Function of
Select photos for participated
Participating in the participating in the
participating in the competitions in
competition competition is
competition competition
working well
management page

4. Test of the Album Management module


Table 5.4 describes the test of Album Management module, with creating a new album
and editing the album information as the test cases.

Table 5.4 Test cases and results of the Album Management module

Test projects Test cases Expected results Test results


Create a new
Function of creating
album, but do not Show unnamed
Create a new album a new album is
enter the album album
normal
name
Function of
Modify the album Show new album modifying album
Modify album name
information name information is
normal

104 | P a g e
5. Test of the Collection Management module
Table 5.5 describes the test cases and related conclusions of the Collection Management
module.

Table 5.5 Test cases and results of the Collection Management module

Test projects Test cases Expected results Test results


Jump to the Function of
Click the collection
Access collection corresponding accessing collection
item
target interface is working well
Favorite page does
Function of deleting
Select the collection not display this
Delete collection collection item is
item to delete collection target
working well
anymore

6. Test of the Competition Management module


The Competition Management module is tested by use creating a new competition and
deleting a competition by super administrator as the test cases. The description and
test results of the test are shown in Table 5.6.

Table 5.6 Test cases and results of the Competition Management module

Test projects Test cases Expected results Test results


The administrator
The competition
Administrator creates a new Function of creating
management page
creates a new competition, and a new competition is
shows the newly
competition enters the relevant working well
created competition
information
Deletes a The competition
The administrator Function of deleting
competition with the management page
deletes a a competition is
administrator does not show the
competition working well
account deleted competition

7. Test of the Contribution module


Table 5.7 describes the test cases and results of the test of the Contribution module.

105 | P a g e
Table 5.7 Test cases and results of the Contribution module

Test projects Test cases Expected results Test results


Function of
Upload photos and Find the participated
uploading photos
Participate in a choose the competition in the
and participating in
competition competition to competition
the competition is
participate in management page
working well

8. Test of the Review module


Table 5.8 describes the test cases and results for the Review module.

Table 5.8 Test cases and results of the Review module

Test projects Test cases Expected results Test results


Access the review
page with the Refresh the current Function of
Review awards account of the page, and reviewing reviewing awards is
reviewer, and review results are reserved working well
the photos

9. Test of the Display of Competition module


Table 5.9 describes the test of the Display of Competition module, with selecting
sorting methods and giving like to photos as the test cases.

Table 5.9 Test cases and results of the Display of Competition module

Test projects Test cases Expected results Test results


Select the photo
sorting method in
the works display
page, with sorting All sorting according Function of photo
Select sorting
according to the to the relevant sorting is working
methods
upload time, the demands well
number of browse
and the number of
giving likes

106 | P a g e
The count of giving
Function of giving
Give like to photos Give like to photos likes is increased by
likes is working well
one

107 | P a g e
10. Test of the Display of Competition Result module
Table 5.10 describes the test cases and the results for the Display of Competition
Result module.

Table 5.10 Test cases and the results of the Display of Competition Result module

Test projects Test cases Expected results Test results


Visit the competition
Function of showing
result page of the The result page of
Show the results of the results of the
specified the competition is
the competition competition is
competition, view displayed normally
normal
the winning works

108 | P a g e
6 Conclusion and Future Work

6.1 Conclusion

This paper describes the design and implementation of the J2EE-based photo sharing
and photography competition management system. This system provides a user-
friendly platform that highly meets the needs of photography enthusiasts and the current
market. During the design and development of this system, we have completed the
following work:
1. An in-depth investigation is conducted through communication with
shutterbugs. And according to the investigation results, system requirements are
analyzed by using UML and object-oriented methods, and the relevant use case
diagrams are drawn.
2. The overall structure of the system is designed. The system is divided into two
subsystems: the photo sharing subsystem and the photography competition
management subsystem. The former consists of 5 modules: the Personal Homepage,
the Photo Management, the Album Management, the Collection Management, and the
User and Authorization Management. The latter consists of 6 modules: the User and
Authorization Management, the Competition Management, the Review, the
Contribution, the Display of Competition and the Display of Competition Result.
3. The detailed design is performed for each module, and the processing sequence
diagram of each module is drawn, the processing steps of each module is also given.
4. The database design is fulfilled. The E-R chart and database tables are given.
We have adopted a tree structure in the classification of resources, so that the resources
and records in the database have a good relationship and structure.
5. A unique storage space management mechanism is proposed and incorporated
into the system, which provides efficient and flexible storage management for resources
on the server, and makes the file synchronization and transmission more efficient.
6.The UI of the system and each module are designed and implemented. Finally,
the whole system is programed and tested, and bugs are removed based on the test.

109 | P a g e
6.2 The direction of further work
Although the design and implementation of the system have been finished, it is far from
perfect, and there exists improvements that can make the system works better. For
example, the webpages are not pleasing enough to the eye, and the correlation among
multiple subsystems is not strong. Tables and structures of the database can also be
further optimized. Besides, the system has not been optimized for performance in large
workload, such as the response time, the maximum number of concurrent users, and
etc. I believe there exists a large development space in the future.

110 | P a g e
References

[1] Lu, Qian. “In 2015, China's domestic tourism exceeded 4 billion, and the tourism
industry contributed over 10% of GDP.” The State Council The People’s Republic
of China, 4 Jan. 2016. 10 Feb. 2016.
<http://www.gov.cn/xinwen/2016-01/04/content_5030593.htm>
[2] Tan, Jie Ni. “The Study on the Photography behavior of tourist.” Diss. Chongqing
Normal University, 2011.
[3] Hong-tao, D. E. N. G. "Research on Processing Method of Tree Structure
Information in Relational Database [J]." Journal of Jianghan University (Natural
Sciences) 2 (2010): 016.
[4] Chung, Lawrence, et al. Non-functional requirements in software engineering.
Vol. 5. Springer Science & Business Media, 2012.
[5] Tilkov, Stefan, and Steve Vinoski. "Node. js: Using JavaScript to build
high-performance network programs." IEEE Internet Computing 14.6 (2010):
80-83.
[6] Juan, T. I. A. N., and X. U. Zhao. "Analysis & Consideration of MVC Design
Model Based on J2EE [J]." Computer and Modernization 10 (2010): 015.
[7] Yang, Jin Cheng, L. Qiang, and Y. E. Han-Minb. "Realization of Web Treeview
Component Based on Ajax." Journal of Shanghai University of Electric
Power 26.2 (2010): 205-209.
[8] Sun, Chang Ai, et al. "Object-Oriented Requirements Analysis Based on UML."
Acta Aeronautica ET Astronautica Sinica 24.1 (2003): 75-78.
[9] Alur, Deepak, et al. Core J2EE Patterns (Core Design Series): Best Practices and
Design Strategies. Sun Microsystems, Inc., 2003.
[10] Lu, Rongxing, et al. "Study and implementation of MVC design pattern on J2EE
platform." Application Research of Computers 20.3 (2003): 144-146.
[11] Fei, W. A. N. G. "Rationalize the View Tier of MVC." Science Technology and
Engineering 22 (2009): 067.
[12] WU, Chenqing, and Zhenhua RONG. "Implementing Web Application Using
JSP/Servlet Technology [J]." Computer Engineering 1 (2001): 066.
111 | P a g e
[13] Shilin, Xiao Aihua Wang. "A COMMON WAY IMPLEMENTS DATA ACCESS
OBJECT PATTERN FOR J2EE APPLICATION [J]." Computer Applications
and Software 9 (2005): 051.
[14] Gong, Fu Qiang. “Development and Application of User Authority Management
System Based on RBAC.” Diss. Northwestern Poly-Technical University, 2007.
[15] Ramakrishnan, Raghu, and Johannes Gehrke. Database management systems.
McGraw Hill, 2000.
[16] Tridgell, Andrew, and Paul Mackerras. "The rsync algorithm." (1996).
[17] Wikipedia contributors. "Rolling hash." Wikipedia, The Free Encyclopedia.
Wikipedia, The Free Encyclopedia, 4 Mar. 2016. Web. 17 Aug. 2016.
<https://en.wikipedia.org/wiki/Rolling_hash>
[18] Wikipedia contributors. "MD5." Wikipedia, The Free Encyclopedia. Wikipedia,
The Free Encyclopedia, 19 Mar. 2016. Web. 21 Aug. 2016.
<https://en.wikipedia.org/wiki/MD5>
[19] Tang, Xiao-Di, et al. "Design and implementation of remote file synchronization
system based on difference." Computer Engineering and Design 31.20 (2010):
4389-4392.
[20] Hao,Cheng. “The Core Algorithm of Rsync”. CoolShell. 17 May. 2012. 13 Feb.
2016.
< http://coolshell.cn/articles/7425.html >
[21] Sun, Jie. “Design and Implementation of Distributed Storage and Management of
Spatial Data” Diss. Jilin University, 2015
[22] XU, Chang-sheng, Chao DAI, and Li XIE. "Research of rapid development of
web application [J]." Computer Engineering and Design 12 (2004): 037.
[23] Freeman, Eric, et al. Head First Design Patterns: A Brain-Friendly Guide. "
O'Reilly Media, Inc.", 2004.
[24] ZHANG, Yu-fang, Xiang-qian Hu, and Zhong-yang Xiong. "Building treeview
with recursive algorithm in JSP [J]." Computer Engineering and Design 1 (2005):
014.
[25] Myers, Glenford J., Corey Sandler, and Tom Badgett. The art of software testing.
John Wiley & Sons, 2011.
[26] SHANG, Dong-juan, et al. "A Study of Test Cases and Reuse in Software Testing
[J]." Computer Technology and Development 1 (2006): 021.

112 | P a g e
Appendix A: Database Tables

Table A.1 User table

Field Description Data type Remarks


UserID User ID INT Primary Key
Username User name VARCHAR Not Null
Password User password VARCHAR Not Null
Email User email VARCHAR Not Null
BackupEmail Backup email VARCHAR
Register Register time DATETIME Not Null
Status User level INT Not Null
Locked Locked state TINYINT Not Null
Total number of
PicNum INT Not Null
photos
Total number of
AlbNum INT Not Null
albums
Total number of
CollectNum INT Not Null
collections

Table A.2 Picture table

Field Description Data type Remarks


PicID Photo ID INT Primary Key
PicName Picture Name VARCHAR Not Null
AlbID Album ID INT Foreign Key
UserID User ID INT Foreign Key
ComID Competition ID INT
Class Picture class VARCHAR
Shooting location
Location VARCHAR
label
Description Relevant description VARCHAR
Time Shooting time DATETIME
Create Uploaded time DATETIME Not Null
Modify Modified time DATETIME Not Null

113 | P a g e
Total number of
ViewNum INT Not Null
browse
LikeNum Total number of likes INT Not Null

Table A.3 Photo resource table

Field Description Data type Remarks


PRID Picture resource ID INT Primary Key
PicID Associated photo ID INT Foreign Key
ResID Associated resource ID INT Foreign Key
Width Width INT Not Null
Height Height INT Not Null
DB Storage space name VARCHAR Not Null
URL Storage address VARCHAR Not Null

Table A.4 Album table

Field Description Data type Remarks


AlbID Album ID INT Primary Key
AlbName Album name VARCHAR Not Null
Description Description VARCHAR
UserID User ID INT Foreign Key
Class Album class VARCHAR
Location Location label VARCHAR
Create Created time DATETIME Not Null
Modify Modified time DATETIME Not Null
Cover storage
CoverUrl VARCHAR Not Null
location
Total number of
PicNum INT Not Null
photos
Total number of
ViewNum INT Not Null
browse
Total number of
LikeNum INT Not Null
giving likes

Table A.5 Collection table

114 | P a g e
Field Description Data type Remarks
ColID Collection ID INT Primary Key
Custom collection
ColName VARCHAR Not Null
name
SrcUserID Collected user ID INT Not Null
DesUserID Collecting user ID INT Foreign Key
SourceID Collected object ID INT Not Null
Collected object
Type VARCHAR Not Null
type
Create Collected time DATETIME Not Null
Description Description VARCHAR

Table A.6 Comment table

Field Description Data type Remarks


ComID Comment ID INT Primary Key
UserID User ID INT Foreign Key
Type Resource type of the VARCHAR Not Null
commented object
SourceID ID corresponding to the INT Not Null
resource
Content Comment content VARCHAR Not Null
Create Created time TimeStamp Not Null
ReplyID Reply to comment ID INT

Table A.7 Competition table

Field Description Data type Remarks


ComID Competition ID INT Primary Key
Title Competition name VARCHAR Not Null
Competition
ManID INT Not Null
administrator ID
Start Start date DATETIME Not Null
End End date DATETIME Not Null
Published result
Result DATETIME Not Null
date
RevID Reviewer ID VARCHAR Not Null

115 | P a g e
Locked Review lock status TINYINT Not Null

Table A.8 Competition relationship table

Field Description Data type Remarks


Competition
CRID INT Primary Key
relationship ID
ComID Competition ID INT Foreign Key
UserID User ID INT Not Null
PicID Picture ID INT Not Null
PicName Picture name VARCHAR Not Null
Create Competition Time DATETIME Not Null
Result Winning results INT Not Null
Locked review
Locked TINYINT Not Null
status

Table A.9 Tree node table

Field Description Data type Remarks


Tree node unique
NodeID INT Primary Key
identification ID
Type of the object
Type corresponding to the VARCHAR Not Null
node
ID of the object
SourceID corresponding to the INT Not Null
node
Father ID of the tree
ParentID INT Not Null
node
Name of the node
NodeName VARCHAR Not Null

UserID User ID INT Foreign Key


Create Created time DATETIME Not Null
Modify Modified time DATETIME Not Null
The number of layers in
LevelNum INT Not Null
the tree

116 | P a g e
Table A.10 Space resource table

Field Description Data type Remarks


ResID Resource ID INT Primary Key
BlockID Block ID INT Foreign Key
Original name of
Name VARCHAR Not Null
resource
Format Resource format VARCHAR Not Null
Type Resource type VARCHAR Not Null
Statue Deletion status INT Not Null
Size Resource size INT Not Null
Create Created time DATETIME Not Null
Modify Modified time DATETIME Not Null
Description Description VARCHAR

Table A.11 Block table

Field Description Data type Remarks


BlockID Block ID INT Primary Key
VDisk Vdisk VARCHAR Not Null
Type Storage type VARCHAR Not Null
Status Full storage status INT Not Null
Remaining storage
RestSpace INT Not Null
space
Create Created time DATETIME Not Null
Modify Modified time DATETIME Not Null

117 | P a g e
CONCLUSION
ONLINE ART GALLERY is a application software and it is very helpful
for the art lovers and others who wants to know the addresses where this kind of
arts will we sold.
This application helps the end-users to search their arts and paintings and
they can place order for the selected pieces. The enduser can also get the
information about the art exhibition and the respective address, so, that they can
visit to those exhibitions.
Art Gallery brings you an opportunity to view online art exhibitions at our
Online Art Gallery we bring you details of all art exhibitions held in the past and
the forthcoming show. The Online Art Gallery is updated daily, so the user can
view and buy the latest collection of contemporary art online from any where in
the world.

FUTURE SCOPE OF WEB DEVELOPMENT:

• This project “Online Art Gallery ” gives sopes for the further
enhancement.
• The product can enter any user requirement.
• The application is currently stand alone and can be extended for the web.
• This gives a very good knowledge about webapp

BIBLIOGRAPHY

References and Resources:

• HTML , CSS, BOOTSTRAP


• W3SCHOOL
• Javatpoint
• MDN Documentation

118 | P a g e

You might also like