Hello Glen,
I still did not able to get what I should do next, as you told that
showWeblogCategoryLinksList($rootCategory false false) only bring the
toplevel categories, it because we specify the $rootCategory each time,
so automatically rootCategory child will always going to be top level
categories.
Actually, my issue is that If I retain the method getWeblogCategories()
in WeblogCategory.java and return a Set of type WeblogCategory then I
have to do a mapping of that Set in orm.xml like it was previously done
<one-to-many name="weblogCategories" mapped-by="parent"
target-entity="org.apache.roller.weblogger.pojos.Weblog" fetch="LAZY">
</one-to-many>)
So, it was previouly mapped by parent, and as now we did not have any
parent, I tried with website but it gave me error as might be because
its target-entity is different. I am really out of ideas.
I was thinking of start submitting patches of my work till now, as just
this issue of showing categories at blog is left.
Thanks
Gaurav
On Wednesday 08 January 2014 08:42 AM, Glen Mazza wrote:
Hi Gaurav, weblog.weblogCategories should still exist as probably a
Set of some sort (Set because of no duplicate Categories allowed), a
List is another option. A weblog does own a collection of categories
even with the change. What should not exist is some child set of
categories under each category--any code asking for the latter can be
removed because there are never any subcategories under a category
anymore.
Might you be getting confused with this code?
#set($categories = $weblog.weblogCategories )
#foreach( $cat in $categories )
The above should be fine, you're not for-eaching child categories
under the *category* but under the *weblog*.
Grepping the code for "#showWeblogCategoryLinksList", is showing that
this is its most common usage:
#showWeblogCategoryLinksList($rootCategory false false)
I.e., just show the top-level categories with no subcategories. With
the new code, all three params are useless now.
I think what we need to do is create a new macro:
#showWeblogCategoryLinksList
that does the same as
#showWeblogCategoryLinksList($rootCategory false false)
And, for backward compatibility (at least so it compiles), have this
macro:
(A) #showWeblogCategoryLinksList($categoryObj $expanding $subcats)
ignore all three of its arguments and just call
(B) #showWeblogCategoryLinksList
So (A) will be a deprecated method to be pulled out at a future time
(maybe in 5.1) -- we'll have to update each of our templates that
currently call (A) to have them call (B) instead -- a simple change to
make.
I'm not sure if I'm answering your questions but I think this might be
what you're getting at.
Regards,
Glen
On 01/07/2014 04:35 PM, Gaurav wrote:
Hello Glen,
I am completed with the Database, JPA, UI Layer. I have tested all
possible ways by creating, deleting, updating entries, categories and
also the complete weblog.
The only single issue left is in Template Layer. Actually in
weblog.vm file for iterating categories list for menu and feeds, it
uses ($weblog.weblogCategories). It try getting list from
WeblogCategory method getWeblogCategories() and wrapping up with
WeblogCategoryWrapper and WeblogWrapper classes. But as this method
is no longer required, as it was for maintaining relations of
parent-child, It did not get any list.
I though of retaining getWeblogCategories() method in WeblogCategory
class, and getting list of categories directly from
JPAWeblogEntryManager but it seems wrong to me according to the
structure. Can you please guide me what should be the best way to go ?
Thanks
Gaurav
On Wednesday 08 January 2014 01:25 AM, Gaurav wrote:
Hello Glen,
I figured out that issues, as I told when I use
getWeblogCategories() method, then the error comes, actually its due
to the reason that I have removed below one-to-many mapping in orm
file and still using the method. As you said, I studied JPA and get
some time into it and learned new things about the mapping
relationship. Now, I am thinking of implementing the same way as
getWeblogEntries are listed as it also come respect to the
weblog/website.
<one-to-many name="weblogCategories" mapped-by="parent"
target-entity="org.apache.roller.weblogger.pojos.WeblogCategory"
fetch="LAZY"></one-to-many>
Thanks
Gaurav
On Monday 06 January 2014 02:36 AM, Glen Mazza wrote:
I don't know, but I don't like that statement
"c.getWeblogCategories().add(c); " A WeblogCategory should no
longer have child weblog categories (they are pure siblings of each
other with no hierarchical relationship), so such an "add"
shouldn't exist. You can have
-->Weblog<---.getWeblogCategories().add(c), that would make sense.
Glen
On 01/05/2014 03:32 PM, Gaurav wrote:
Hello Glen,
I tried finding the that issues, but did not find anywhere. Also
it is created dynamically as I changed the entity name to
category1 then also sameerror come up with "category1_category1"
doesn't exist. I think this might be something I am doing wrong
with the code. As, Today I cleaned up all the code and now
everything is working good. I am successful in creating, editing
and deleting the weblog, entries, categories and everything is
showing good.
Just single problem I am having now is showing the categories list
in feeds and in menu. I figured out after checking that
$categoryObject.getWeblogCategories() is iterated in velocity file
which check for the getWeblogCategories() method of type Set in
WeblogCategory class, Initially I commented this method as the
comments over this method said "Get child categories of this
category". But I think this is neccasary as whenever a category is
created this is called to add a category to Set
"rootCat.getWeblogCategories().add(c);"
Now, Problem is we did not have any parent or root category now,
so how it will going to add to that Set and Also I tried creating
a object of WeblogCategory Class and tried adding it to
getWeblogCategories() method then again. Now When I tired adding
category with this "c.getWeblogCategories().add(c);" the same
error comes up. If I comment this line that add category,
everything works fine again, just did not get any list of
categories in menu and feed.
Also, I am confused what setWeblogCategories() is doing as I did
not find anywhere where it is used for setting categories. Just
the getWeblogCategories() is used with .add for adding child
categories to parent/root.
Below is what I done in addWeblogContents method of class
JPAWeblogManagerImpl.
if (cats != null && cats.trim().length() > 0) {
String[] splitcats = cats.split(",");
for (int i=0; i<splitcats.length; i++) {
WeblogCategory c = new WeblogCategory(
newWeblog, // newWeblog
splitcats[i], // name
splitcats[i], // description
null ); // image
if (i == 0) {
firstCat = c;
}
System.out.println("====Cats==="+c);
c.getWeblogCategories().add(c); //previously it
was root.getWeblogCategories.add(c);
this.strategy.store(c);
}
}
[EL Warning]: 2014-01-05
17:15:22.179--ClientSession(1956103136)--Exception
[EclipseLink-4002] (Eclipse Persistence Services -
2.5.0.v20130507-3faac2b):
org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: Table/View
'CATEGORY_CATEGORY' does not exist.
Error Code: 20000
Call: INSERT INTO category_category (weblogCategories_id,
WeblogCategory_id) VALUES (?, ?)
bind => [2 parameters bound]
Query: DataModifyQuery(name="weblogCategories" sql="INSERT INTO
category_category (weblogCategories_id, WeblogCategory_id) VALUES
(?, ?)")
*
*Also I tried making new ArrayList and new getter setter in
WeblogCategory class, still I got same error.
List<WeblogCategory> catsss = new ArrayList<WeblogCategory>();
catsss.add(c);
c.setList(catsss);
System.out.println("======"+catsss+"============"+c.getList());
Got this error, after adding Arraylist.
[EL Warning]: 2014-01-05
19:42:56.209--ClientSession(1732472947)--Exception
[EclipseLink-4002] (Eclipse Persistence Services -
2.5.0.v20130507-3faac2b):
org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: Table/View
'CATEGORY_CATEGORY' does not exist.
Error Code: 20000
Call: INSERT INTO category_category (list_id, WeblogCategory_id)
VALUES (?, ?)
bind => [2 parameters bound]
Query: DataModifyQuery(name="list" sql="INSERT INTO
category_category (list_id, WeblogCategory_id) VALUES (?, ?)")
Thanks
Gaurav
On Sunday 05 January 2014 05:30 AM, Glen Mazza wrote:
Hi Gaurav, did you try a "control" with your file search method?
I.e., you're saying you're case-insensitive searching on
"category_category" but nothing is getting returned -- did you
try also searching something that you *know* exists in the
project (say, "class", "public", "return", etc.) and your
IDE/search method indeed did return lots of matches? Because if
you get zero search results with the latter we know the problem
is with the way you're configuring your search, not the
non-existence of "category_category". (Also are you searching on
every type of file extension, not just .java files?)
Somewhere in your code the JPA layer has decided to calculate
"category_category" as a table name, I would guess because that's
what is exactly in the code someplace (as you can see the query
below generated "...FROM category_category t0, category t1...").
One useful experiment might be to rename the "category" table
(t1) above to "category2" -- would the SQL above change to
"category2_category2, category2..." or (I think) "...FROM
category_category t0, category2 t1...") If the former, that would
indicate that "category2_category2" is being dynamically
generated from the "category2" table name. If the latter, that
would mean "category_category" is hardcoded somewhere and not
related to the "category" table name you've properly configured.
I probably won't be able to get to this until next weekend
anyway, so I'm going to have you finish it, also as a
confidence-builder for you (if you let JPA push you around now,
it's always going to bully you... :)
Regards,
Glen
PS: Just to clarify, when an pre-5.1-SNAPSHOT user installs
Roller 5.1-SNAPSHOT, the Roller startup should automatically
detect that the system is currently using an older Roller
database and do the database upgrade (creating of new the
"category" table and prepopulation of it). Roller has always
done this as so long as you put the necessary migration scripts
in the right place there should be no problem. However, those of
us already on 5.1-SNAPSHOT like myself before your patch will
need to manually create that table in our database (the Roller
script won't notice 5.1-SNAPSHOT-->5.1-SNAPSHOT, so won't create
"category" by itself.) No problem, we'll just figure out the
necessary SQL statements for Dave and he can add it to his Roller
project blog.
On 01/04/2014 04:47 PM, Gaurav wrote:
Hello Glen,
I searched whole project and did not find anywhere. I think
might be I have done something wrong, as when I start with new
database, everything work just deleting gives me this error. If
I work on old database it even did not start up
(localhost:8080/roller) gives my below error.
I have checked almost everything I can, might be some wrong java
code and anything I done wrong that causes this. Should I submit
by work so you can look on to it, or if we are not in any hurry
than I can look into it again step by step (I prefer second
option if we have one more week. Just another week or so, next
week i have some tight schedule). I know I am taking too much
time, but I am new to this level of Java code, as I worked
maximum time at client side. But I really loving java code and
learned a lot till now, before this I just worked with Java on
small projects. OpenSource Projects really are very powerful and
good way to learn new things.
Exception [EclipseLink-4002] (Eclipse Persistence Services -
2.5.0.v20130507-3faac2b):
org.eclipse.persistence.exceptions.DatabaseException Internal
Exception: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException:
Table 'roller.category_category' doesn't exist Error Code: 1146
Call: SELECT t1.id, t1.description, t1.image, t1.name,
t1.websiteid FROM category_category t0, category t1 WHERE
((t0.WeblogCategory_id = ?) AND (t1.id =
t0.weblogCategories_id)) bind => [1 parameter bound] Query:
ReadAllQuery(name="weblogCategories"
referenceClass=WeblogCategory sql="SELECT t1.id, t1.description,
t1.image, t1.name, t1.websiteid FROM category_category t0,
category t1 WHERE ((t0.WeblogCategory_id = ?) AND (t1.id =
t0.weblogCategories_id))")
Thanks
Gaurav
On Sunday 05 January 2014 12:00 AM, Glen Mazza wrote:
Hi Gaurav, no, that relation shouldn't be needed anymore.
As for the table name, at the top of your orm.xml file the
table name the file maps against is declared -- perhaps you
accidentally called it category_category. I would grep or use a
file search from your IDE of your entire roller source code,
looking for where category_category is being declared --
(probably) has to be there someplace. (More specifically, do a
file search on "DataModifyQuery" -- that's probably exactly
where the problem is.)
Once working, try to import the latest code changes into your
code before submitting a patch (actually create a backup patch
first just in case). Not sure but I think a simple svn update
will do -- svn will identify some files where it will need your
assistance to resolve any differences -- it shouldn't be too
hard or time-consuming to do.
Regards,
Glen
On 01/04/2014 08:55 AM, Gaurav wrote:
Hello Glen,
I just want to know that the below relations in
WeblogCategory.orm.xml are required or not as now the parent
is not used so, I don't think its needed now. I have commented
the below lines.
<many-to-one name="parent"
target-entity="org.apache.roller.weblogger.pojos.Category">
<join-column name="parentid" insertable="true"
updatable="true" nullable="true"/>
</many-to-one>
<one-to-many name="weblogCategories"
mapped-by="parent"
target-entity="org.apache.roller.weblogger.pojos.Category"
fetch="LAZY">
<cascade>
<cascade-remove/>
</cascade>
</one-to-many>
<transient name="inUse"/>
I asked this because, getting categories giving me mysql
exception. The new table is 'roller.category' but it executes
for 'roller.category_category'.
I am not able to get what I have done wrong.
Internal Exception:
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table
'roller.category_category' doesn't exist
Error Code: 1146
Call: DELETE FROM category_category WHERE (WeblogCategory_id = ?)
bind => [1 parameter bound]
Query: DataModifyQuery(name="weblogCategories" sql="DELETE
FROM category_category WHERE (WeblogCategory_id = ?)")
Also, I have changed the getWeblogCategoryByPath to
getWeblogCategoryByName so feeds and other places work fine. I
have able to get catgeory list, new entries are creating
successfully. Just deleting the weblog is giving me above error.
Thanks
Gaurav
On Saturday 04 January 2014 12:53 PM, Gaurav wrote:
Hello Glen,
I have already deleted getPath and getParent and in the mid
of everything. I hope I will be able to complete this by
Monday. If still, I get some major issues due to this, I will
switch to what you suggested. Just give me time till Monday,
as I have done almost 80% of code cleaned regarding the path
and parentcategory. I will get back to you soon with some
patches and then you can test it.
Also, my ICLA have been filed, got the receipt of my ICLA.
Thanks
Gaurav
On Wednesday 01 January 2014 08:07 AM, Glen Mazza wrote:
Gaurav, sorry, it just occurred to me there's a simpler
intermediate step that can be done. While we need the
database table without a path column, and to remove the
"path" member *variable* from WeblogCategory (or its
replacement), we can still keep indefinitely keep getPath(),
just hardcode it to "/" + categoryName, which is precisely
what the old code returns for any top-level category--the
rest of the system can stay just as it did before.
Switching the rest of the code from getPath() to using
getName() can be done at any time, bit by bit whenever,
that's not necessary to implement positioning, that's just a
code cleanup issue. Likewise, for
WeblogCategory.getParent(), it may be as simple as adding a
root category object as part of the Weblog's constructor
(but not saved to the database), and having
WeblogCategory.getParent() just return
website.getParentCategory()--that way all categories for a
weblog will have the same root category as before, and the
rest of the code base should function fine. Once we're on
the new table, then it's an issue of implementing
positioning--getting rid of getParent() and getPath() can be
done by anybody at a later date.
Regards,
Glen
On 12/31/2013 08:09 AM, Glen Mazza wrote:
No problem, I'm available to help (or finish it up) if
needed. For a seemingly simple switch, you're certainly
getting a *full* education of the Roller codebase. :)
BTW, I hope you're not testing via mvn jetty:run, as that
requires you to keep logging in for the first time,
creating a blog for the first time, etc., whenever you
start it. Very inefficient and tiring. Normally I just
build (mvn clean install) and dump the WAR into standalone
Tomcat on my local machine. The database & other
configuration I keep permanently in
roller-custom.properties in the Tomcat lib/ folder, so the
new WAR just takes over with the same configuration, blogs,
accounts, etc., that old WAR was using. (Check the Roller
install guide for full instructions.)
Also vital is that you know how to debug/trace Roller code
in Eclipse or IntelliJ while it is running on Tomcat (or
another servlet container). It's much simpler than it
seems, and will save you a lot of time. These instructions
are for Eclipse but Intellij (my preference) is basically
the same:
http://www.jroller.com/gmazza/entry/eclipse_debug_web_services#ec3.
Checking variable values while it's running will point you
to where problems are much more quickly.
Happy New Year!
Regards,
Glen
On 12/31/2013 06:39 AM, Gaurav wrote:
Hello Glen,
As, I previously told you that the test cases are giving
problem, actually I think we have to do some changes in
Test Cases also, as many of the methods involving path and
parent are removed so, many times in test cases (it did
not get correct values and give errors).
I have successfully showed the categories by website till
now in the admin section. Also, the entries are saved
just, I ran out of memory issue in happen when I save an
entry that entry, although it get saved when I refresh the
page.
Also, as their is not path now, we have to do some changes
in velocity files, as feeds are giving error in showing,
although if I direct enter the URL its working fine. I
have cleared many parts of the code, just I have test of
the roller parts which are linked the path and parent. I
am thinking of correcting the test cases, as I can run
them and if test cases are fine then might be everything
will work fine.
I will return to work on this after 3 days, as I will be
and will get be to it during coming weekend again. I will
wrap this out asap for you to test and will attach patches
coming weekend.
Thanks
Gaurav
On Saturday 28 December 2013 05:49 PM, Gaurav wrote:
Thanks for that info, I have changed my settings in the
eclipse.
Yes, you are right I will leave the ordering part for now
and work on clearing the code for now. For now I will
just add a column in category table with position,
leaving it null for now.
Regards,
Gaurav
On Saturday 28 December 2013 05:33 PM, Glen Mazza wrote:
Your last ImprovedCreateUser.patch had some tab
characters in it, and our project uses spaces for tabs
(just have Eclipse insert 4 spaces whenever you hit the
tab key, with no tab characters.) Very few Apache
projects (any?) are tab-indented today. It is a simple
fix with IntelliJ IDEA (Edit -> Convert Indents -> To
Spaces), I'm sure Eclipse has an equivalent.
For blogs migrating from pre-5.1 versions, we can keep
the position NULL by default (and when you order by
position, with null values, they will come out in any
order, like they do today.) Whenever a new blog is
created with the default three categories, those can be
assigned positions (probably 0-based for leftmost is
best.) For migrated blogs, once the user goes to the
category page and makes a change for the first time,
numbers can be written for the very first time--no
special extra UI is needed for this purpose. But like I
was saying, this is such a lengthy patch you may wish to
forget about the ordering right now--it doesn't work
anyway in Roller right now. It may be best to get us to
the new table and get rid of the paths, and once we're
on that firmer foundation implementing positioning (on
the Category page and in the templates) will be much
simpler.
Regards,
Glen
On 12/28/2013 06:14 AM, Gaurav wrote:
Hello Glen,
I will change the position to be integer, and will
exclude the category where parent null, but still what
can be done for the position as the old data did not
have position, so how and on what basis we have to add
position to it. I was thinking that we can left it as
null, and provide some UI in backend where user can
assign position themselves.
I will take care of spacing, will search what I am
doing wrong. As, I am not sure is that you are talking
about formatting the code, or anything else. As I use
tab (with 4 spaces) in Eclipse IDE.
Thanks
Gaurav
On Saturday 28 December 2013 04:27 PM, Glen Mazza wrote:
BTW, not to be hated, but make sure any code you
submit is space-padded (4 spaces), *not* tab-padded.
Your IDE should be able to convert it for you if
you've been doing tab-padding.
Regards,
Glen
On 12/28/2013 05:06 AM, Gaurav wrote:
Hello Glen,
I am confused on how to add and on what basis we have
to addd position to the new category table. Below two
sql commands can be used for coping data and deleting
the root categories.
create table category (
id varchar(48) not null primary key,
name varchar(255) not null,
description varchar(255),
websiteid varchar(48) not null,
image varchar(255),
position varchar(48)
);
insert into
category(id,name,description,websiteid,image) select
id,name,description,websiteid,image from weblogcategory;
delete from category where name="root";
What do you suggest for this ?
Thanks
Gaurav
On Saturday 28 December 2013 06:56 AM, Glen Mazza wrote:
Take your time, this is a messy change as it affects
many areas of the code. But Roller will be
architecturally much more solid and simpler once
this change is done. I have your ROL-1616 and
ROL-1982 on my plate for this weekend.
Glen
On 12/27/2013 02:40 PM, Gaurav wrote:
Hello Glen,
I have deleted the path and all related methods,
but its seems to me that the path methods like
(getWeblogCategoryByPath) and many other path and
parent related methods, are scattered over the
whole roller. There are many occurrence of these
methods and I have to sort out each piece of code
as now there is no path so, mostly we check for
categoryPath != null in if conditions, so these are
no longer needed.
Also, I as thinking after testing and completing
this we can delete the WeblogCategory and replace
with Category method, as it will be clean. I also
figured out why my tests are failing as during
creating of weblogentry it did not find the
categories, as that class was using old
WeblogCategory table and using that class methods.
I think I will definitely will figure out
everything at the end and will successfully test
with the unit tests.
I am now in the editor part so can display the
categories on front end, I am now all over the
1-2-3-4 steps you mentioned. As soon as I will able
to display the categories (small issues left) at
the backend, I will again go through my changes.
Also, at this time I can only create patch for new
table and migration script, as all other classes
code are interrelated so can't submit now. I will
test every single thing related to categories, then
I will submit my patches.
Although I have learned a lot new things, just
spent last two full days on this sorting out
things, many times ending up nowhere from where I
started. But I am confident that I will definitely
complete this task. Just I am worrying that I must
be taking too much time.
If there is something, you can advice me I would
happy to follow that also.
Thanks
Gaurav
On Friday 27 December 2013 05:09 AM, Glen Mazza wrote:
If it helps, you can provide interim patches, so
long as it doesn't break the current code base.
You may want to create a patch just creating the
new database table (which will be ignored by the
current code) and sql insert-select scripts to
move from the current table to the new one, then
one converting the code to using the new table
without sorting, then (finally) one that
implements sorting of the categories.
Glen
On 12/26/2013 08:12 AM, Gaurav wrote:
Hello Glen,
I have created and updated all necessary files in
JPA and for database, I tried compiling the code
it gave me errors in test cases. As I am not sure
that what I am wrong in this. Although I tried
compiling without running test cases, it worked
fine. I tested it with tomcat and new table
category is created and initial category
(General, Finance and Technology) are created
with the position 1,2,3. Still there are many
thing I have to clean up and sort out and will
test it again.
Thanks
Gaurav
On Thursday 26 December 2013 03:31 PM, Gaurav wrote:
Ok, got your point. I will check on other Roller
parts also if parent name and path aren't be
using in any other part of Roller. I will go
into the RSS and Atom feeds later on, and see
what changes it need. As, till now I have
changed many files and created some, so will
first test this part then go into that feeds part.
Thanks
Gaurav
On Thursday 26 December 2013 03:23 PM, Glen
Mazza wrote:
Sounds good, but may require more work to make
sure all is good with the RSS and Atom feeds as
a result (which I believe rely on path). Where
path is used to check for equivalence, I guess
name (and blog/website ID, if necessary) alone
will do now. We may need to check (if we aren't
already) that no two categories have the same
name, where prior we were checking that no two
paths are the same (i.e., allowing category
paths USStates/Georgia and Countries/Georgia
but now needing to disallow two categories
named "Georgia".)
Regards,
Glen
On 12/26/2013 12:47 AM, Gaurav wrote:
Hello Glen,
I am thinking of removing the path coloumn
also, as it does not make sense now as there
will no subcategories and all will have same
path (like /categoryname). WDYT ?
Thanks
Gaurav
On Wednesday 25 December 2013 04:05 PM, Glen
Mazza wrote:
Yes, the root category can be nuked.
Glen
On 12/25/2013 05:28 AM, Gaurav wrote:
Hello Glen,
I want to know as now all the categories
will be top level, so the root category
which is created by default on addWeblog
isn't needed. So, I can remove that code
also ? I am in half completed with the 1-2
steps will soon submit some patched in jira
issue. You can look on to them whenever you
will get time from other projects.
Merry Christmas :)
Thanks
Gaurav
On Tuesday 24 December 2013 10:57 AM, Gaurav
wrote:
Glen,
Thanks a lot for replying soon on this, I
understand your commitments. As this will
give me more time on working on this issue.
I will give my 100% on this, as I also want
to get into more and more open source
projects. For Now I am focusing on Roller
for starting my contributions in open source.
Thanks
Gaurav
On Tuesday 24 December 2013 10:51 AM, Glen
Mazza wrote:
No, not a rush (unfortunately I can't help
much right now either, as my other project
JSPWiki has a new release going out.) But
please be patient with us on your recent
submitted patches -- we haven't forgotten
you and are happy with your efforts on
this project so far, we just have
full-time jobs and, even after that, other
obligations -- for open source work, we
usually have to beg, borrow and steal time
to work on them.
Glen
On 12/24/2013 12:05 AM, Gaurav wrote:
Hello Glen,
I am going through this having some
issues, although not major till now. I
have still working on 1-2 steps, might be
I am slow as get less time. (Wish we also
have holidays of this festive season in
India :P) Just want to know isn't there
any hurry for completing this asap ?
Although, I am sure will definitely
complete this as I have understood the
structure of Roller completely. Just I
have to go through the JPA more and read
about this.
Thanks
Gaurav
On Saturday 21 December 2013 04:59 PM,
Glen Mazza wrote:
Looking good. Anything you're missing
will become apparent to you as you work
along. The Roller installation guide and
here
(http://www.jroller.com/gmazza/entry/apache_derby_setup)
can show you how to test also with Derby
if you'd like. (It is usually simpler
than MySQL, and another benefit of
working on Roller is that you become
multiple-database-lingual very quickly.)
Glen
On 12/21/2013 06:16 AM, Gaurav wrote:
Hello Glen,
Thanks for helping in this and I with
this much deep information, I can start
working in it. I have started working
on this Issue and have followed your
steps.
1. Created a new table in createdb.vm
and in migration scripts also. I have
for mow stared working on MySQL.
2. In JPAWeblogEntryManagerImpl class,
I have commented updatePathTree and
getRootWeblogCategory methods
3. I have created a new file for now
Category.orm.xml and enterd details of
new table. A new class Category in
weblogger/pojos.
I have created new files for now and
will work on this and add new position
coloum and code regarding this. Other
than UI and template Layer, I think I
have covered all files on which I have
to work on the Database and JPA layers
? Please tell me if I am wrong anywhere
or following wrong workflow.
Thanks
Gaurav
On Saturday 21 December 2013 04:59 AM,
Glen Mazza wrote:
Hi Gaurav, we use Velocity for our
database scripts -- you see a
createdb.vm plus migration scripts
(5.0 to 5.1) -- we'll want our change
in both places (IIRC), new users have
the createdb run and Roller upgraders
with their current DB's have the 5.0
to 5.1 migration script run.
We have multiple issues here and I'd
like to get this done right (I plan on
helping out where you'd like). Namely,
we've moved from a hierarchical
category structure (categories having
subcategories having their own
subcatorgories etc.) to a flat
single-level structure (all categories
are top level) -- that was done a week
or so back. Problem is, the database
tables are still assuming hierarchical
(they will work with flat structures
but are overkill--we don't need a
parent ID column anymore.) Also, the
JPA objects are designed for
hierarchical but can simplified a bit
more to flat structure. Incidentally,
"sequenceNum" is ambiguous about what
it means, I would say "position" or
"ordering" (INT null, null for
migrators who don't yet have a
position defined) is clearer.
I think the simplest way to handle
this--for both new installers and
upgraders--is:
1.) Database: To create a new table,
say "category" designed precisely as
we need, and have the migration
scripts select from the old
weblogcategory and insert into the new
category table. (We then ignore the
weblogcategory table.) We'll need to
test the scripts with at least two
databases (2 of probably MySQL, Derby
and/or PostgreSQL) and guess for the
others--if we're wrong the user
community can supply a patch fixing it.
2.) JPA: The JPA persistence object
(the old WeblogCategory) will need
simplifying/restructuring as it's now
flat-level. Indeed, I think things
will get a *lot* simpler here, as it
may just be the parent Weblog holding
a list of some sort of Category
objects--that's it.
3.) UI Layer: The category.jsp (or
whatever it's called) and its Struts
action class will now need to use the
new Category object (and table)
instead of WeblogCategory. The UI page
will need two changes: (1) all new
categories will be placed (and saved)
at the bottom of the category list
(and as result, appear last
(right-most) in the category list,
and, later (2) probably have up and
down buttons in the table allowing
users to easily reorder the categories
as they like. (Strictly speaking, 1
alone is all that's needed for
ordering, as you can
remove/name/delete/recreate categories
to eventually get them in the position
you'd like, but (2) of course is much
nicer.)
4.) Template layer (haven't looked
into this): The templates (probably
just a macro or two) will need
updating to ensure that they output
the category names per the new
position order.
It's a lot of work, but one advantage
is that I'd like to do the same thing
with bookmarks/blogrolls (team
discussion pending...), switch from a
hierarchical to flat-level for those
too. If we can do this for
categories, the logic/UI design, etc.,
will carry over 100% to bookmarks.
I was planning on eventually getting
to this myself, so am available to
work with you on whatever parts you'd
like. I think going in order 1-2-3-4
and having separate commits may be the
cleanest way of doing this. What's
nice about using a brand new table and
JPA object is that the old objects can
still work in the code while we're
creating the new, we just don't
activate the new until the very end.
WDYT? (Also, other team members on
the above ideas...?) Or are there
other Roller tasks you'd like to sink
your teeth into instead? I can look at
this otherwise, but this looks like a
very good exercise for someone wanting
to get more involved in Roller, as it
covers all the layers of the webapp.
Regards,
Glen
On 12/20/2013 10:43 AM, Gaurav wrote:
Hello,
I have started working on ROL-1981,
as discussed in previous discussion
threads I will add new column
sequenceNum in weblogcategory table.
Then we can assign sequenceNum to
each category according to websideid.
If anyone have some ideas regarding
this, please help me. Also, need some
help on how to go with this issue,
and how to add new coloum, I found
.sql file, do I need to add there new
column. Also, Is this possible that
that when I restart the roller it
will add new column to database ?
Thanks for Any ideas/help.
[1] -
https://issues.apache.org/jira/browse/ROL-1981