ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Gray <scott.g...@hotwaxmedia.com>
Subject Re: Groovy question regarding passing html parameters
Date Mon, 23 Aug 2010 08:11:26 GMT
Hi Pierre,

You need to add the EntityCondition class to the list of imports:
import org.ofbiz.entity.condition.EntityCondition;

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 23/08/2010, at 7:49 PM, Pierre Smits wrote:

> The error more readable:
> 
> Problems with the response writer/output stream:
> org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen
> [component://profiler/widget/ProfilerPrintScreens.xml#PrintProfilePDF]:
> groovy.lang.MissingPropertyException: No such property: EntityCondition for
> class: ProfileExperiences (No such property: EntityCondition for class:
> ProfileExperiences)
> 
> Regards,
> 
> Pierre
> 
> 2010/8/23 Pierre Smits <pierre.smits@gmail.com>
> 
>> Hi Scott,
>> 
>> Thanks for the pointer. I think it should be on the money.... However after
>> some tweaking I got following error:
>> 
>> <p>Problems with the response writer&#47;output stream&#58;
>> 
>> org.ofbiz.widget.screen.ScreenRenderException&#58;
>> Error rendering screen &#91;component&#58;&#47;&#47;profiler&#47;widget&#47;ProfilerPrintScreens.xml&#35;PrintProfilePDF&#93;&#58;
>> 
>> groovy.lang.MissingPropertyException&#58; No such property&#58;
>> EntityCondition for class&#58; ProfileExperiences &#40;No such property&#58;
EntityCondition for class&#58; ProfileExperiences&#41;
>> 
>> </p>
>> 
>> 
>> The complete code in the groovy file is:
>> import org.ofbiz.base.util.*;
>> import org.ofbiz.entity.*;
>> import org.ofbiz.entity.util.*;
>> import org.ofbiz.party.contact.*;
>> import javolution.util.FastMap;
>> 
>> List experienceItems = [];
>> 
>> profileOwnerId = profileSummary.profileOwnerId;
>> selectedExperiences = parameters.experienceSelected;
>> 
>> 
>> condList = [];
>> condList.add(EntityCondition.makeCondition("profileOwnerId",
>> profileOwnerId));
>> if (selectedExperiences) {
>>   condList.add(EntityCondition.makeCondition("experienceId",
>> EntityOperator.IN, selectedExperiences as List));
>> }
>> cond = EntityCondition.makeCondition(condList);
>> experienceItemList = delegator.findList("ProfileExperience", cond, null,
>> null, null, false);
>> 
>> if (experienceItemList) {
>>    experienceItemList.each { profileExperience ->
>>        experienceDesc = profileExperience.experienceDesc;
>>        experienceStartDate = profileExperience.experienceStartDate;
>>        experienceEndDate = profileExperience.experienceEndDate;
>>        experienceCustomerId = profileExperience.experienceCustomerId;
>>        experienceIndustryId = profileExperience.experienceIndustryId;
>>        experienceProjectId = profileExperience.experienceProjectId;
>>        experienceTaskId = profileExperience.experienceTaskId;
>>        experienceBackground = profileExperience.experienceBackground;
>>        experienceContext = profileExperience.experienceContext;
>>        experienceTask = profileExperience.experienceTask;
>>        experienceMethods = profileExperience.experienceMethods;
>>        experienceTools = profileExperience.experienceTools;
>> 
>>        Map experienceItemMap = FastMap.newInstance();
>>        experienceItemMap.putAll((Map) profileExperience);
>> 
>>        experienceItems.add(experienceItemMap);
>>    }
>>    context.experienceItems = experienceItems;
>>    }
>> 
>> Any suggestions?
>> 
>> Regards,
>> 
>> Pierre
>> 
>> 
>> 2010/8/21 Scott Gray <scott.gray@hotwaxmedia.com>
>> 
>> Hi Pierre,
>>> 
>>> See my other response to Michal for the correct code, it was only from
>>> memory though so may not actually work without tweaking.
>>> 
>>> Regards
>>> Scott
>>> 
>>> On 21/08/2010, at 12:02 AM, Pierre Smits wrote:
>>> 
>>>> Hi Scott,
>>>> 
>>>> Thanks for the pointer!
>>>> 
>>>> Unfortunately, I am a total groovy-newbie....
>>>> 
>>>> Would
>>>> selectedExperiences = parameter.selectedExperiences;
>>>> if (selectedExperiences==""){
>>>>   experienceItemList = delegator.findByAnd("ProfileExperience",
>>>> [profileOwnerId : profileOwnerId]);
>>>>   }
>>>>   else{
>>>>   experienceItemList = delegator.findList("ProfileExperience",
>>>> [experienceId : selectedExperiences]);
>>>> 
>>>>   }
>>>> 
>>>> do the trick?
>>>> 
>>>> Regards,
>>>> 
>>>> Pierre
>>>> 
>>>> 
>>>> 2010/8/20 Scott Gray <scott.gray@hotwaxmedia.com>
>>>> 
>>>>> Hi Pierre,
>>>>> 
>>>>> You'll want to use delegator.findList(...) with an EntityOperator.IN
>>>>> condition for the experience field.
>>>>> 
>>>>> Regards
>>>>> Scott
>>>>> 
>>>>> HotWax Media
>>>>> http://www.hotwaxmedia.com
>>>>> 
>>>>> On 20/08/2010, at 10:31 PM, Pierre Smits wrote:
>>>>> 
>>>>>> In a url I pass following parameters:
>>>>>> 
>>>>>> ?profile=10000&experience=10000,100010
>>>>>> 
>>>>>> In a groovy file I get the parameters....
>>>>>> parameter.profile
>>>>>> parameter.experience
>>>>>> 
>>>>>> My question is: how do I get the delegator to find entities in the
>>>>> database
>>>>>> based on both parameter.profile and parameter.experience?
>>>>>> 
>>>>>> In all the other codes in groovy files that I see it seems that
>>>>> parameters
>>>>>> have only 1 value... Or I might be overlooking one...
>>>>>> 
>>>>>> Regards,,
>>>>>> 
>>>>>> Pierre
>>>>> 
>>>>> 
>>> 
>>> 
>> 


Mime
View raw message