Wiki Spaces

Documentation
Projects
Resources

Get Help from Others

Q&A: Ask OpenMRS »
Discussion: OpenMRS Talk »
Real-Time: IRC Chat

IRC Logs

Child pages
  • 2008-08-15 - OpenMRS
Skip to end of metadata
Go to start of metadata
00:12:09 *** sprasanna_ has quit IRC
00:20:20 *** sprasanna has joined #openmrs
00:46:47 *** njero has joined #openmrs
00:46:47 *** ChanServ sets mode: +v njero
01:38:37 *** Keelhaul has quit IRC
02:07:37 *** sprasanna_ has joined #openmrs
02:07:38 *** sprasanna has quit IRC
03:49:37 *** sprasanna_ has quit IRC
03:56:55 *** sprasanna has joined #openmrs
05:59:19 *** upul has quit IRC
06:07:45 *** james_regen has joined #openmrs
06:07:45 *** ChanServ sets mode: +v james_regen
06:40:55 *** njero has quit IRC
06:57:46 *** bwolfe has joined #openmrs
06:57:46 *** ChanServ sets mode: +o bwolfe
06:58:48 *** sprasanna_ has joined #openmrs
07:08:01 *** sprasanna has quit IRC
07:27:23 *** bmckown has joined #openmrs
07:27:23 *** ChanServ sets mode: +o bmckown
08:03:25 *** atomicturtle has joined #openmrs
08:16:19 *** bwolfe has quit IRC
09:31:07 <sprasanna_> bmckown: Hi Brian..
09:31:13 <sprasanna_> I have a small doubt..
09:31:25 <bmckown> yes?
09:32:10 <sprasanna_> i have some thing like this model.put("layoutTemplate", layoutTemplate); here layoutTemplate is the object of LayoutTemplate and it has the method getLines()
09:32:45 <sprasanna_> and in the addressLayout jsp page its is called like this ${model.layoutTemplate.lines}
09:33:00 <bmckown> yes
09:33:07 <bmckown> it works, no?
09:33:22 <sprasanna_> its how now in the openmrs core
09:33:53 <sprasanna_> i just want to put my own stuff in layoutTemplate.lines instead the actual one
09:34:16 <sprasanna_> so how can i do that in the controller
09:34:29 <sprasanna_> any suggestion
09:34:32 <bmckown> let me look...
09:34:41 <sprasanna_> bmckown: thanks a lot
09:35:51 *** nribeka has quit IRC
09:40:08 *** nribeka has joined #openmrs
09:44:22 <bmckown> hmm. so instead of returning the values from LayoutTemplate.getLines() you want to return some custom values?
09:48:03 <bmckown> sprasanna_, wait you have your own custom AddressTemplate.java in your module right?
09:48:26 <bmckown> Then you should be able to override the .getLines() method in your AddressTemplate.java
09:51:42 <bmckown> Just put this method in your AddressLayout.java: public List<List<Map<String,String>>> getLines() { /* your own code */ }
09:52:52 *** sprasanna has joined #openmrs
09:53:22 <sprasanna> bmckown: sorry got disconnected
09:53:24 *** sprasanna_ has quit IRC
09:54:36 <sprasanna> bmckown: but the problem is if i use custom AddressTemplate.java then the portlet is not loading
09:54:52 <sprasanna> bmckown: anyways let me check with it once again and get back to you
09:55:19 <bmckown> okay. maybe you can make a custom portletController that exends the default portlet controller if necessary.
09:55:45 <bmckown> AddressLayoutPortletController exends PortletController
09:56:31 <bmckown> and then your AddressLayoutPortletController would be sure to use your own AddressLayout class instead of the openmrs AddressLayout class
10:01:00 <bmckown> sprasanna, BTW you have an error here: http://dev.openmrs.org/browser/openmrs-modules/addresshierarchy/web/src/org/openmrs/module/addresshierarchy/web/controller/AddressLayoutPortletControlle.java#L22
10:01:02 <OpenMRSBot> <http://ln-s.net/2$1m> (at dev.openmrs.org)
10:01:31 <bmckown> Which may be why the portlet is not loading.
10:01:45 <bmckown> Missing "r" on Controller classes
10:02:00 <sprasanna> bmckown: actually i have named that LayoutPortletController like that
10:02:14 <bmckown> I see.
10:02:29 <sprasanna> bmckown: sorry actually i committed that code to show daniel today... it wont work.. sorry for the inconvenience
10:02:39 <bmckown> no prob
10:04:29 *** james_regen has quit IRC
10:05:00 <sprasanna> bmckown: i get this error http://pastebin.com/d22fa9cc4 because of this http://dev.openmrs.org/browser/openmrs/trunk/src/web/org/openmrs/layout/web/address/AddressSupport.java#L35
10:05:02 <OpenMRSBot> <http://ln-s.net/2$1p> (at dev.openmrs.org)
10:05:42 <sprasanna> if i use custom AddressTemplate
10:06:56 <bmckown> But you already have the AddressTemplate class in your module? You mean you're not using it then?
10:07:28 <bmckown> I mean, when the module works it's because you're not using your own AddressTemplate?
10:13:36 <sprasanna> actually i have it in my module but i dunno y that error comes out... then i thought may be a constructor for AddressSupport class would solve the problem so did that but now i get this error http://pastebin.com/d7367bb5c
10:19:00 <bmckown> Line 50, hmm.
10:20:07 <bmckown> LayoutPortletControlle.java:88 always returns a String, not a null, so
10:20:47 <bmckown> line 50 seems to indicate that the NPE is because PortletController is not recognizing your LayoutPortletControlle
10:21:45 <sprasanna> bmckown: thats y i thought to replace the model.layoutTemplate.lines somehow
10:22:12 <bmckown> okay... another idea...
10:22:30 <bmckown> Ben has coded in the PortletController a method called populateModel
10:22:41 <bmckown> which is a hook for you to put stuff there.
10:23:35 <sprasanna> populateModel in LayoutPortletController right?
10:24:20 <bmckown> maybe you make model.put("addressLayout", org.openmrs.module.addresshierarchy.AddressLayout);
10:24:37 <bmckown> yes in your LayoutPortletControlle
10:24:59 <bmckown> I'm looking at PortletController.populateModel
10:25:04 <sprasanna> bmckown: yeah that would be a great idea...
10:26:23 <bmckown> I love these kind of test cases like you have in LayoutPortletControlle.java:83
10:26:25 <bmckown> System.out.println("here is the fucking model"+model);
10:26:29 <bmckown> hehe
10:26:51 <bmckown> sorry about that. I feel your pain.
10:29:08 <sprasanna> bmckown: oh im extremely sorry... i dint notice that
10:29:39 <bmckown> it's kind of funny actually.
10:30:44 <sprasanna> hehe
10:33:14 <bmckown> looking at bean mapping but it seems okay
10:35:30 <sprasanna> actually if i find a way to insert my own stuff into that model.layouttemplate.lines then i can get everything done easily
10:36:05 <bmckown> yes.
10:36:23 <bmckown> you are probably very close... it may just be a little error somewhere
10:36:57 <bmckown> sprasanna, why do you have AddressLayoutPortletController in your module? Are you using it?
10:37:22 <bmckown> (the class that has the "r" in the name)
10:37:58 <sprasanna> hehe... actually i copied in my module to show daniel that how i have implemented it....
10:38:15 <sprasanna> actually thats doing nothing there just another copy...
10:39:27 <sprasanna> AddressLayoutPortletControlle extends LayoutPortletControlle extends PortletController
10:40:05 <bmckown> yes... just wondering if it is getting in the way of the openmrs AddressLayoutPortletController. probably not i suppose.
10:41:21 <bmckown> nah, it's not reference anywhere in the module.... nevermind.
10:43:15 <sprasanna> even if i hook like this model.put("addressLayout", org.openmrs.module.addresshierarchy.AddressLayout); then i have to manipulate this LayoutTemplate layoutTemplate = layoutSupport.getDefaultLayoutTemplate();
10:44:08 <sprasanna> but actual layoutSupport from openmrs core will show error because of the difference between two LayoutTemplates
10:45:14 <sprasanna> i can even make it up by adding the LayoutSupport which is my module but if i do this ultimately i have to call AddressSupport which is in my module... which ultimately shows error
10:46:08 <bmckown> and the error is always the NPE?
10:46:57 <bmckown> oh, the Not Yet Instantiated error.
10:48:22 <sprasanna> yeah if have a constructor like this AddressSupport as = new AddressSupport(); which invokes this singleton = this; but it shows this http://pastebin.com/d7367bb5c
10:49:49 <bmckown> Hey, where is the order in the addressHierarchyUrlMapping? you took that out?
10:50:05 <bmckown> <property name="order"><value>2</value></property>
10:50:23 <sprasanna> oh no...
10:50:36 <bmckown> in the moduleApplicationContext.xml
10:50:37 <sprasanna> i forgot to load that...
10:51:55 <bmckown> Please use it before you go on. It may be the cause of the error.
10:52:20 <sprasanna> no actually its there... one sec i will commit it now
10:52:32 <bmckown> Oh, well if it's there nevermind.
10:52:39 <bmckown> you can commit whenever
10:54:53 <sprasanna> is there any way to override that getLines() method alone?
10:57:17 *** sprasanna_ has joined #openmrs
10:57:17 *** sprasanna has quit IRC
10:57:46 *** sunbiz has joined #openmrs
10:59:14 <bmckown> yes there is.
10:59:17 <bmckown> or there should be.
11:00:23 <bmckown> I was wondering... why *do* you override LayoutPortletController.java ? It looks like you don't do anythingn different.
11:01:35 <sprasanna_> actually from LayoutPortletControlle has the method populateModel which ultmately has the object model...
11:03:25 <bmckown> yea, but it's the same as the openmrs LayoutPortletController. The method doesn't do anything different, right?
11:04:26 <sprasanna_> yeah actually if i want to modify the layoutTemplate.lines i have to do that there only na...
11:05:33 <bmckown> you cannot have AddressLayoutControlle.populateModel(...) { super(); /* Then do my own stuff */ } ??
11:06:07 *** bwolfe has joined #openmrs
11:06:07 *** ChanServ sets mode: +o bwolfe
11:07:16 <sprasanna_> oh yeah
11:07:58 <bmckown> brb
11:10:25 <sprasanna_> bwolfe: hi Ben
11:11:03 <bwolfe> hey sri
11:11:16 <sprasanna_> bwolfe: do you have any suggestions for overriding the getLines() method in LayoutTemplate ?
11:11:30 <sprasanna_> bwolfe: actually I and Brian were discussing about it
11:11:47 <bwolfe> sprasanna_: I already told you how to do it! :-p
11:12:19 <bmckown> great.
11:12:21 <bmckown> you mean...
11:13:03 <bmckown> i've spent an hour and a half on something you already know how to do?? :-O
11:13:49 <sprasanna_> bmckown: actually bwolfe told me to have the controllers adopted in my module and override it :P
11:14:12 <bmckown> weren't we saying the same thing?
11:14:51 *** bwolfe_ has joined #openmrs
11:14:51 *** ChanServ sets mode: +o bwolfe_
11:14:56 <sprasanna_> ok now right from the beginning i start..
11:14:58 <sprasanna_> :P
11:15:01 *** bwolfe has quit IRC
11:15:04 *** bwolfe_ is now known as bwolfe
11:15:09 <bwolfe> you should read the logs :-p
11:15:11 <bwolfe> all the time
11:15:15 <bwolfe> hehe
11:15:35 <sprasanna_> i then am i wrong somewhere?
11:16:01 *** sunbiz has left #openmrs
11:19:34 <sprasanna_> bwolfe bmckown any suggestions please :(
11:19:41 <sprasanna_> :( :(
11:24:11 <bmckown> okay... ben just talked to me about this...
11:24:27 <bmckown> give me a minute to explain.
11:28:20 <bmckown> okay 5 minutes.. waiting for trac to load
11:28:54 <bmckown> sprassana
11:29:05 <bmckown> Go here in your working copy of openmrs trunk:
11:29:09 <bmckown> http://dev.openmrs.org/browser/openmrs/trunk/src/web/org/openmrs/layout/web/LayoutSupport.java#L39
11:29:13 <bmckown> and change that method to this:
11:29:37 <bwolfe> !refer bmckown [tabcomplete] :-)
11:29:37 * OpenMRSBot refers bmckown to "tabcomplete" --- Most IRC clients let you easily write someone's nickname in the channel using tab completion. Just type the first few letters, then <tab>, and voila! :-)
11:29:38 <bmckown> public void setLayoutTemplates(List<T> layoutTemplates) {
11:29:38 <bmckown> if (null == this.layoutTemplates) {
11:29:38 <bmckown> this.layoutTemplates = layoutTemplates;
11:29:40 <bmckown> }
11:29:40 <bmckown> else this.layoutTemplates.addAll(layoutTemplates);
11:29:40 <bmckown> }
11:29:56 <bmckown> !refer ben pleasedontbotherme
11:29:56 * OpenMRSBot refers ben to pleasedontbotherme
11:30:08 <bmckown> hey, that's cool. :-)
11:30:24 <bmckown> sprasanna_, my tab complete didn't work. ben was right.
11:31:11 <bmckown> sprasanna_, are you there?
11:31:31 <sprasanna_> bmckown: yeah Brian I am listening to you
11:31:45 <bmckown> ah, cool. so you got that change above right? step 1
11:32:45 <sprasanna_> bmckown: yeah got it
11:33:05 <bmckown> Okay.. Step 2:
11:33:45 <bmckown> In your moduleApplicationContext.xml put this bean:
11:33:47 <bmckown> <bean id="addressSupport" class="org.openmrs.layout.web.address.AddressSupport">
11:34:58 <sprasanna_> yeah got it
11:35:12 <sprasanna_> now i can invoke my addressSupport right??
11:35:16 <bmckown> and add in the property list:
11:35:43 <bmckown> <ref bean="SriPrasannaTemplate" />
11:36:05 <bmckown> following the layout from openmrs-servlet.xml lines 1327
11:36:09 <bmckown> lemme link to it...
11:36:34 <sprasanna_> SriPrasannaTemplate... lol... let me put it as AddressHierarchyTemplate
11:36:59 <bmckown> http://dev.openmrs.org/browser/openmrs/trunk/web/WEB-INF/openmrs-servlet.xml#L1327
11:37:13 <bmckown> okay "AddressHierarchyTemplate"
11:37:56 <bmckown> Step 3: get rid of AddressTemplate in your module
11:38:51 <bmckown> Step 4: Create AddressHierarchyTemplate extends org.openmrs.layout.web.address.AddressTemplate in your module
11:38:57 <OpenMRSBot> Recent updates in the world of openmrs: OpenMRS Modules: Logic Web Service 1.1 uploaded to OpenMRS Module Repository <https://dev.openmrs.org/modules/view.jsp?module=logicws&version=&1.1>
11:39:51 <bmckown> Step 5: AddressHierarchyTemplate has one and only one method: AddressHierarchyTemplate.getLists() { /* do your own stuff here */ }
11:40:58 <bmckown> sorry I meant .getLines()
11:43:27 <bmckown> Step 6: Define the bean to your AddressHierarchyTemplate in your moduleApplicationContext.xml kind of like this: <bean id="addressHierarchyTemplate" class="org.openmrs.module.addresshierarchy.layout.web.address.AddressHierarchyTemplate">
11:45:24 <bmckown> Step 7: Go back to my step 2 and change <ref bean="AddressHierarchyTemplate"/> to <ref bean="addressHierarchyTemplate"/>
11:45:43 <bmckown> because i made a mistake with the camel case
11:46:10 <bmckown> sprasanna_, does that make sense?
11:46:18 <sprasanna_> yeah actually i entered it like that only
11:46:28 <sprasanna_> yeah it does bmckown
11:46:33 <sprasanna_> thanks a lot
11:47:48 <bmckown> sure. You don't need to override all of those portlet controllers or LayoutTemplate
11:48:50 <bmckown> !refer ben goaheadandbothermenowplease
11:48:50 * OpenMRSBot refers ben to goaheadandbothermenowplease
11:49:01 <bmckown> :-)
11:49:20 <bmckown> Thanks for the help with that, Ben.
11:50:00 <bwolfe> in you modApplcationContext, put <bean parent="addressSupport" >
11:50:03 <bwolfe> isntead of <bean id="addressSupport" class="org.openmrs.layout.web.address.AddressSupport">
11:50:28 <sprasanna_> bmckown: in setLayoutTemplates should it be like this if (null == this.layoutTemplates) or if(this.layout.Template == null)
11:50:47 <bmckown> okay. thx
11:51:13 <bmckown> oh, i think it should be the former. no?
11:51:18 *** [mharrison] has quit IRC
11:51:52 <bwolfe> both work
11:52:03 <sprasanna_> yeah actually either way it will work
11:52:21 <bmckown> because wouldn't "if (this.layoutTemplate == null)" throw npe? Oh. I guess that's just for String.
11:53:34 <bmckown> I just habitually put all of my if statements with the null part first.
11:53:46 <bmckown> not good convention?
11:55:14 <bwolfe> doesn't matter at all
11:55:20 <bmckown> okay.
11:57:24 <sprasanna_> bmckown: should i really need to add AddressHierarchyTemplate ?? am i not allowed to do to add stuffs in moduleapplicationContext.xml like the other http://dev.openmrs.org/browser/openmrs/trunk/web/WEB-INF/openmrs-servlet.xml#L1355
12:03:38 <bmckown> I guess I don't understand. You could/should add properties in addressHierarchyTemplate such as is done with "addressTemplateRwanda" in line 1355, no?
12:06:13 *** sioraiocht has joined #openmrs
12:06:17 *** ChanServ sets mode: +v sioraiocht
12:07:53 <bmckown> sunbiz really did hack the demo sight?
12:09:03 <sprasanna_> yeah but after adding that wont AddressTemplate work??
12:11:33 <bmckown> The change in the core openmrs code will allow you to "add" more templates instead of just "setting" the templates again which would override all previously defined templates.
12:31:51 *** Echidna has quit IRC
12:52:44 *** Echidna has joined #openmrs
13:12:23 <OpenMRSBot> Recent updates in the world of openmrs: OpenMRS Tickets: Ticket #977 (task created): Remove nealreporting from core <http://dev.openmrs.org/ticket/977>
13:46:20 *** sprasanna has joined #openmrs
13:50:12 *** sprasanna_ has quit IRC
13:54:12 *** nribeka is now known as nribeka-away
14:25:21 *** [mharrison] has joined #openmrs
15:03:20 <bmckown> reportObjectList uses this kind of Exception handling in the jsp:
15:03:22 <bmckown> <% try { %>
15:03:22 <bmckown> ${reportObject.description}</td>
15:03:22 <bmckown> <% } catch (Exception ex) { %>
15:03:22 <bmckown> <font color="red">EXCEPTION!</font>
15:03:22 <bmckown> <% } %>
15:03:27 <bmckown> However....
15:03:31 <bmckown> a better way is
15:03:46 <bmckown> <c:catchvar="e">
15:03:46 <bmckown> <c:iftest="${indicator.description}">${indicator.description}</c:if>
15:03:46 <bmckown> </c:catch>
15:03:46 <bmckown> <c:iftest="${e==null}">${indicator.description}</c:if>
15:03:47 <bmckown> <c:iftest="${e!=null}">EXCEPTION!</c:if>
15:03:47 <bmckown>
15:04:12 <bmckown> using the <c:catchvar="e"></c:catch> tags
15:07:14 <bwolfe> ok
15:07:17 <bwolfe> sounds good to me
15:07:22 <bmckown> it was nice
16:04:46 *** bmckown has quit IRC
16:11:38 *** [mharrison] has quit IRC
16:14:57 *** sioraiocht has quit IRC
16:21:37 *** bwolfe has quit IRC
16:35:03 *** [mharrison] has joined #openmrs
16:44:35 *** atomicturtle has left #openmrs
18:34:50 *** [mharrison] has quit IRC
21:44:34 *** nribeka-away is now known as nribeka
21:53:14 *** r0bby|vista has joined #openmrs
21:53:23 *** r0bby|vista has left #openmrs
23:57:28 *** njero has joined #openmrs
23:57:28 *** ChanServ sets mode: +v njero
  • No labels