JCRM ver. 1.5

This package is a JSP based tool lets you build a simple CRM application. What does this tool provide?

a) a basic schema. In other words it is a common model for your CRM applications
b) a database schema. A set of DDL statements that you may use for setting your JCRM database. JCRM will work with any database through JDBC
c) a standalone Java application for the database filling
d) a set of custom JSP tags you may use for building your WEB application
e) a simple set of JSP pages (examples for JCRM taglib or a generic CRM application you may use as a base for your development)

So, JCRM does not dictate a form/design for your pages. You will use custom JSP tags for access to your database and you are free to choose how to use them and how to incorporate them into your pages.

Basic schema.

This CRM is a database centric application that keeps requests from users and responses from the support staff. Requests could be filled through the web (HTML) form or they could be imported from the some mailbox. For the each new request system will open a new case (ticket). Each case looks like a thread (message board). Each ticket has got an unique ID (will be generated automatically) as well as some name (account name). Name could be a user name, problem description etc. For the each opened thread user will get a reply (how does this reply look like is configurable) with some Id and password he/she may use for access to this thread through your web interface. On the server side your staff will be able to check these tickets, submit replies, run reports etc. User will be able to communicate with your support staff again through email or through the web-based interface. In other words he/she may post new messages to the thread through email or through web-based forms.

Database

JCRM works with any database through JDBC. All connection settings are configurable. So you will provide JDBC settings and names for JCRM tables. JCRM distributive contains DDL statements you have to use for the creation of JCRM tables.

JCRM will use two tables. You may use any names for them and just describe these names in your configuration file. But all the names for the fields are fixed of course.

Table1:

Create table your_name (
Id char(30) PRIMARY KEY,
Status char(1),
Pwd char(6),
Account char(80),
FirstName char(80),
LastName char(80),
Email char (80),
NotifyUser char(1),
NotifyStaff char(1) )

Table2:

Create table your_name (
Id char(30),
Id1 char(30) PRIMARY KEY,
Moment char(14),
Msg long varchar,
Author char(80) )

You must use the same names for columns but depends on your database you can change the type for Msg column. This column (domain) will keep text data for individual messages. You may decide to use TEXT for example. Check out your DB manual for supported SQL data types. You may change also types from CHAR to VARCHAR.

DB loader.

It is a standalone Java application that extracts data from the some mailbox and puts them into database. So you may run this application from time to time (e.g. through 'cron' or 'at' service) and collect requests in the common database. All settings for your mail server are configurable.

How to run:

Java -classpath dbloader.jar;%CLASSPATH% com.cj.jcrm.DBloader your_config_file

Custom JSP tags.

A set of custom JSP tags lets you create/open new ticket, edit ticket, display data on HTML/WML pages etc.

This distributive contains also a set of samples how to use them. You may threat this set as a generic CRM application.

Configuration

All settings should be described in the one text file. Each line describes one parameter in the form of: parameter_name=value.

Empty lines and any line starts with # or // are ignored. Parameters are:

# JDBC settings

# JDBC driver
driver=your_jdbc_driver

# db URL
url=your_db_url

# JNDI name for datasource
# you must set this parameter or (driver,url) pair
jndiname=your_data_source

# user name for JDBC connection. You can omit this parameter.
user=db_user

# password for JDBC connection. You can omit this parameter.
password=db_user's_password

# JCRM tables
table1=your_db_table
table2=your_db_table

# POP mail settings

# mailhost
host1=your_host

# TCP/IP port for POP mail (default value is 110)
port1=110

# POP mail user
user1=user_name

# POP mail password
password1=user_password


# SMTP settings

# STMP host
host2=your_mail_host

# TCP/IP port for SMTP connections. Default value is 25
port2=your_mail_port

# mail domain
domain=your_domain

# 'from' address for outgoing mail
from=support@your_company.com

# user notification template. Each user will get a confirmation for mailed requests.
# You should create some text file describes this notification. Within this file you
# may use meta-symbols %ID (will be replaced by request's Id) and %PWD (will
# be replaced by request's password.
# For example this file may looks like so:

  Your request has been accepted. We will reply as soon as we can. Please
  use the following URL: http://www.acmecompany.com/support for access to your data
  Case id is %ID
  Your password is %PWD

template=path_to_your_file

# List of emails (comma separated) for sending notifications about new requests
# By default is empty (no notification)
notify=alarm@your_company.com

# staff password
# password for your staff. Default value is jcrm
password3=jcrm

# admin password
# password for your admin. Default value is jcrm
password4=jcrm

Security

Each thread (case, ticket) will have own password. User may use this password for access to the thread (read messages and post new requsts). From the backend site you may have two different passwords. One is for your support staff. They may read any thread and post replies. And the second password is for your admin. He/she may delete threads also.

JCRM taglib will provide a rich set of tags for access to your JCRM database. Also these tags lets you check user's identification. This identification will be saved on the session scope in your JSP applications.

Taglib

JCRM taglib is a collection of custom JSP tags. These tags let you to perform various actions with JCRM database such as create ticket, edit ticket, post response, print discussion (etc.) So JCRM tags do all the business logic and what do you need is just add an any appropriate design.

Tag usage (see downloading section for taglib.tld and jcrmtag.jar):

<%@ taglib uri="taglib.tld" prefix="jcrm" %>

on the each page with JCRM tags at the first hand you have to use tag setConfig. With this tag you must describe your configuration file. E.g.

<jcrm:setConfig configFile="c:\\mydata\\jcrmconf.txt"/>

Tags for business logic are:

1) createTicket. This tag creates a new ticket. Parameters are:

  a) account describes a name for this account
  b) firstName describes a name for the user (author)
  c) lastName describes a name for the user (author)
  d) email describes an email address
  e) message describes a message (ticket)
  f) notify describes a boolean value: do we need to notify user about new posts via email. Possible values are true or false. Default value is false
  g) id describes a page scope variable (type is java.lang.String). This variable will keep a ticket ID.
  h) password describes a page scope variable. This variable will keep a password for the created ticket
  See examples: HTML form: createticket.htm  JSP action: createticket.jsp

2) userLogin. This tag creates a profile for the user in the session scope. Parameters are:

  a) ticketId describes an ID for the ticket (case)
  b) password - describes an appropriate password
  See examples: HTML form: userlogin.htm  JSP action: userlogin.jsp

3) staffLogin This tag creates a profile for staff member in the session scope. Parameters are:

  a) name describes an ID for the ticket (case)
  b) password - describes an appropriate password (for regular staff or for system admin)
  See examples: HTML form: stafflogin.htm  JSP action: stafflogin.jsp

4) logout Clears a profile from the current session
  For example: <jcrm:logout/>

5) ifNotAuthorizedUser Executes own body if client is not authorized. So you may add this tag at the beginning for the each page and redirect request to your login page. E.g.:

<jcrm:ifNotAuthorizedUser>
   <jsp:forward page="login.htm"/>
</jcrm:ifNotAuthorizedUser>

6) ifNotAuthorizedStaff Executes own body if client is not authorized as a staff member. So you may add this tag at the beginning for the each page and redirect request to your login page.

7) ifNotAuthorizedAdmin Executes own body if client is not authorized. So you may add this tag at the beginning for the each page and redirect request to your login page.

8) deleteTicket deletes a ticket. Parameters are:

  a) ticketId describes an ID for the ticket (case)

9) updateTicket Body tag updates a ticket. And tag's body is a set of setField tags, where you can define new values for ticket's fields. Parameters are:

  a) ticketId describes an ID for the ticket (case).

10) setField Body tag defines a new value for ticket's field. Parameters are:

  a) name describes a field name. Possible values are (see Table1 definition): Status,Pwd,Account,FirstName,LastName,Email,NotifyUser,NotifyStaff.
  See example: updateticket.jsp

11) getTicket reads all the attributes for the given ticket. Parameters are:

  a) ticketId describes an ID for the ticket (case)
  b) id - describes a page scope variable for data. Type is com.cj.jcrm.ticketBean.
  See example: getTicket.jsp

12) getMessages Returns an array of messages for the given ticket. Output will be sorted by the time. Parameters are:

  a) ticketId describes an ID for the ticket (case)
  b) id describes a page scope variable for data. Type is com.cj.jcrm.messageBean[].
  See example: getThread.jsp

13) postReply Posts a new reply. This tag does nothing if client is not authorized. Parameters are:

  a) ticketId describes an ID for the ticket (case)
  b) message describes a text for the reply

14) openTickets returns an array of ID's for "not answered" tickets. Parameters are:

  a) id describes a page scope variable for data. Type is java.lang.String[].
  See example: openTickets.jsp
 

    For downloading:   DBloader.jar  taglib.tld  jcrmtag.jar
    Sample of configuration file:  sample.txt   DDL:  ddl.txt   Template for responses:  response.txt

 © Coldbeans     Comments?

See also JSOS - the largest collection of servlets and filters.
See also Coldtags suite - the largest collection of custom JSP tags.