|
ALBPM Process API (PAPI) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectDefaultException
fuego.papi.BatchOperationException
Thrown when not all requested objects were retrieved or the executed operation was not performed correctly over every object.
The available objects can retrieved using getAvailableObjects and casting to the desired type, or useing the getAvailableXXX method of the appropriate subclass without casting, for example getAvailableInstances() in InstancesException. To get the Exceptions per object, call getNotAvailableObjects, which returns a map with object Id as keys and Exceptions as values.
//get a ProcessServiceSession and a View.
//get the instances, catching the BatchOperationException here, as we may still get a subset of instances
InstanceInfo[] instances = new fuego.papi.InstanceInfo[0];
try
{
instances = serviceSession.getInstancesByView((InstancesView) view);
}
catch (BatchOperationException e)
{
//if fail all, just print out the message, which contains all detail messages.
if (e.failAll())
{
System.out.println("Unable to retrieve any instances from the view " + e.getMessage());
return;
}
else
{
//get the instances that we can retrieve, and print out any errors, but still continue.
instances = (InstanceInfo[]) e.getAvailableObjects();
//note that this could also be done by casting to an InstanceException,
// and then calling getAvailableInstances().
//getMessage(locale) from BatchOperationException concatenates all exceptions,
System.out.println("Batch Operation Exception when retrieving instances from the view " +
e.getMessage(Locale.getDefault()));
//to get the individual processes and exceptions, get the map of not available objects.
Map map = e.getNotAvailableObjects();
Iterator iter = map.entrySet().iterator();
while (iter.hasNext())
{
Map.Entry entry = (Map.Entry) iter.next();
String processId = (String) entry.getKey();
Throwable throwable = (Throwable) entry.getValue();
System.out.println("Failing processId = " + processId + "\n");
System.out.println("Exception class is " + throwable.getClass().getName() );
System.out.println(" and Exception message is " + throwable.getMessage());
}
}
}
| Method Summary | |
boolean |
failAll()
Returns if the operation failed over every object. |
Object[] |
getAvailableObjects()
Gets the valid returned values from the operation. |
String |
getMessage(Locale locale)
Gets the message of the exception. |
Map |
getNotAvailableObjects()
Gets the exception for each object which could not perform the corresponding operation. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public Object[] getAvailableObjects()
null if there are not available objects.public String getMessage(Locale locale)
locale - desired locale
#getMessage(),
#getUserMessage(Locale),
#getDetail(Locale),
#getTechnicalDetail(Locale)public Map getNotAvailableObjects()
public boolean failAll()
true if the operation failes over every object.
|
ALBPM Process API (PAPI) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||