File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JForum and the fly likes VB variables? SQL queries? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Products » JForum
Bookmark "VB variables? SQL queries?" Watch "VB variables? SQL queries?" New topic
Author

VB variables? SQL queries?

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
hey,

my english is not good but i hope you can understand what i mean

i have 2 questions:

1) can anyome tell me how I can get the variables there are in .htm pages? for example :${user.username} in user_list.htm. Where are these variables initialized? i would to show another information ${user.denomination} at the screen

2) i have download the forum source code but I can't find the Mysql queries, where are all select, insert... queries of the forum? I have made some modifications in my forumdatabase und i muss access to the databaseinformation from the source code but i can not find how.

Please help me!

thank you


N.D
[originally posted on jforum.net by webparcours]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
webparcours wrote:
1) can anyome tell me how I can get the variables there are in .htm pages? for example :${user.username} in user_list.htm. Where are these variables initialized? i would to show another information ${user.denomination} at the screen


In general, the variables like user map to a User Entity object and any of the properties (e.g., getFoo() = user.foo) and methods (e.g. doX(xxx) = user.doX(xxx) ). You can generally make a good guess based on the existing templates as to what variables are available, etc.

However, if you need to add or figure out exactly what variables are mapped to, you need to find the related *Action object and method that calls the template and see what it puts into the context ( e.g. context.put(...) calls).

As to doing a user.domination... that would require changing user object code and a bunch of other stuff. An easier approach might be to pick a property that you don't care about, e.g. icq, and change the profile templates to display it with "denomination" label. Then in the templates you could use user.icq to display demonination without making code changes.

webparcours wrote:
2) i have download the forum source code but I can't find the Mysql queries, where are all select, insert... queries of the forum? I have made some modifications in my forumdatabase und i muss access to the databaseinformation from the source code but i can not find how.


The queries for the various Database server JForum supports are located in <db type>.sql files under WEB-INF/config/database/<db type> directories. E.g. the default set for MySQLl is WEB-INF/config/database/mysql/mysql.sql.

Note the other .sql files in this directory are variations based on different mysql versions that can be renamed to mysql.sql so JForum will work with them.

In addition to the .sql files, you might want to look at the various DAO (Data Access Objects) packages. The classes here are the ones that use these statements to fill in the JForum Entity objects.
[originally posted on jforum.net by monroe]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
OK, thanks for the info.

N.D.
[originally posted on jforum.net by webparcours]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hi,
I am trying to add some fields to the 'new topic' form to store some more data about the topic, much like the subject and text fields that the form already contains. Unfortunately there are not enough topic fields that I don't care about to utilize the approach you suggested here.

Could you please give me a quick overview of the changes required to make this work (you mention changing the user/topic object and 'a bunch of other stuff')?

Thanks,
Derek
[originally posted on jforum.net by derekoneil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Ok, first, let's look at the data storage layer from the "top" down....

First, there are entity object which a POJO objects with property fields. E.g., the Topic, Forum, and User classes.

The entity objects are populated by the Data Access Object layer (DAO). In general, there is a DAO Interface defined for each entity class. E.g., Topic entities get "filled" by classes that implement the TopicDAO interface, and so on.

The DAO implementations act as the bridge between the entity objects and the physical DB server. That's why there are a bunch of DAO sub-packages. These are variations of the Generic* DAO classes that form the core.

The general logic for the DAO classes is to use Prepared statements to as defined in the *.sql files (config/database/<type>/<type>.sql).

All the DAO implementors for specific databases are "bound" together via a the DAO DataAccessDriver Interface. Classes that implement this, act as a "factory" that the core JForum code uses to get to the DB Specific classes. FWIW, This driver is defined in your configuration properties.

Finally, you have the actual SQL DB tables that store the data.

So, at a minimum, to add support for additional Topic fields, you will need to modify the Topic entity class so it has the new POJO properties. The DAO implementation that your DB uses and related queries so that the entity objects are populated with the new fields. Plus you will need to modify the underlying tables to include the new fields.

In order to support forms that modify these new fields, you will have to modify the view Action objects associated with the forms you want to handle the new fields. These are the classes in the view.forum and view.admin packages. They get mapped to JForum modules (via the moduleMapping.properties file).

The Action classes have the methods with the same name as the JForum actions that are being requested. Generally, you can figure out what Action class you need from just the URL. (E.g. URL like recentTopics/list.page are handled by the RecentTopicsAction.list() method).

There you have it, New Fields 101...
[originally posted on jforum.net by monroe]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
thanks so much for the quick and thorough response!
[originally posted on jforum.net by derekoneil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
hi again,
i successfully added fields to the new topic form that propagate all the way down to the sql database, but now the 'delete topic' functionality does not work. i get the following error stack trace, leading me to believe that the moderation helper relies upon something that you mentioned in your previous post. interestingly though, i can delete a topic by individually deleting each post. any ideas on this?



[originally posted on jforum.net by derekoneil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
What version of JForum are you using? I can't find a method called buildModerationLogFromRequest in either 2.1.6 or 2.1.7?

The error seems to be in parsing an String into an integer variable. That's probably with a config file parameter or the value passed in via a template.
[originally posted on jforum.net by monroe]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
thanks for the quick and (perhaps inadvertently) helpful reply. as it turns out, i had without realizing it been using the 2.1.8 cvs version of jforum. i went back and made the changes in 2.1.7 and everything works fine. thanks again for your help.

derek
[originally posted on jforum.net by derekoneil]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: VB variables? SQL queries?