Well for one thing, you're over-thinking the creation of long primitives. You
can simply tack on an "L" to a number, and the compiler will recognize it as a
long. For example this:
entryItems[0] = new EntryItem(new FieldID((new Long("536870925")).longValue()),
new Value(unidade.getData1()));
Could be written like this:
entryItems[0] = new EntryItem(new FieldID(536870925L), new
Value(unidade.getData1()));
As far as reducing lines of code, I suppose if you had a whole lot of fields
you might want to consider correlated arrays where each FieldID in the FieldID
array would correspond to each data element in the data array. I don't know
what your unidade object refers to, but suppose it were an array or instance of
an ArrayList instead. Then you could write something like this (assuming you
have control over the order in which things are "put" into the ArrayList):
for (int i = 0; i < fieldIdArray.length; i++)
{
entryItems[i] = new EntryItem(fieldIdArray[i], new Value((String)
unidadeList.get(i)));
}
The above code is just something I scribbled down. YMMV.
--Tim
----- Original Message ----
From: Tadeu Augusto Dutra Pinto <[EMAIL PROTECTED]>
To: [email protected]
Sent: Friday, May 30, 2008 2:06:06 PM
Subject: [ARSLIST] Help: Remedy Java API 7.0
**
Hi everyone,
I'm trying to use the Java API arapi70.jar...
I'm implementing a code that read records of a file and enter this records in a
form/table.
I would like to know if there is a way to subtitute this code:
EntryItem[] entryItems = new EntryItem[15];
entryItems[0] = new EntryItem(new FieldID((new
Long("536870925")).longValue()), new Value(unidade.getData1()));
entryItems[1] = new EntryItem(new FieldID((new
Long("536870918")).longValue()), new Value(unidade.getData2()));
entryItems[2] = new EntryItem(new FieldID((new
Long("536870919")).longValue()), new Value(unidade.getData3()));
entryItems[3] = new EntryItem(new FieldID((new Long("4")).longValue()), new
Value(unidade.getData4()));
entryItems[4] = new EntryItem(new FieldID((new
Long("536870915")).longValue()), new Value(unidade.Data5()));
// set the entry items...
entry.setEntryItems(entryItems);
entry.create();
In this case above, we have only 5 fields to be inserted in a form. But If
there is more than one or two hundred of fields... Do I have to write 100 or
200 lines of code only insert it??? Considering that we have all values to all
fields in destiny form.
Thanks for any tips and/or suggestions...
Tadeu Augusto Dutra Pinto
-----------------------------------------------------------------IT Web
Services ATM
Cinq Technologies
http://www.cinq.com.br
[EMAIL PROTECTED]
Fone: 41 3018-2833 - Cinq
-----------------------------------------------------------------
Confiabilidade, Inovação e Qualidade em T.I.__Platinum Sponsor:
www.rmsportal.com ARSlist: "Where the Answers Are" html___
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
Platinum Sponsor: www.rmsportal.com ARSlist: "Where the Answers Are"