on 10-13-2013 11:46 PM
Hey it's me again.
I made some efforts with my uwl, but I dont understand the following Problem. Whehn the Servlet tries to complete the task I get an error with the following description.
Cannot process an HTTP request to servlet [AbschlussController] in [example.org~bachelor1~ui~web] web application.
[EXCEPTION]
com.sap.bpm.exception.api.BPMIllegalAccessException: The current user is not authorized to complete task with id: bpm://bpm.sap.com/task-instance/4722f1bb33e211e3b501000000600d42
at com.sap.bpem.tm.impl.TaskInstanceManagerBean.complete(TaskInstanceManagerBean.java:155)
at com.sap.bpem.tm.impl.TaskInstanceManagerBean.complete(TaskInstanceManagerBean.java:112)
.
.
.
Caused by: com.sap.bpem.tm.exception.InvalidAuthorizationException: The user 'USER.PRIVATE_DATASOURCE.un:xxxxxxx' is not authorized to complete the task '4722f1bb33e211e3b501000000600d42'.
Did I forgot anything in the configuration?
Here is my Javacode of the Servlet
public class AbschlussController extends HttpServlet {
private static final long serialVersionUID = 1L;
public TaskInstanceManager manager = BPMFactory.getTaskInstanceManager();
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// Initialisierung der Session und des TaskInstanceManagers
HttpSession session = request.getSession();
TaskInstanceManager manager = BPMFactory.getTaskInstanceManager();
// Initialisierung der Logindaten
IAuthentication auth = UMFactory.getAuthenticator();
IUser user = auth.forceLoggedInUser(request, response);
// Initialiserung der Metadaten der ausgewählten Task
TaskMetaData metaData = (TaskMetaData) session.getAttribute("metaData");
// Initialisierung der Bean TaskData zur späteren Verwendung in der JSP
TaskData taskData = TaskData.getInstance();
// Initialisierung des TaskInput-Objects aus dem Task
URI taskIntanceId = metaData.getTaskId();
TaskDetail taskDetail = manager.getTaskDetail(taskIntanceId);
DataObject taskOutput = taskDetail.getOutputDataObject();
//Ermittlung der Task-Art
String name= metaData.getName();
if(name.equals(new String("Anfrage formulieren"))){
taskOutput.setString("Notebook", (String)request.getAttribute("Notebook"));
// taskOutput.setFloat("Preis", (Float)request.getAttribute("Preis"));
// taskOutput.setShort("Stueckzahl", (Short)request.getAttribute("Stueckzahl"));
taskOutput.setString("Anmerkung", (String)request.getAttribute("Anmerkung"));
}else if(name.equals(new String("Anfrage genehmigen"))){
taskOutput.setString("Notebook", (String)request.getAttribute("Notebook"));
taskOutput.setFloat("Preis", (Float)request.getAttribute("Preis"));
taskOutput.setShort("Stueckzahl", (Short)request.getAttribute("Stueckzahl"));
taskOutput.setString("Anmerkung", (String)request.getAttribute("Anmerkung"));
String check=(String)request.getAttribute("Genehmigen");
if(check.equals(new String("Ja"))){
taskOutput.setBoolean("genehmigt", true);
}else taskOutput.setBoolean("genehmigt", false);
}
// Abschließen der Task
manager.complete(metaData.getTaskId(), taskOutput);
// Entfernen der Taskabhängigen Datenobjekte aus der Session
session.removeAttribute("taskData");
session.removeAttribute("metaData");
response.sendRedirect("UWL.jsp");
}
Is it perhaps due to the fact that I implemented the code...
IAuthentication auth = UMFactory.getAuthenticator();
IUser user = auth.forceLoggedInUser(request, response);
...in every Servlet I use?
Best Regards
Dominik
Hey Siddhant,
thx for your help. I got this Problem fixed. But I still got some issues with the InputData and OutputDataObjects. When I run the project I get this error:
Cannot process an HTTP request to servlet [AbschlussController] in [example.org~bachelor1~ui~web] web application.
[EXCEPTION]
java.lang.IllegalArgumentException: Path Notebook can not be resolved on data object [http://example.org/wd/TestFormulieren/ports#TFCompleteEventTypeOUTPUT]{TFCompleteEvent:[UNSET] default=null}
at com.sap.sdo.impl.objects.GenericDataObject.set(GenericDataObject.java:160)
at com.sap.sdo.impl.objects.GenericDataObject.setString(GenericDataObject.java:453)
at org.Domae.Controller.AbschlussController.doPost(AbschlussController.java:51)
My implementation code for the Data object is:
import commonj.sdo.DataObject;
// Initialisierung des TaskInput-Objects aus dem Task
URI taskInstanceId = metaData.getTaskId();
TaskDetail taskDetail = manager.getTaskDetail(taskInstanceId);
DataObject taskOutput = taskDetail.getOutputDataObject();
// Ermittlung der Task-Art
String name = metaData.getName();
if (name.equals(new String("testFormulieren"))) {
taskOutput.setString("Notebook", (String) request
.getAttribute("Notebook"));
taskOutput.setFloat("Preis", (Float) request.getAttribute("Preis"));
taskOutput.setShort("Stueckzahl", (Short) request
.getAttribute("Stueckzahl"));
taskOutput.setString("Anmerkung", (String) request
.getAttribute("Anmerkung"));
}
I think it is a bit more complicated to map the data in the Dataobjects. Do I have to convert it into xml or something?
Regards
Dominik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dominik,
I haven´t seen a separate post for this question (as Jocelyn suggested). However, I don´t want to hold back the solution
The output data object typically has one more inner data object which you first of all have to create as the object you get from the API is completely empty. Try putting the following line before you set the actual data in the data object:
DataObject innerDO = taskOutput.createDataObject("TFCompleteEvent"); //TFCompleteEvent I took from your stack trace
innerDO.setString("Notebook", (String) request.getAttribute("Notebook"));
...
This should do the job in your case.
Best regards,Stefan
Hi Dominik,
Stefan is right. You need to insert/set the inner data object in your code.
Please make sure that the Input mapping for this task(UI) is correct in CE.
To answer your last query, I would suggest it is always better to handle data in XML to avoid issues similar to this. Handling data in XML also provides the ease to import/export context data in case there is a need. If there is a change in the data structure in the near future, it would be easier just to change your XML structure than to change your code every time. Just a suggestion.
Regards,
Siddhant
Hey thx both of you Stefan and Siddhant for your answers. Unfortunately I get a new Error message. But I dont want to post a new comment everytime I get an error so as Jocelyn mentioned I will start a new discussion and ask for some theoreticaly information about how the Dataobjects in my Java code and those of the mapping in the pricess context are connected.
So then perhaps I don't have to ask so much questions anymore
Best Regards
Dominik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dominik,
Try these links out. Might help:
http://help.sap.com/saphelp_nw73ehp1/helpdata/en/9c/23eaeb4c53486f8d9c4cb376b99994/frameset.htm
http://help.sap.com/saphelp_nw73ehp1/helpdata/en/49/8b4659c793355ae10000000a42189b/frameset.htm
http://help.sap.com/saphelp_nw73ehp1/helpdata/en/45/d7d0e08a164c5e87e4604ba89c632a/frameset.htm
Regards,
Sid.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you need to add some role to the user in ume,
it should be BPEM End User
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.