• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

aspectran / aspectran / #3427

04 Apr 2024 08:25PM CUT coverage: 34.084% (+0.01%) from 34.074%
#3427

Pull #635

github

web-flow
Bump org.apache.maven.plugins:maven-source-plugin from 3.3.0 to 3.3.1

Bumps [org.apache.maven.plugins:maven-source-plugin](https://github.com/apache/maven-source-plugin) from 3.3.0 to 3.3.1.
- [Commits](https://github.com/apache/maven-source-plugin/compare/maven-source-plugin-3.3.0...maven-source-plugin-3.3.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-source-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #635: Bump org.apache.maven.plugins:maven-source-plugin from 3.3.0 to 3.3.1

13165 of 38625 relevant lines covered (34.08%)

0.34 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/core/src/main/java/com/aspectran/core/activity/InstantActivitySupport.java
1
/*
2
 * Copyright (c) 2008-2024 The Aspectran Project
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package com.aspectran.core.activity;
17

18
import com.aspectran.core.adapter.ApplicationAdapter;
19
import com.aspectran.core.component.bean.BeanRegistry;
20
import com.aspectran.core.component.bean.annotation.AvoidAdvice;
21
import com.aspectran.core.component.bean.aware.ActivityContextAware;
22
import com.aspectran.core.component.template.TemplateRenderer;
23
import com.aspectran.core.context.ActivityContext;
24
import com.aspectran.core.context.env.Environment;
25
import com.aspectran.core.context.rule.type.MethodType;
26
import com.aspectran.core.support.i18n.message.MessageSource;
27
import com.aspectran.utils.Assert;
28
import com.aspectran.utils.StringUtils;
29
import com.aspectran.utils.annotation.jsr305.NonNull;
30

31
/**
32
 * Inheriting this class provides access to the activity context and
33
 * facilitates execution of the activity.
34
 *
35
 * <p>Created: 29/09/2019</p>
36
 */
37
@AvoidAdvice
38
public abstract class InstantActivitySupport implements ActivityContextAware {
×
39

40
    private ActivityContext context;
41

42
    @NonNull
43
    protected ActivityContext getActivityContext() {
44
        Assert.state(context != null, "No ActivityContext injected");
×
45
        return context;
×
46
    }
47

48
    @Override
49
    @AvoidAdvice
50
    public void setActivityContext(@NonNull ActivityContext context) {
51
        Assert.state(this.context == null, "ActivityContext already injected");
×
52
        this.context = context;
×
53
    }
×
54

55
    protected Activity getAvailableActivity() {
56
        return getActivityContext().getAvailableActivity();
×
57
    }
58

59
    protected Activity getCurrentActivity() {
60
        return getActivityContext().getCurrentActivity();
×
61
    }
62

63
    protected boolean hasCurrentActivity() {
64
        return getActivityContext().hasCurrentActivity();
×
65
    }
66

67
    protected ApplicationAdapter getApplicationAdapter() {
68
        return getActivityContext().getApplicationAdapter();
×
69
    }
70

71
    protected Environment getEnvironment() {
72
        return getActivityContext().getEnvironment();
×
73
    }
74

75
    protected BeanRegistry getBeanRegistry() {
76
        return getActivityContext().getBeanRegistry();
×
77
    }
78

79
    protected TemplateRenderer getTemplateRenderer() {
80
        return getActivityContext().getTemplateRenderer();
×
81
    }
82

83
    protected MessageSource getMessageSource() {
84
        return getActivityContext().getMessageSource();
×
85
    }
86

87
    protected <V> V instantActivity(InstantAction<V> instantAction) {
88
        if (instantAction == null) {
×
89
            throw new IllegalArgumentException("instantAction must not be null");
×
90
        }
91
        try {
92
            InstantActivity activity = new InstantActivity(getActivityContext());
×
93
            return activity.perform(instantAction);
×
94
        } catch (Exception e) {
×
95
            throw new InstantActivityException(e);
×
96
        }
97
    }
98

99
    protected void instantActivity(String requestName) {
100
        instantActivity(requestName, MethodType.GET);
×
101
    }
×
102

103
    protected void instantActivity(String requestName, MethodType requestMethod) {
104
        if (StringUtils.isEmpty(requestName)) {
×
105
            throw new IllegalArgumentException("requestName must not be null or empty");
×
106
        }
107
        Activity currentActivity = getCurrentActivity();
×
108
        Translet translet = currentActivity.getTranslet();
×
109
        if (translet == null) {
×
110
            throw new IllegalStateException("No Translet in " + currentActivity);
×
111
        }
112
        try {
113
            InstantActivity activity = new InstantActivity(currentActivity);
×
114
            activity.prepare(requestName, requestMethod);
×
115
            activity.perform();
×
116
        } catch (Exception e) {
×
117
            throw new InstantActivityException(e);
×
118
        }
×
119
    }
×
120

121
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc