Recipients --> Overview --> add column "Company"

Use this forum for all questions related to the source code of OpenEMM

Moderator: moderator

teekar
Posts: 1
Joined: Wed Apr 06, 2011 8:12 am

Recipients --> Overview --> add column "Company"

Post by teekar » Wed Apr 06, 2011 8:20 am

Hi,

I have managed to add column "Company" to recipients list by editing /openemm/webapps/core/recipient/list.jsp. Now I just need to know how to add content to column from company_name SQL table or is there some property for it like First Name has property="firstname"? Recipient bean doesn't have "companyname" property...

maschoff
Site Admin
Posts: 2246
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: Recipients --> Overview --> add column "Company"

Post by maschoff » Wed Apr 06, 2011 2:21 pm

Customer-specific profile fields are stored in table customer_1_tbl. For a detailed description of the OpenEMM DB schema please download the table documentation at SourceForge.
OpenEMM Maintainer

mokarram
Posts: 32
Joined: Thu Jan 19, 2012 11:27 pm

Re: Recipients --> Overview --> add column "Company"

Post by mokarram » Sat Mar 10, 2012 7:47 pm

Customer specific data as mapped by Table doc show that in table:

openemm.customer_1_tbl

default feilds (firstname, lastname, etc) mixed in with custom feilds (tel, company,etc).

I cannot get a new feild to appear on the recipient list view. I added:

Code: Select all

<display:column class="name" headerClass="head_name" property="tel" titleKey="recipient.Firstname" sortable="true" />
But the big question is why when property= firstname, lastname, email, gender, and salutation work on the jsp page but custom fields cannot:

Code: Select all

An error occurred
Cause:	org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: ServletException in 'recipient/recipient-list.jsp': javax.servlet.jsp.JspException: Exception: [.LookupUtil] Error looking up property "tel" in object type "org.agnitas.beans.impl.RecipientImpl". Cause: Unknown property 'tel'
So this traces back to org.agnitas.beans.impl.RecipientImpl

Maybe im missing the whole point but in my mind I cannot decompile a class file in order to specify new feilds that I have added to openemm.customer_1_tbl

So please let me know if I should keep looking at the editable .jsp files or is this something that is hardcoded into the class file structure of the program and not meant to be changed?

Thanks

maschoff
Site Admin
Posts: 2246
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: Recipients --> Overview --> add column "Company"

Post by maschoff » Sat Mar 10, 2012 10:27 pm

The display tag in recipient-list.jsp uses request attribute "recipientList" to display recipient data.

Corresponding Action class RecipientAction sets this atttribute indirectly via method getRecipientListFuture via class RecipientQueryWorker (implements Callable to run as separate thread) via method getRecipientList of DAO class RecipientDaoImpl.

In the latter method you can see that only rows gender, firstname, lastname and email are retrieved from the DB. So, if you want to show more data in the JSP you have to read more data from the DB!
OpenEMM Maintainer

mokarram
Posts: 32
Joined: Thu Jan 19, 2012 11:27 pm

Re: Recipients --> Overview --> add column "Company"

Post by mokarram » Sat Mar 10, 2012 10:53 pm

Good evening,
I wanted to avoid this tonight but there is no way! I have read and reread your response about 12 times :)
From what you say, my limited jsp knowladge tells me that the class files you mention are responsible for limiting the DB output for recipient data on the list to the default feilds.
If thats the case perhaps your suggestion ultimately requires me to recompile the class files from the source and include the additional user defined fields there. I am hoping thats not the case and that with the existing .jsp files its possible to make this modification. What do you think?
Thanks
PS. The full translation of the system + ALL help documentation in Español for your 2012 release is availible whenever you would like me to start. I think that it would be a 2 week affair on my end.

maschoff
Site Admin
Posts: 2246
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: Recipients --> Overview --> add column "Company"

Post by maschoff » Sun Mar 11, 2012 10:34 am

You have to patch Java class RecipientDaoImpl to be able to read additional data from the database. Have a look at the source code of method getRecipientList and it will become obvious:

Code: Select all

	    	  Map customerData = new HashMap<String, Object>();

	    	  customerData.put("gender", row.get("GENDER"));
	    	  customerData.put("firstname", row.get("FIRSTNAME"));
	    	  customerData.put("lastname", row.get("LASTNAME"));
	    	  customerData.put("email",row.get("EMAIL"));
OpenEMM Maintainer

mokarram
Posts: 32
Joined: Thu Jan 19, 2012 11:27 pm

Re: Recipients --> Overview --> add column "Company"

Post by mokarram » Sun Mar 11, 2012 10:27 pm

OK Thanks for clearing that up for me. Sometimes its better to know what one will get into before opening the whole can of beans! In this one you have definitely helped me because now I know I have to attemp a clean complie of openemm based on the source code in order to change default views. For that, I shall take at least a week to prepare the right tasks (more views and customizations) for myself in order to make full use recompiling. I have never compiled a binary for a linux system so it should be fun :roll:

On a seperate note, I have totally and completely been absorbed by the power of Linux....Kind of like James Brown in the Blues Brothers when he asks the boys.."Do you see the light"? 8)

maschoff
Site Admin
Posts: 2246
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: Recipients --> Overview --> add column "Company"

Post by maschoff » Mon Mar 12, 2012 8:13 am

If the methods signatures do not change it should be sufficient to recompile just the modified Java class.
OpenEMM Maintainer

mokarram
Posts: 32
Joined: Thu Jan 19, 2012 11:27 pm

Re: Recipients --> Overview --> add column "Company"

Post by mokarram » Tue Mar 13, 2012 12:54 am

I placed the jar library file and modified openemm_build.xml file accordingly (placed it in /home/oe) and pointed script to it along with its name change:

OpenEMM-2012_M1-JARs.tar.gz

I do not get any Spring package errors and the build occurs with warnings - so I think that my Jars setup is right .. theoretically..

However when I try to compile

Code: Select all

javac -g RecipientImpl.java
I get

Code: Select all

RecipientImpl.java:31: package javax.servlet.http does not exist  
And just to be sure I reworked the whole process and used the OpenEMM-2011-JARs.tar.gz just in case.....

But still get the same missing package error>

Code: Select all

package javax.servlet.http does not exist


Am I doing something wrong or is this package missing from both tar bundles?

maschoff
Site Admin
Posts: 2246
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: Recipients --> Overview --> add column "Company"

Post by maschoff » Tue Mar 13, 2012 7:59 am

Java could not find package javax.servlet.http (which can be found in one of Tomcat's JARs). Best would be to put all JARs of Tomcat into the classpath.
OpenEMM Maintainer

mokarram
Posts: 32
Joined: Thu Jan 19, 2012 11:27 pm

Re: Recipients --> Overview --> add column "Company"

Post by mokarram » Tue Mar 13, 2012 10:09 pm

Still no luck...

I have the following in the direcotry /home/openemm/webapps/WEB-INF/lib

Code: Select all

ajaxanywhere-1.2.1.jar           jakarta-oro-2.0.8.jar
ajaxtags-1.3-beta-rc7.jar        jakarta-standard-1.1.2.jar
annotations-api.jar              jasper-el.jar
antlr-2.7.4.jar                  jasper.jar
apache-log4j-extras-1.1.jar      jaxrpc.jar
asm-attrs.jar                    jericho-html-2.4.jar
asm.jar                          jsp-api.jar
aspectjrt-1.2.1.jar              jta-101.jar
axis.jar                         log4j-1.2.8.jar
bsh-1.3b2.jar                    mail.jar
catalina-ant.jar                 mime-util-1.3.jar
catalina-ha.jar                  mysql-connector-java-5.1.10-bin.jar
catalina.jar                     quartz-1.5.1.jar
catalina-tribes.jar              saaj.jar
cglib-2.1.jar                    servlet-api.jar
com.ibm.icu_3.8.1.v20080530.jar  spring-2.5.6.jar
commons-beanutils-1.7.0.jar      spring-oxm-1.5.2.jar
commons-chain-1.1.jar            spring-oxm-tiger-1.5.2.jar
commons-codec-1.3.jar            spring-sources-2.5.6.jar
commons-collections-3.2.jar      spring-webmvc-2.5.6.jar
commons-configuration-1.5.jar    spring-webmvc-struts.jar
commons-dbcp-1.2.1.jar           spring-ws-core-1.5.2.jar
commons-digester-1.8.jar         spring-ws-core-tiger-1.5.2.jar
commons-discovery.jar            spring-ws-security-1.5.2.jar
commons-email-1.0-rc5.jar        spring-ws-support-1.5.2.jar
commons-fileupload-1.1.1.jar     spring-xml-1.5.2.jar
commons-httpclient-3.1.jar       struts-core-1.3.8.jar
commons-io-1.1.jar               struts-extras-1.3.8.jar
commons-lang-2.4.jar             struts-taglib-1.3.8.jar
commons-logging-1.1.jar          struts-tiles-1.3.8.jar
commons-pool-1.2.jar             tomcat-coyote.jar
commons-validator-1.3.1.jar      tomcat-dbcp.jar
displaytag-1.1.jar               tomcat-i18n-es.jar
dom4j-1.6.jar                    tomcat-i18n-fr.jar
ecj-3.7.jar                      tomcat-i18n-ja.jar
ehcache-1.1.jar                  velocity-1.4.jar
el-api.jar                       wsdl4j-1.6.1.jar
hibernate3.jar                   wsdl4j.jar
jakarta-jstl-1.1.2.jar           xercesImpl.jar
The way im doing this is by just trying to complie the recipientimpl.java located in /home/oe/OpenEMM-2011-src/src/java/org/agnitas/beans/impl

the result is:

Code: Select all

RecipientImpl.java:31: package javax.servlet.http does not exist  
import javax.servlet.http.HttpServletRequest;   

maschoff
Site Admin
Posts: 2246
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: Recipients --> Overview --> add column "Company"

Post by maschoff » Tue Mar 13, 2012 10:48 pm

You have to put the Tomcat JARs into the classpath. If you do not know how to do it please read the instructions for javac.
OpenEMM Maintainer

mokarram
Posts: 32
Joined: Thu Jan 19, 2012 11:27 pm

Re: Recipients --> Overview --> add column "Company"

Post by mokarram » Wed Mar 14, 2012 11:43 am

You are a patient man...

Code: Select all

javac -classpath .:/home/openemm/webapps/openemm/WEB-INF/lib/*  /home/oe/OpenEMM-2011-src/src/java/org/agnitas/beans/impl/RecipientImpl.java
Gives me :

Code: Select all

a:33: cannot find symbol                                                   
symbol  : class BindingEntry                                               
location: package org.agnitas.beans                                        
import org.agnitas.beans.BindingEntry; 
So since my classpath understanding began, I can see the the green packages are found and the ones in red are not. The org.agnitas class files are localted in /home/openemm/webapps/openemm/WEB-INF/classes but not in the jar files located in /home/openemm/webapps/openemm/WEB-INF/lib. Do I have to make a Jar file from the existing class files in /home/openemm/webapps/openemm/WEB-INF/classes or somehow include the information as a variable in the --classpath option?

import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.regex.Pattern;

import javax.servlet.http.HttpServletRequest;


import org.agnitas.beans.BindingEntry;
import org.agnitas.beans.Recipient;
import org.agnitas.dao.RecipientDao;
import org.agnitas.util.ColumnInfoUtil;
import org.apache.commons.collections.map.CaseInsensitiveMap;
import org.apache.commons.lang.StringUtils;


Shall I keep at it with understanding the classpath or go fishing for a few days? :)

maschoff
Site Admin
Posts: 2246
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: Recipients --> Overview --> add column "Company"

Post by maschoff » Wed Mar 14, 2012 12:34 pm

You still do not have the Tomcat libs (/opt/openemm/tomcat/lib on my machine) in your classpath. I think best would be for you to go with the build script included in our source tarball.
OpenEMM Maintainer

mokarram
Posts: 32
Joined: Thu Jan 19, 2012 11:27 pm

Re: Recipients --> Overview --> add column "Company"

Post by mokarram » Wed Mar 14, 2012 3:06 pm

ok

Post Reply