Package com.aspectran.core.activity
Class AdviceActivity
- java.lang.Object
-
- com.aspectran.core.activity.AbstractActivity
-
- com.aspectran.core.activity.AdviceActivity
-
- All Implemented Interfaces:
Activity
- Direct Known Subclasses:
CoreActivity
public abstract class AdviceActivity extends AbstractActivity
Activity related to advice.Created: 2016. 9. 10.
-
-
Constructor Summary
Constructors Constructor Description AdviceActivity(ActivityContext context)
Instantiates a new AdviceActivity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
executeAdvice(AspectAdviceRule aspectAdviceRule, boolean throwable)
Executes an aspect advice with a given rule.void
executeAdvice(java.util.List<AspectAdviceRule> aspectAdviceRuleList, boolean throwable)
Execute aspect advices with given rules.<V> V
getAfterAdviceResult(java.lang.String aspectId)
Gets the after advice result.protected java.util.List<AspectAdviceRule>
getAfterAdviceRuleList()
<V> V
getAroundAdviceResult(java.lang.String aspectId)
Gets the around advice result.<V> V
getAspectAdviceBean(java.lang.String aspectId)
Gets the aspect advice bean.<V> V
getBeforeAdviceResult(java.lang.String aspectId)
Gets the before advice result.protected java.util.List<AspectAdviceRule>
getBeforeAdviceRuleList()
protected java.util.List<ExceptionRule>
getExceptionRuleList()
<V> V
getFinallyAdviceResult(java.lang.String aspectId)
Gets the finally advice result.protected java.util.List<AspectAdviceRule>
getFinallyAdviceRuleList()
<V> V
getSetting(java.lang.String settingName)
Gets the setting value in the translet scope.protected ExceptionThrownRule
handleException(ExceptionRule exceptionRule)
void
handleException(java.util.List<ExceptionRule> exceptionRuleList)
Exception handling.protected void
prepareAspectAdviceRule(TransletRule transletRule, java.lang.String requestName)
protected void
putAdviceResult(AspectAdviceRule aspectAdviceRule, java.lang.Object adviceActionResult)
Puts the result of the advice.protected void
putAspectAdviceBean(java.lang.String aspectId, java.lang.Object adviceBean)
Puts the aspect advice bean.void
registerAspectAdviceRule(AspectRule aspectRule)
Register an aspect rule dynamically.void
registerSettingsAdviceRule(SettingsAdviceRule settingsAdviceRule)
Register a settings advice rule dynamically.protected void
setCurrentAspectAdviceType(AspectAdviceType aspectAdviceType)
-
Methods inherited from class com.aspectran.core.activity.AbstractActivity
clearRaisedException, containsBean, containsBean, containsBean, getActivityContext, getApplicationAdapter, getBean, getBean, getBean, getCurrentActivity, getEnvironment, getParentActivity, getPrototypeScopeBean, getRaisedException, getRequestAdapter, getResponseAdapter, getRootCauseOfRaisedException, getSessionAdapter, hasParentActivity, isExceptionRaised, removeCurrentActivity, saveCurrentActivity, setRaisedException, setRequestAdapter, setResponseAdapter, setSessionAdapter, terminate, terminate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.aspectran.core.activity.Activity
getDeclaredResponse, getProcessResult, getProcessResult, getTranslet, isResponseReserved, perform, perform
-
-
-
-
Constructor Detail
-
AdviceActivity
public AdviceActivity(ActivityContext context)
Instantiates a new AdviceActivity.- Parameters:
context
- the activity context
-
-
Method Detail
-
prepareAspectAdviceRule
protected void prepareAspectAdviceRule(TransletRule transletRule, java.lang.String requestName)
-
registerSettingsAdviceRule
public void registerSettingsAdviceRule(SettingsAdviceRule settingsAdviceRule)
Description copied from interface:Activity
Register a settings advice rule dynamically.- Parameters:
settingsAdviceRule
- the settings advice rule
-
registerAspectAdviceRule
public void registerAspectAdviceRule(AspectRule aspectRule) throws AdviceConstraintViolationException, AspectAdviceException
Description copied from interface:Activity
Register an aspect rule dynamically.- Parameters:
aspectRule
- the aspect rule- Throws:
AdviceConstraintViolationException
- thrown when an Advice Constraint Violation occursAspectAdviceException
- thrown when an error occurs while running advice
-
setCurrentAspectAdviceType
protected void setCurrentAspectAdviceType(AspectAdviceType aspectAdviceType)
-
executeAdvice
public void executeAdvice(java.util.List<AspectAdviceRule> aspectAdviceRuleList, boolean throwable) throws AspectAdviceException
Description copied from interface:Activity
Execute aspect advices with given rules.- Parameters:
aspectAdviceRuleList
- the aspect advice rulesthrowable
- whether to raise an exception- Throws:
AspectAdviceException
- thrown when an error occurs while running advice
-
executeAdvice
public void executeAdvice(AspectAdviceRule aspectAdviceRule, boolean throwable) throws AspectAdviceException
Description copied from interface:Activity
Executes an aspect advice with a given rule.- Parameters:
aspectAdviceRule
- the aspect advice rulethrowable
- whether to raise an exception- Throws:
AspectAdviceException
- thrown when an error occurs while running advice
-
handleException
public void handleException(java.util.List<ExceptionRule> exceptionRuleList) throws ActionExecutionException
Description copied from interface:Activity
Exception handling.- Parameters:
exceptionRuleList
- the exception rule list- Throws:
ActionExecutionException
- thrown when an error occurs while executing an action
-
handleException
protected ExceptionThrownRule handleException(ExceptionRule exceptionRule) throws ActionExecutionException
- Throws:
ActionExecutionException
-
getBeforeAdviceRuleList
protected java.util.List<AspectAdviceRule> getBeforeAdviceRuleList()
-
getAfterAdviceRuleList
protected java.util.List<AspectAdviceRule> getAfterAdviceRuleList()
-
getFinallyAdviceRuleList
protected java.util.List<AspectAdviceRule> getFinallyAdviceRuleList()
-
getExceptionRuleList
protected java.util.List<ExceptionRule> getExceptionRuleList()
-
getSetting
public <V> V getSetting(java.lang.String settingName)
Description copied from interface:Activity
Gets the setting value in the translet scope.- Type Parameters:
V
- the type of the value- Parameters:
settingName
- the setting name- Returns:
- the setting value
-
getAspectAdviceBean
public <V> V getAspectAdviceBean(java.lang.String aspectId)
Gets the aspect advice bean.- Type Parameters:
V
- the type of the advice bean- Parameters:
aspectId
- the aspect id- Returns:
- the aspect advice bean
-
putAspectAdviceBean
protected void putAspectAdviceBean(java.lang.String aspectId, java.lang.Object adviceBean)
Puts the aspect advice bean.- Parameters:
aspectId
- the aspect idadviceBean
- the advice bean
-
getBeforeAdviceResult
public <V> V getBeforeAdviceResult(java.lang.String aspectId)
Gets the before advice result.- Type Parameters:
V
- the result type of the before advice- Parameters:
aspectId
- the aspect id- Returns:
- the before advice result
-
getAfterAdviceResult
public <V> V getAfterAdviceResult(java.lang.String aspectId)
Gets the after advice result.- Type Parameters:
V
- the result type of the after advice- Parameters:
aspectId
- the aspect id- Returns:
- the after advice result
-
getAroundAdviceResult
public <V> V getAroundAdviceResult(java.lang.String aspectId)
Gets the around advice result.- Type Parameters:
V
- the result type of the around advice- Parameters:
aspectId
- the aspect id- Returns:
- the around advice result
-
getFinallyAdviceResult
public <V> V getFinallyAdviceResult(java.lang.String aspectId)
Gets the finally advice result.- Type Parameters:
V
- the result type of the finally advice- Parameters:
aspectId
- the aspect id- Returns:
- the finally advice result
-
putAdviceResult
protected void putAdviceResult(AspectAdviceRule aspectAdviceRule, java.lang.Object adviceActionResult)
Puts the result of the advice.- Parameters:
aspectAdviceRule
- the aspect advice ruleadviceActionResult
- the advice action result
-
-