By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,466 Members | 1,309 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,466 IT Pros & Developers. It's quick & easy.

SupportClass.CollectionSupport = java.util.Collection

P: n/a
I got another convert issue. This is the same project as I posted
yesterday, and received a perfect response.
The conversion threw a SupportClass for me and one of the data type is
CollectionSupport, this is to my understanding to replace
Java.Util.Collection. In my code:
public EcomWeb.rx_transactions.order.GroverOrder[]
getGroverOrders(EcomWeb.domain.WebOrder webOrder)
{
System.Console.Out.WriteLine("OrderFactory.
getGroverOrders( ) started");
EcomWeb.rx_transactions.order.GroverOrder[]
arrayOfGroverOrders = new
EcomWeb.rx_transactions.order.GroverOrder[0];
//UPGRADE_TODO: Class 'java.util.HashMap' was
//converted into'System.Collections.Hashtable'
// which has a different behavior. 'ms- help:
//MS.VSCC.2003 /commoner/redir/redirect.htm?
//keyword="jlca1073_javautilHashMap"'
System.Collections.IDictionary groverOrdersMap =
new System.Collections.Hashtable();
//UPGRADE_ISSUE: Class hierarchy differences
//between ''java.util.List''
//and ''SupportClass.ListCollectionSupport'' may cause
// compilation errors. 'ms-
// help://MS.VSCC.2003/commoner/redir/redirect.htm?
// keyword="jlca1186"'
//UPGRADE_ISSUE: Class hierarchy differences
// between 'java.util.ArrayList'
// and 'System.Collections.ArrayList' may cause
// compilation errors. 'ms-
//help://MS.VSCC.2003/commoner/redir/redirect.htm?
//keyword="jlca1186"'
SupportClass.ListCollectionSupport otcOrderItems = new
SupportClass.ListCollectionSupport( new
System.Collections.ArrayList());

// Iterate through all the OrderItems, building a map
// of GroverOrder
// objects for each pharmacy_id. Hold onto the
// OTCOrderItems until
// all the GroverOrder objects are created.
EcomWeb.domain.OrderItem[] orderItems =
webOrder.OrderItems;
for (int i = 0; i < orderItems.Length; i++)
{
if (orderItems[i] is EcomWeb.domain.RxOrderItem)
{
EcomWeb.rx_transactions.order.GroverOrder order;
EcomWeb.domain.RxOrderItem item =
(EcomWeb.domain.RxOrderItem) orderItems[i];
System.Int32 pharmacyId = item.PharmacyId;
// Is this pharmacy id already mapped?
//UPGRADE_ISSUE: Method 'java.util.Map.containsKey' was
// not converted. 'ms-
//help://MS.VSCC.2003/commoner/redir/redirect.htm?
//keyword="jlca1000"'
//if (groverOrdersMap.containsKey(pharmacyId))
if (groverOrdersMap.Contains(pharmacyId))
{
// GroverOrder is cached.
//UPGRADE_TODO: Method 'java.util.Map.get' was
//converted to 'System.Collections.IDictionary.Item'
// which has a different behavior. 'ms-
//help://MS.VSCC.2003/commoner/redir/redirect.htm?
//keyword="jlca1073_javautilMapget_javalangObject"'
order =
(EcomWeb.rx_transactions.order.GroverOrder)
groverOrdersMap[pharmacyId];
order.add(item);
}
else
{
// Create a new GroverOrder
order = constructGroverOrder(webOrder,
pharmacyId);
order.add(item);
object tempObject;
tempObject = order;
groverOrdersMap[pharmacyId] = tempObject;
System.Object generatedAux2 = tempObject;
} // END-IF-ELSE
}
else
{
// This is an OTC order item.Save it for later use.
//UPGRADE_TODO: The equivalent in .NET for
// method 'java.util.List.add' may return a
//different value. 'ms-
//help://MS.VSCC.2003/commoner/redir/redirect.htm?
//keyword="jlca1043"'
otcOrderItems.Add(orderItems[i]);
} // END-IF-ELSE
} // END-FOR
// Add the collected OTC order items to an appropriate
// GroverOrder.
addOTCOrderItems(groverOrdersMap, otcOrderItems,
webOrder);
// Transfer collection of GroverOrder objects to array
// structure.
//UPGRADE_ISSUE: Class hierarchy differences
//between ''java.util.Collection''
// and ''SupportClass.CollectionSupport'' may cause
//compilation errors. 'ms-
//help://MS.VSCC.2003/commoner/redir/redirect.htm?
//keyword="jlca1186"'
SupportClass.CollectionSupport groverOrdersCollection=
(SupportClass.CollectionSupport)
groverOrdersMap.Values;
arrayOfGroverOrders =
(EcomWeb.rx_transactions.order.GroverOrder[])
groverOrdersCollection.ToArray(new
EcomWeb.rx_transactions.order.GroverOrder[0]);
System.Console.Out.WriteLine
("OrderFactory.getGroverOrders( ) end");
return arrayOfGroverOrders;
} // END-METHO

Again, my issue is the runtime error rather than compilation. It threw
invalid cast exception right on
SupportClass.CollectionSupport groverOrdersCollection=
(SupportClass.CollectionSupport)
groverOrdersMap.Values;
SupportClass.CollectionSupport is Collection in Java,
System.Collections.IDictionary groverOrdersMap = new
System.Collections.Hashtable(); in java is Java.Util.Map.
I thought this is the same issue as I posted last time, but I do not
know how to handle it.
Thank you again for help.
Daniel


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.