CodeType with codes from the database [message #787448] |
Tue, 31 January 2012 10:43  |
Eclipse User |
|
|
|
Is there an example on how to use codeTypes when the codes should be loaded from the database.
My database has a table Status that is used for Appointments. On my planning form i need these statusus. A status has an id (which is in the Appoinment)a name, a code, and a color. So the idea is to load all this information into a AppointmentStatusCodeType.
When an appointment is presented I want to use the AppointmentStatusCodeType for the persentation and make it possible to use change the status of an appointment.
Regards Bertin
|
|
|
|
|
|
|
Re: CodeType with codes from the database [message #1830995 is a reply to message #789632] |
Sat, 08 August 2020 07:19  |
Eclipse User |
|
|
|
This "CODES.getCodeType(StatusCodeType.class);" syntax seems to have been dropped from newer versions of scout (I currently have Eclipse 2020-06). You can say "CODES.getCodeTypes(StatusCodeType.class)", but that returns an untyped list. So to get an instance of a code using the value, I have to do this:
@SuppressWarnings("unchecked")
ICodeType<Long, Long> ct = (ICodeType<Long, Long>) CODES.getCodeTypes(VisibleScopeCodeType.class).get(0);
ICode<Long> code = ct.getCode(searchFormData.getVisibileScope().getValue());
Is there a way to get a typed CodeType instance?
<edit>
Ah, I found it.
BEANS.get(StatusCodeType.class)
[Updated on: Sat, 08 August 2020 07:25] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.07778 seconds