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 found document type
*/
@Transactional(readOnly = true)
- public DocumentType selectType(String name) {
+ public DocumentType selectType(final String name) {
return getDocumentTypeDAO().findByCriteria(
Restrictions.eq("name", name));
}
* @return the found document type
*/
@Transactional(readOnly = true)
- public DocumentType selectType(long index) {
+ public DocumentType selectType(final long index) {
return getDocumentTypeDAO().get(index);
}
* if some property is defined several times
*/
@Transactional
- public DocumentType createType(DocumentType.Properties tprop)
+ public DocumentType createType(final DocumentType.Properties tprop)
throws MissedPropertyException, InvalidPropertyException,
MultiplyDefinedException {
// TODO: Check for duplicate definition
* @return the list of found document types
*/
@Transactional(readOnly = true)
- public List<DocumentType> selectTypesOf(ProjectSettingsService.Step step) {
+ public List<DocumentType> selectTypesOf(final ProjectSettingsService.Step step) {
Integer number = step.getNumber();
String sampleStr = new StringBuffer("%-").append(number).append("-%")
.toString();
* @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;
- }
+ public boolean approve(final DocumentType aType) {
+ boolean res = (aType.getState() == ProgressState.inCHECK);
+ if (res) {
+ aType.setState(ProgressState.APPROVED); // The type name is supposed being localized
+ getDocumentTypeDAO().update(aType);
+ }
+ return res;
+ }
/**
* Get the documentTypeDAO.
* @param documentTypeDAO
* the documentTypeDAO to set
*/
- public void setDocumentTypeDAO(DocumentTypeDAO documentTypeDAO) {
+ public void setDocumentTypeDAO(final DocumentTypeDAO documentTypeDAO) {
_documentTypeDAO = documentTypeDAO;
}
}