@SuppressWarnings("unchecked") @DeleteIdentifiedOperation public synchronized void deleteErrorDocumentsForWFRun(String workflowRunId) throws DaoException { try{ // Select all ErrorDocuments for this wf run Session session = getSession(); Query selectQuery= session.createQuery("FROM ErrorDocumentImpl WHERE namespacePart=:workflow_run_id"); selectQuery.setString("workflow_run_id", workflowRunId); List<ErrorDocument> errorDocuments = selectQuery.list(); session.close(); // need to close before we do delete otherwise hibernate complains that two sessions are accessing collection getHibernateTemplate().deleteAll(errorDocuments); } catch(Exception ex){ throw new DaoException(ex); } }
@PutIdentifiedOperation public void store(ErrorDocument theDocument) throws DaoException { if (theDocument.getId() == null) { throw new DaoException( "Supplied error document set has a null ID, allocate " + "an ID before calling the store method in the dao."); } else if (theDocument.getId().getReferenceType().equals( T2ReferenceType.ErrorDocument) == false) { throw new DaoException("Strangely the list ID doesn't have type " + "T2ReferenceType.ErrorDocument, something has probably " + "gone badly wrong somewhere earlier!"); } if (theDocument instanceof ErrorDocumentImpl) { try { getHibernateTemplate().save(theDocument); } catch (Exception ex) { throw new DaoException(ex); } } else { throw new DaoException( "Supplied ErrorDocument not an instance of ErrorDocumentImpl"); } } }
return (ErrorDocumentImpl) getHibernateTemplate().get( ErrorDocumentImpl.class, ((T2ReferenceImpl) ref).getCompactForm());
@DeleteIdentifiedOperation public boolean delete(ErrorDocument theDocument) throws DaoException { if (theDocument.getId() == null) { throw new DaoException( "Supplied error document set has a null ID, allocate " + "an ID before calling the store method in the dao."); } else if (theDocument.getId().getReferenceType().equals( T2ReferenceType.ErrorDocument) == false) { throw new DaoException("Strangely the list ID doesn't have type " + "T2ReferenceType.ErrorDocument, something has probably " + "gone badly wrong somewhere earlier!"); } if (theDocument instanceof ErrorDocumentImpl) { try { getHibernateTemplate().delete(theDocument); } catch (Exception ex) { throw new DaoException(ex); } } else { throw new DaoException( "Supplied ErrorDocument not an instance of ErrorDocumentImpl"); } return true; }
@PutIdentifiedOperation public void store(ErrorDocument theDocument) throws DaoException { if (theDocument.getId() == null) { throw new DaoException( "Supplied error document set has a null ID, allocate " + "an ID before calling the store method in the dao."); } else if (theDocument.getId().getReferenceType().equals( T2ReferenceType.ErrorDocument) == false) { throw new DaoException("Strangely the list ID doesn't have type " + "T2ReferenceType.ErrorDocument, something has probably " + "gone badly wrong somewhere earlier!"); } if (theDocument instanceof ErrorDocumentImpl) { try { getHibernateTemplate().save(theDocument); } catch (Exception ex) { throw new DaoException(ex); } } else { throw new DaoException( "Supplied ErrorDocument not an instance of ErrorDocumentImpl"); } } }
return (ErrorDocumentImpl) getHibernateTemplate().get( ErrorDocumentImpl.class, ((T2ReferenceImpl) ref).getCompactForm());
@PutIdentifiedOperation public void store(ErrorDocument theDocument) throws DaoException { if (theDocument.getId() == null) { throw new DaoException( "Supplied error document set has a null ID, allocate " + "an ID before calling the store method in the dao."); } else if (theDocument.getId().getReferenceType().equals( T2ReferenceType.ErrorDocument) == false) { throw new DaoException("Strangely the list ID doesn't have type " + "T2ReferenceType.ErrorDocument, something has probably " + "gone badly wrong somewhere earlier!"); } if (theDocument instanceof ErrorDocumentImpl) { try { getHibernateTemplate().save(theDocument); } catch (Exception ex) { throw new DaoException(ex); } } else { throw new DaoException( "Supplied ErrorDocument not an instance of ErrorDocumentImpl"); } }
return (ErrorDocumentImpl) getHibernateTemplate().get( ErrorDocumentImpl.class, ((T2ReferenceImpl) ref).getCompactForm());