package com.l7tech.gateway.common.resources;

import com.l7tech.gateway.common.AsyncAdminMethods;
import com.l7tech.gateway.common.admin.Administrative;
import com.l7tech.gateway.common.security.rbac.MethodStereotype;
import com.l7tech.gateway.common.security.rbac.Secured;
import com.l7tech.objectmodel.DeleteException;
import com.l7tech.objectmodel.EntityType;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.Goid;
import com.l7tech.objectmodel.SaveException;
import com.l7tech.objectmodel.UpdateException;
import java.io.IOException;
import java.util.Collection;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
@Administrative
@Secured(types = EntityType.RESOURCE_ENTRY)
public interface ResourceAdmin extends AsyncAdminMethods {
   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.FIND_HEADERS)
   Collection<ResourceEntryHeader> findAllResources() throws FindException;

   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.FIND_ENTITY)
   ResourceEntry findResourceEntryByPrimaryKey(Goid var1) throws FindException;

   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.FIND_ENTITY)
   ResourceEntry findResourceEntryByUriAndType(String var1, ResourceType var2) throws FindException;

   @Secured(stereotype = MethodStereotype.DELETE_ENTITY)
   void deleteResourceEntry(ResourceEntry var1) throws DeleteException;

   @Secured(stereotype = MethodStereotype.DELETE_BY_ID)
   void deleteResourceEntry(Goid var1) throws FindException, DeleteException;

   @Secured(stereotype = MethodStereotype.SAVE_OR_UPDATE)
   Goid saveResourceEntry(ResourceEntry var1) throws SaveException, UpdateException;

   @Secured(stereotype = MethodStereotype.SAVE_OR_UPDATE)
   void saveResourceEntryBag(ResourceEntryBag var1) throws SaveException, UpdateException;

   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.FIND_HEADERS)
   Collection<ResourceEntryHeader> findResourceHeadersByType(ResourceType var1) throws FindException;

   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.FIND_HEADERS)
   ResourceEntryHeader findResourceHeaderByUriAndType(String var1, ResourceType var2) throws FindException;

   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.FIND_HEADERS)
   Collection<ResourceEntryHeader> findResourceHeadersByKeyAndType(String var1, ResourceType var2) throws FindException;

   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.FIND_HEADERS)
   Collection<ResourceEntryHeader> findResourceHeadersByTargetNamespace(String var1) throws FindException;

   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.FIND_HEADERS)
   Collection<ResourceEntryHeader> findResourceHeadersByPublicIdentifier(String var1) throws FindException;

   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.FIND_HEADERS)
   Collection<ResourceEntryHeader> findDefaultResources() throws FindException;

   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.UNCHECKED_WIDE_OPEN)
   ResourceEntry findDefaultResourceByUri(String var1) throws FindException;

   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.UNCHECKED_WIDE_OPEN)
   int countRegisteredSchemas(Collection<Goid> var1) throws FindException;

   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.UNCHECKED_WIDE_OPEN)
   boolean allowSchemaDoctype();

   @Transactional(readOnly = true)
   @Secured(types = EntityType.CLUSTER_PROPERTY, stereotype = MethodStereotype.FIND_ENTITIES)
   HttpProxyConfiguration getDefaultHttpProxyConfiguration() throws FindException;

   @Secured(types = EntityType.CLUSTER_PROPERTY, stereotype = MethodStereotype.SET_PROPERTY_BY_UNIQUE_ATTRIBUTE)
   void setDefaultHttpProxyConfiguration(HttpProxyConfiguration var1) throws SaveException, UpdateException;

   @Secured(types = EntityType.HTTP_CONFIGURATION, stereotype = MethodStereotype.FIND_ENTITIES)
   @Transactional(readOnly = true)
   Collection<HttpConfiguration> findAllHttpConfigurations() throws FindException;

   @Secured(types = EntityType.HTTP_CONFIGURATION, stereotype = MethodStereotype.FIND_ENTITY)
   @Transactional(readOnly = true)
   HttpConfiguration findHttpConfigurationByPrimaryKey(Goid var1) throws FindException;

   @Secured(types = EntityType.HTTP_CONFIGURATION, stereotype = MethodStereotype.DELETE_ENTITY)
   void deleteHttpConfiguration(HttpConfiguration var1) throws DeleteException;

   @Secured(types = EntityType.HTTP_CONFIGURATION, stereotype = MethodStereotype.SAVE_OR_UPDATE)
   Goid saveHttpConfiguration(HttpConfiguration var1) throws SaveException, UpdateException;

   @Transactional(propagation = Propagation.SUPPORTS)
   @Secured(stereotype = MethodStereotype.UNCHECKED_WIDE_OPEN)
   String resolveResource(String var1) throws IOException;

   @Transactional(propagation = Propagation.SUPPORTS)
   @Secured(stereotype = MethodStereotype.UNCHECKED_WIDE_OPEN)
   AsyncAdminMethods.JobId<String> resolveResourceAsync(String var1);
}
