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.Alias;
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 com.l7tech.objectmodel.VersionException;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
@Secured(types = {EntityType.SERVICE_ALIAS, EntityType.POLICY_ALIAS})
public interface AliasAdmin<HT extends Alias> {
   @Secured(stereotype = MethodStereotype.SAVE_OR_UPDATE)
   Goid saveAlias(HT var1) throws UpdateException, SaveException, VersionException;

   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.FIND_ENTITY)
   @Administrative(licensed = false)
   HT findAliasByEntityAndFolder(Goid var1, Goid var2) throws FindException;

   @Secured(stereotype = MethodStereotype.DELETE_BY_ID, types = {EntityType.SERVICE_ALIAS, EntityType.POLICY_ALIAS})
   void deleteEntityAlias(String var1) throws DeleteException;
}
