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

























Reply via email to