Für den folgenden Code-Block I Fehler sind immer, die sagen:Java params kann Eclipse nicht gelöst werden
import com.agile.api.*;
import java.util.*;
public class AddBOM {
public static final String USERNAME = "blahblah";
public static final String PASSWORD = "1234";
public static final String URL = "http://www";
public static IAgileSession session = null;
public static AgileSessionFactory factory;
public static final String parent = "P1";
public static final String child1 = "P2";
public static final String child2 = "P3";
public static void main(String[] args) {
try {
// Create an IAgileSession instance
session = connect(session);
// Create three parts
IItem itemParent = createItem(parent);
IItem itemChild1 = createItem(child1);
IItem itemChild2 = createItem(child2);
// Add the child parts to the BOM table of the parent part
ITable bomTable = addBOM(itemParent, itemChild1, itemChild2);
} catch (Exception e) {
e.printStackTrace();
} finally {
session.close();
}
}
/**
* <p> Create an IAgileSession instance </p>
*
* @param session
* @return IAgileSession
* @throws APIException
*/
private static IAgileSession connect(IAgileSession session)
throws APIException {
factory = AgileSessionFactory.getInstance(URL);
HashMap<Integer, String> map = new HashMap<Integer, String>();
map.put(AgileSessionFactory.USERNAME, USERNAME);
map.put(AgileSessionFactory.PASSWORD, PASSWORD);
session = factory.createSession(map);
return session;
}
/**
* <p> Create a part </p>
*
* @param parent
* @return IItem
* @throws APIException
*/
private static IItem createItem(String number) throws APIException {
IItem item = (IItem)session.createObject(ItemConstants.CLASS_PART, number);
return item;
}
/**
* <p> Add the child parts to the BOM table of the parent part </p>
*
* @param itemParent
* @param itemChild1
* @param itemChild2
* @return ITable
* @throws APIException
*/
private static ITable addBOM(IItem itemParent, IItem itemChild1,
IItem itemChild2) throws APIException {
ITable table = itemParent.getTable(ItemConstants.TABLE_BOM);
IRow row1 = table.createRow();
String number = (String)itemChild1.getValue(ItemConstants.ATT_TITLE_BLOCK_NUMBER);
row1.setValue(ItemConstants.ATT_BOM_ITEM_NUMBER, number);
IRow row2 = table.createRow(itemChild2);
return table;
}
}
Ich bin nicht sicher, was das Problem ist? Dies ist ein Beispiel aus dem Oracle SDK. Ich habe die Parameter geändert, aber ich habe immer noch den gleichen Fehler, der nicht behoben werden kann.
OK, wo ist 'params' definiert? Willst du 'map' verwenden? (Oder für 'map',' params' zu nennen?) –