I had a typo in my declaration.

Working as expected now.

-Jose

-----Original Message-----
From: Tim Donohue [mailto:tdono...@duraspace.org] 
Sent: Tuesday, May 01, 2012 3:29 PM
To: Blanco, Jose
Cc: dspace-tech@lists.sourceforge.net
Subject: Re: [Dspace-tech] sendPageAndWait not moving on.

Hi Jose,

I tried taking a quick look at this work today, but nothing has jumped out at 
me as "wrong" per say. Obviously, something is not working right as I also see 
a "Page Not Found" error when I try to run it.

However, that "Page Not Found" error looks like the RequestItem.java page 
cannot be loaded at all. When I attempt to run it, none of the
log.info() statements you've added are executed.  To me, that implies there may 
be an underlying issue in the Sitemap. Somehow Cocoon is never making it to the 
RequestItem transformer, and therefore, it throws a "Page Not Found" error as 
it doesn't know what the paths "/request-item" 
nor "/request-item/main" actually refer to. I'm not sure why this is happening.

What I'd suggest is the following:
1) First, you might want to start with a more simplistic example.  In most 
scenarios, we actually recommend creating your *own* Aspect (as it's easier to 
manage your own code that way, plus you can avoid messing with highly complex 
sitemaps). So, you might want to start with a copy of the "XMLTest" Aspect, and 
create a brand new Aspect called "Michigan" 
or "RequestItem" or similar.

2) In that new Aspect, create a sitemap.xmap based on XMLTest's sitemap (as it 
is nice and simple). In that Sitemap, just add a single "match" like:
<map:match pattern="test-request-item">
      <map:transform type="TestRequestItem"/> </map:match>

3) In your "TestRequestItem.java" class, just add in some dummy content. 
For example, a single 'div' with some "Hello World" text in the "addBody()" 
section.

4) Actually enable the custom aspect in xmlui.xconf & test it out. Make sure 
you can get to the /test-request-item path & that the dummy content gets loaded.

5) Once you have that working, slowly add in your current changes, 
little-by-little, testing it all along the way.  If I were you, I'd start by 
just trying to get the Form content to load first. Then, you can add in the 
extra "artifacts.js" magic to actually process the info entered into the form.

One other tip. It is possible to add logging statements into the "artifacts.js" 
file as well. This can be helpful in determining how it is processing things.  
You'd add lines similar to:
cocoon.log.info("got here");
OR
cocoon.log.debug("got here");

Essentially, I think there has to be something wrong with the flow. I suspect 
there's a sitemap issue, but I'm not sure where it is. So, it's likely going to 
be easier to start simple and get something basic to work, and then slowly add 
your code back in little-by-little (until you find what is causing issues).

Sorry I don't have better news. I admit, Cocoon sitemaps & flowscript (*.js 
files) are not always the easiest to debug, which is why I usually take small 
development steps and test things heavily along the way.

- Tim

On 4/30/2012 1:08 PM, Blanco, Jose wrote:
> Tim,
>
> I removed the duplicate, but no change.  I have attached the files that I 
> have changed.  I looked at the way in which an eperson is delete/added was 
> done in the administrative area - the way the js file process it, and tried 
> duplicating that sort of logic .  My final goal is to create a page where the 
> user can request a copy of the bitstream ( this functionality exists in 
> jspui, but not in xmlui) by pressing the sendEmail button.
>
> What I'm seeing currently is that I get the PageNotFound error. I think this 
> is happening because the parameters are not correctly being passed through, 
> and item is resulting in a null which makes the code exit my new aspect 
> RequestItem.java.
>
> Here are the files I changed
> RequestItem.java is new. I started with the test aspects as a guide.
> artifacts.js is new. I started with the administrative.js as my guide.
> sitemap.xmap - added the patterns as I saw them being use in the 
> administrative area.  Look below for what I added:
>
> Added this:
>>                         <map:transformer name="RequestItem" 
>> src="org.dspace.app.xmlui.aspect.artifactbrowser.RequestItem"/>
>
> Added this:
>>
>>        <map:flow language="javascript">
>>                <map:script src="artifacts.js"/>
>>        </map:flow>
>>
>
> Added this:
>>
>>
>>                <map:match pattern="request-item">
>>                <map:match type="request" pattern="artifact-continue">
>>                 <map:call continuation="{1}"/>
>>                 </map:match>
>>                 <map:call function="startRequestItem"/>
>>                </map:match>
>>
> Added this:
>
>>                <!-- requested item -->
>>                <map:match pattern="request-item/main">
>>                              <map:transform type="RequestItem">
>>                                  <map:parameter name="handle" 
>> value="{flow-attribute:handle}"/>
>>                                  <map:parameter name="itemId" 
>> value="{flow-attribute:itemdId}"/>
>>                                  <map:parameter name="bitstreamId" 
>> value="{flow-attribute:bitstreamId}"/>
>>                              </map:transform>
>>
>>                </map:match>
>
> Thank you!
> Jose
> -----Original Message-----
> From: Tim Donohue [mailto:tdono...@duraspace.org]
> Sent: Monday, April 30, 2012 11:51 AM
> To: Blanco, Jose
> Cc: dspace-tech@lists.sourceforge.net
> Subject: Re: [Dspace-tech] sendPageAndWait not moving on.
>
> Hi Jose,
>
> It's actually rather difficult to determine what could be going on without 
> more context information (or more code).
>
> One oddity I notice is that in your below sitemap code you are 
> calling<map:transform type="RequestItem"/>  *twice*.  The first time with no 
> parameters, and then the second time with a set of parameters.
>
> It's possible that what you are seeing is that first call is happening and no 
> parameters are passed along.
>
> If this doesn't help you resolve the issues, it might be helpful if you can 
> provide us with some additional context, e.g.:
>
> 1. Can you describe what it is you are trying to do in DSpace XMLUI? Is it a 
> simple test or something more?
>
> 2. What code in XMLUI are you emulating? It could be helpful to understand 
> what you are basing your code on.
>
> 3. You may even want to send the full files (zipped) or post them somewhere 
> publicly (e.g. GitHub or public SVN). For example, it is difficult for us to 
> guess what you may be doing in your "RequestItem"
> transformer, etc.
>
> - Tim
>
> On 4/25/2012 10:58 AM, Blanco, Jose wrote:
>> I've made a couple of changes trying to emulate other files that work the 
>> way I want this to work, and I'm still stuck.
>>
>> Question, I have
>>
>> cocoon.sendPageAndWait("request-item/main",{"handle":handle,"itemId":
>> i
>> temId,"bitstreamId":bitstreamId});
>>
>> and I have:
>>
>>                 <map:match pattern="request-item/main">
>>                    <map:transform type="RequestItem"/>
>>                               <map:transform type="RequestItem">
>>                                   <map:parameter name="handle" 
>> value="{flow-attribute:handle}"/>
>>                                   <map:parameter name="itemId" 
>> value="{flow-attribute:itemdId}"/>
>>                                   <map:parameter name="bitstreamId" 
>> value="{flow-attribute:bitstreamId}"/>
>>                               </map:transform>
>>
>>                 </map:match>
>>
>> But when I get to ehte RequestItem there is nothing in itemId.  I'm either 
>> not really passing it, or I have some setup error.  Any ideas?
>>
>> -Jose
>>
>> -----Original Message-----
>> From: Blanco, Jose [mailto:blan...@umich.edu]
>> Sent: Tuesday, April 24, 2012 2:02 PM
>> To: dspace-tech@lists.sourceforge.net
>> Subject: [Dspace-tech] sendPageAndWait not moving on.
>>
>> I'm stuck.  I created a page where the user enters some data, I then want to 
>> process the data based on button that is pressed.  To do this I have created 
>> a js file that contains this function:
>>
>> function startRequestItem()
>> {
>>     var handle = cocoon.request.get("handle");
>>     var itemId = cocoon.request.get("itemId");
>>     var bitstreamId = cocoon.request.get("bitstreamId");
>>     var result;
>>
>>    do
>>     {
>>
>>
>> sendPageAndWait("request-item/main",{"handle":handle,"itemId":itemId,"
>> bitstreamId":bitstreamId},result);
>>
>>       if (cocoon.request.get("submit_send_request_item"))
>>       {
>>         var item = Item.find(getDSContext(),itemId);
>>         
>> cocoon.redirectTo(cocoon.request.getContextPath()+"/handle/"+item.getHandle(),true);
>>         getDSContext().complete();
>>         item = null;
>>         cocoon.exit();
>>       }
>>       if (cocoon.request.get("submit_cancel_request_item"))
>>       {
>>         var item = Item.find(getDSContext(),itemId);
>>         
>> cocoon.redirectTo(cocoon.request.getContextPath()+"/handle/"+item.getHandle(),true);
>>         getDSContext().complete();
>>         item = null;
>>         cocoon.exit();
>>       }
>>     }
>>     while (true);
>>
>> }
>>
>> But what I'm seeing is that the request-item/main is processed but when a 
>> button is hit you don't return from the sendPageAndWait function.  The same 
>> page is just refreshed.
>>
>> Here is what I have in the sitemap:
>>
>>                 <map:match pattern="request-item">
>>              <map:match type="request" pattern="artifact-continue">
>>              <map:call continuation="{1}"/>
>>      </map:match>
>>      <map:call function="startRequestItem"/>
>>                 </map:match>
>>
>>
>> AND
>>
>>
>>                 <!-- requested item -->
>>                 <map:match pattern="request-item/main">
>>                    <map:transform type="RequestItem"/>
>>                      <map:serialize type="xml"/>
>>                 </map:match>
>>
>>
>> I hope this is enough info to get some suggestions.
>>
>> Thank you!  Jose
>>
>>
>>
>> ---------------------------------------------------------------------
>> -
>> --------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and 
>> threat landscape has changed and how IT managers can respond.
>> Discussions will include endpoint security, mobile security and the 
>> latest in malware threats.
>> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> DSpace-tech mailing list
>> DSpace-tech@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/dspace-tech
>>
>> ---------------------------------------------------------------------
>> -
>> --------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and 
>> threat landscape has changed and how IT managers can respond.
>> Discussions will include endpoint security, mobile security and the 
>> latest in malware threats.
>> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> DSpace-tech mailing list
>> DSpace-tech@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/dspace-tech
>
> ----------------------------------------------------------------------
> --------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. 
> Discussions will include endpoint security, mobile security and the 
> latest in malware threats. 
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> DSpace-tech mailing list
> DSpace-tech@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/dspace-tech

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to