Java params cannot be Resolved Eclipse -
for following block of code getting errors say:
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 iagilesession instance session = connect(session); // create 3 parts iitem itemparent = createitem(parent); iitem itemchild1 = createitem(child1); iitem itemchild2 = createitem(child2); // add child parts bom table of parent part itable bomtable = addbom(itemparent, itemchild1, itemchild2); } catch (exception e) { e.printstacktrace(); } { session.close(); } } /** * <p> create 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 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 child parts bom table of 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; } }
i'm not sure problem is? example oracle's sdk. modified params, still got same, error cannot resolved.
you named hashmap
map
not params
. make them match. change
hashmap<string, integer> map = new hashmap<string, integer>();
to like,
map<string, integer> params = new hashmap<>();
or change lines using params
use map
.
map.put(agilesessionfactory.username, username); map.put(agilesessionfactory.password, password); session = factory.createsession(map);
Comments
Post a Comment