import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.splat.dal.bo.som.DocumentType;
+import org.splat.dal.bo.som.ProgressState;
+import org.splat.dal.dao.som.Database;
import org.splat.dal.dao.som.DocumentTypeDAO;
import org.splat.kernel.InvalidPropertyException;
import org.splat.kernel.MissedPropertyException;
*
* @return the list of all document types
*/
- @Transactional(readOnly = true)
+// @Transactional(readOnly = true)
+ @Transactional
public List<DocumentType> selectAllTypes() {
List<DocumentType> types = getDocumentTypeDAO().getAll();
for (Iterator<DocumentType> i = types.iterator(); i.hasNext();) {
return types;
}
+ /**
+ * Approve the document type.
+ * @param aType the document type to approve
+ * @return true if approval succeeded
+ */
+ @Transactional
+ public boolean approve (DocumentType aType) {
+ if (aType.getState() != ProgressState.inCHECK) return false;
+ aType.setState(ProgressState.APPROVED); // The type name is supposed being localized
+ getDocumentTypeDAO().update(aType);
+ return true;
+ }
+
/**
* Get the documentTypeDAO.
*