Re: D2W and Boolean values; anybody ever have anything work?
Re: D2W and Boolean values; anybody ever have anything work?
- Subject: Re: D2W and Boolean values; anybody ever have anything work?
- From: James Cicenia <email@hidden>
- Date: Tue, 7 Dec 2004 20:13:25 -0600
I have been using booleans from the beginning then in 5.3 if I am not
mistaken they started acting weird. I just created my own custom
component
for D2W that seems to work ok... it is just a popup with the following:
//Generated by the WOLips Core at Thu Feb 19 16:57:30 CST 2004
import com.webobjects.appserver.*;
import com.webobjects.eocontrol.*;
import com.webobjects.foundation.*;
public class EditYesNo extends WOComponent {
EOEnterpriseObject object;
String key;
Integer newSelection;
NSDictionary choices1, choices2;
static protected String YES = "Yes";
static protected String NO = "No";
static protected int YES_VALUE = 1;
static protected int NO_VALUE = 0;
public EditYesNo(WOContext context) {
super(context);
choices1 = new NSDictionary(new Object[]{YES,NO},
new Object[]{"true","false"});
choices2 = new NSDictionary(new Object[]{new Integer(YES_VALUE),new
Integer(NO_VALUE)},new Object[]{YES,NO});
}
public void takeValuesFromRequest(WORequest request, WOContext context)
throws NSValidation.ValidationException {
super.takeValuesFromRequest(request, context);
try {
object.takeValueForKey(newSelection, key);
} catch (Exception exception) {
throw (
new NSValidation.ValidationException(
" Incorrect numeric input "));
}
}
public String selection() {
if (object.valueForKey(key) != null) {
return
choices1.valueForKey(object.valueForKey(key).toString()).toString();
}else{
return null;
}
}
public Integer setSelection(String selection) {
newSelection = (Integer) choices2.valueForKey(selection);
return newSelection;
}
public EOEnterpriseObject object(){
return object;
}
public void setObject(EOEnterpriseObject pObject){
object = pObject;
}
public String key(){
return key;
}
public void setKey(String pKey){
key = pKey;
}
}
On Dec 7, 2004, at 2:35 PM, gbrown wrote:
Searching the webobjects archive, I see there are several
questions--all unanswered-- about getting d2w to work with booleans
from a database.
Has anybody ever got something to work? How? Is it database dependent?
a special class?
D2W currently won't allow a query using a boolean field, it says, " -
cannot be used in a query - ". Nor will it allow editing a boolean
field, it says. "
- not available -". However, in listing out records it appears to
convert the string TRUE to the string true and display it. ( I went
around webobjects and used database utilities to put the value TRUE in
the database.)
On a related note, is there any documentation for the custom attribute
mapping method, e.g. Factory Method:, Conversion Method:, Init
Argument: as displayed by EO Modeler's Inspector? I did not find
anything in the EO Modeler PDF.
Tanks.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden