09-25-2013 11:09 AM
@Service
public class AddClientService implements ActivityBehavior {
@Override
public void execute(ActivityExecution execution) throws Exception {
PvmTransition transition = null;
Client client = new Client();
client.setFirstName("John");
client.setLastName("Smith"); // Have unique constraint
execution.setVariable("client", client); // need to be rollbacked in case of error
Engine engine = Engine.getInstance();
SessionFactory sessionFactory = engine.getHibernateSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
try {
session.save(client);
session.getTransaction().commit();
transition = execution.getActivity().findOutgoingTransition("toTaskOneFlow");
} catch (Exception ex) {
transition = execution.getActivity().findOutgoingTransition("toTaskTwoFlow");
} finally {
session.close();
}
execution.take(transition);
}
}
03-21-2014 07:07 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.