Merging r13268 through r14040 from trunk/cdmlib into branches/cdmlib-unitils3
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / IService.java
index abf9aa90f43f874e6c83df0edb4665e9c014d146..b3df76c4fa8fddd438cae63b1ab7b67796ce77fe 100644 (file)
@@ -19,9 +19,11 @@ import java.util.UUID;
 \r
 import org.hibernate.LockMode;\r
 import org.hibernate.Session;\r
+import org.springframework.security.core.Authentication;\r
 \r
 import eu.etaxonomy.cdm.api.service.pager.Pager;\r
-import eu.etaxonomy.cdm.model.common.CdmBase;\r
+import eu.etaxonomy.cdm.model.common.ICdmBase;\r
+import eu.etaxonomy.cdm.permission.CdmPermission;\r
 import eu.etaxonomy.cdm.persistence.dao.BeanInitializer;\r
 import eu.etaxonomy.cdm.persistence.query.Grouping;\r
 import eu.etaxonomy.cdm.persistence.query.OrderHint;\r
@@ -37,7 +39,7 @@ import eu.etaxonomy.cdm.persistence.query.OrderHint;
  *\r
  * @param <T>\r
  */\r
-public interface IService<T extends CdmBase>{\r
+public interface IService<T extends ICdmBase>{\r
 \r
        // FIXME what does this method do?\r
        public void clear();\r
@@ -171,7 +173,7 @@ public interface IService<T extends CdmBase>{
         * @param transientObject the entity to be merged\r
         * @return The unique identifier of the persisted entity\r
         */\r
-       public UUID merge(T transientObject);\r
+       public T merge(T transientObject);\r
        \r
        /**\r
         * Returns a paged list of entities of type <T> optionally restricted\r
@@ -272,4 +274,14 @@ public interface IService<T extends CdmBase>{
         * @return a list of matching objects\r
         */\r
        public List<T> list(T example, Set<String> includeProperties, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);\r
+       \r
+       /**\r
+     * Evaluates whether the authenticated user has the rights to perform an specific action on the target object\r
+     * @param authentication\r
+     * @param target\r
+     * @param permission\r
+     * @return\r
+     */\r
+       public boolean hasPermission(Authentication authentication, T target, CdmPermission permission);\r
+\r
 }
\ No newline at end of file