package com.l7tech.gateway.common.admin;

import com.l7tech.gateway.common.security.rbac.MethodStereotype;
import com.l7tech.gateway.common.security.rbac.Secured;
import com.l7tech.objectmodel.ConstraintViolationException;
import com.l7tech.objectmodel.DeleteException;
import com.l7tech.objectmodel.EntityType;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.Goid;
import com.l7tech.objectmodel.PersistentEntity;
import com.l7tech.objectmodel.SaveException;
import com.l7tech.objectmodel.UpdateException;
import com.l7tech.objectmodel.folder.Folder;
import com.l7tech.objectmodel.folder.FolderHeader;
import java.util.Collection;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
@Secured(types = EntityType.FOLDER)
@Administrative
public interface FolderAdmin {
   String ROLE_NAME_TYPE_SUFFIX = "Folder";

   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.FIND_HEADERS)
   @Administrative(licensed = false)
   Collection<FolderHeader> findAllFolders() throws FindException;

   @Secured(stereotype = MethodStereotype.SAVE_OR_UPDATE, relevantArg = 0)
   Goid saveFolder(Folder var1) throws UpdateException, SaveException, ConstraintViolationException;

   @Secured(stereotype = MethodStereotype.UNCHECKED_WIDE_OPEN)
   void moveEntityToFolder(Folder var1, PersistentEntity var2) throws UpdateException, ConstraintViolationException;

   @Secured(types = EntityType.FOLDER, stereotype = MethodStereotype.DELETE_BY_ID)
   void deleteFolder(Goid var1) throws FindException, DeleteException;

   @Transactional(readOnly = true)
   @Secured(types = EntityType.FOLDER, stereotype = MethodStereotype.FIND_ENTITY)
   @Administrative(licensed = false)
   Folder findByPrimaryKey(Goid var1) throws FindException;
}
