ShishirDwivedi
Programmer
Hi,
I am trying to set the attributes of a work package in the following way:
1: I execute the startTask() function to retrieve the workackage.
2: I access the category Version of the work package.
3: I use this category version to get/set the attributes using attrGetValues/attrSetValues functions.
Now untill i set the attributes and update the category Version of the workpackage with the new attributes, all works fine. Even the updation of the work package using the UpdateTaskWork function returns zero. But , the attributes do not get updated in the work package. If i try to retrieve them again from the work package, the original and not the updated values are returned.
Here is the code:
public class task {
public static void main(String[] args) {
try{
int ID = 108490;
int tID =4;
String attName = "Document Approved";
LLValue map = new LLValue().setAssoc();
LLValue map2 = new LLValue().setAssoc();
LLSession session = new LLSession("blrkec88884d", 2099, "", "Admin", "infy123", null);
session.setEncoding("UTF-8");
System.out.println("CREATED SESSION : "+session.getStatus()+" , "+session.getStatusMessage());
LAPI_WORKFLOW lapiwf = new LAPI_WORKFLOW(session);
System.out.println("workflow object status " + lapiwf);
LLValue lAdditions = (new LLValue()).setList();
int i = lapiwf.AcceptTask(ID, ID, tID);
i = lapiwf.StartTask(ID, ID, tID, map);
System.out.println("Task Started = " + i);
System.out.println("map = " + map);
LAPI_ATTRIBUTES attributes = new LAPI_ATTRIBUTES(session);
LLValue temp = new LLValue().setList();
LLValue temp2 = new LLValue().setList();
LLValue catVersion = map.toValue(2).toValue("USERDATA").toValue("catVersion");
LLValue catVersion2;
System.out.println("catVersion = " + catVersion);
attributes.AttrGetInfo(catVersion, attName, null, temp);
System.out.println("Att Info" + temp);
int att = attributes.AttrGetValues(catVersion, attName, 5, null, temp2);
System.out.println(att + " ------attribute info-------- " + temp2);
System.out.println(temp2.toValue(0).isBoolean());
temp2.remove(0);
temp2.add(false);
System.out.println(temp2.toValue(0).isBoolean());
//att = attributes.AttrSetValues(catVersion, "In Scope?", 5, null, temp2);
att = attributes.AttrSetValues(catVersion, attName, 5, null, temp2);
map.toValue(2).toValue("USERDATA").setValue("catVersion",catVersion);
//att = attributes.AttrSetValues(catVersion, "In approved parts list?", 5, null, temp2);
//att = attributes.AttrGetValues(catVersion, "In Scope?", 5, null, temp);
att = attributes.AttrGetValues(catVersion, attName, 5, null, temp);
System.out.println(att + " ------attribute info-------- " + temp);
//map.toValue(2).toValue("USERDATA").setValue("catVersion",catVersion);
catVersion2 = map.toValue(2).toValue("USERDATA").toValue("catVersion");
att = attributes.AttrGetValues(catVersion2, attName, 5, null, temp2);
System.out.println(att + " ------intermediate-------- " + temp2);
//int i1 = lapiwf.UpdateWorkPackage(ID, ID, map);
i = lapiwf.UpdateTaskWork(ID, ID, tID, map);
System.out.println("Updation = " + i);
i = lapiwf.AccessWorkPackage(ID, ID, map2);
System.out.println("Task Started again = " + i);
catVersion = map2.toValue(2).toValue("USERDATA").toValue("catVersion");
att = attributes.AttrGetValues(catVersion, attName, 5, null, temp2);
System.out.println(att + " ------updated attribute info-------- " + temp2);
//att = attributes.AttrGetValues(catVersion, "In Scope?", 5, null, temp);
System.out.println("After Updation = " + temp2);
i = lapiwf.ListWorkflowInbox("Todo2", "", "", 1, 0, temp,temp2);
System.out.println(i + temp.toInteger() + "----------Task Status---------" + temp2);
i = lapiwf.EndTask(ID, ID, tID, "Approve");
System.out.println("End Task = " + i);
}
catch (Exception e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
Any help will be appreciated.
Thanx
I am trying to set the attributes of a work package in the following way:
1: I execute the startTask() function to retrieve the workackage.
2: I access the category Version of the work package.
3: I use this category version to get/set the attributes using attrGetValues/attrSetValues functions.
Now untill i set the attributes and update the category Version of the workpackage with the new attributes, all works fine. Even the updation of the work package using the UpdateTaskWork function returns zero. But , the attributes do not get updated in the work package. If i try to retrieve them again from the work package, the original and not the updated values are returned.
Here is the code:
public class task {
public static void main(String[] args) {
try{
int ID = 108490;
int tID =4;
String attName = "Document Approved";
LLValue map = new LLValue().setAssoc();
LLValue map2 = new LLValue().setAssoc();
LLSession session = new LLSession("blrkec88884d", 2099, "", "Admin", "infy123", null);
session.setEncoding("UTF-8");
System.out.println("CREATED SESSION : "+session.getStatus()+" , "+session.getStatusMessage());
LAPI_WORKFLOW lapiwf = new LAPI_WORKFLOW(session);
System.out.println("workflow object status " + lapiwf);
LLValue lAdditions = (new LLValue()).setList();
int i = lapiwf.AcceptTask(ID, ID, tID);
i = lapiwf.StartTask(ID, ID, tID, map);
System.out.println("Task Started = " + i);
System.out.println("map = " + map);
LAPI_ATTRIBUTES attributes = new LAPI_ATTRIBUTES(session);
LLValue temp = new LLValue().setList();
LLValue temp2 = new LLValue().setList();
LLValue catVersion = map.toValue(2).toValue("USERDATA").toValue("catVersion");
LLValue catVersion2;
System.out.println("catVersion = " + catVersion);
attributes.AttrGetInfo(catVersion, attName, null, temp);
System.out.println("Att Info" + temp);
int att = attributes.AttrGetValues(catVersion, attName, 5, null, temp2);
System.out.println(att + " ------attribute info-------- " + temp2);
System.out.println(temp2.toValue(0).isBoolean());
temp2.remove(0);
temp2.add(false);
System.out.println(temp2.toValue(0).isBoolean());
//att = attributes.AttrSetValues(catVersion, "In Scope?", 5, null, temp2);
att = attributes.AttrSetValues(catVersion, attName, 5, null, temp2);
map.toValue(2).toValue("USERDATA").setValue("catVersion",catVersion);
//att = attributes.AttrSetValues(catVersion, "In approved parts list?", 5, null, temp2);
//att = attributes.AttrGetValues(catVersion, "In Scope?", 5, null, temp);
att = attributes.AttrGetValues(catVersion, attName, 5, null, temp);
System.out.println(att + " ------attribute info-------- " + temp);
//map.toValue(2).toValue("USERDATA").setValue("catVersion",catVersion);
catVersion2 = map.toValue(2).toValue("USERDATA").toValue("catVersion");
att = attributes.AttrGetValues(catVersion2, attName, 5, null, temp2);
System.out.println(att + " ------intermediate-------- " + temp2);
//int i1 = lapiwf.UpdateWorkPackage(ID, ID, map);
i = lapiwf.UpdateTaskWork(ID, ID, tID, map);
System.out.println("Updation = " + i);
i = lapiwf.AccessWorkPackage(ID, ID, map2);
System.out.println("Task Started again = " + i);
catVersion = map2.toValue(2).toValue("USERDATA").toValue("catVersion");
att = attributes.AttrGetValues(catVersion, attName, 5, null, temp2);
System.out.println(att + " ------updated attribute info-------- " + temp2);
//att = attributes.AttrGetValues(catVersion, "In Scope?", 5, null, temp);
System.out.println("After Updation = " + temp2);
i = lapiwf.ListWorkflowInbox("Todo2", "", "", 1, 0, temp,temp2);
System.out.println(i + temp.toInteger() + "----------Task Status---------" + temp2);
i = lapiwf.EndTask(ID, ID, tID, "Approve");
System.out.println("End Task = " + i);
}
catch (Exception e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
Any help will be appreciated.
Thanx