File tree 1 file changed +19
-1
lines changed
jberet-core/src/main/java/org/jberet/job/model
1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,12 @@ public class Script implements Serializable, Cloneable {
73
73
this .src = src ;
74
74
}
75
75
76
+ public Script (final String type , final String src , final String content ) {
77
+ this .type = type ;
78
+ this .src = src ;
79
+ this .content = content ;
80
+ }
81
+
76
82
/**
77
83
* Gets the content of the script as string.
78
84
* If the script is specified as inline in job XML, its content is returned. Otherwise, this method tries to load
@@ -112,7 +118,8 @@ public String getContent(final ClassLoader classLoader) {
112
118
java .util .Scanner scanner = null ;
113
119
try {
114
120
scanner = new java .util .Scanner (is ).useDelimiter ("\\ A" );
115
- return scanner .hasNext () ? scanner .next () : "" ;
121
+ this .content = scanner .hasNext () ? scanner .next () : "" ;
122
+ return content ;
116
123
} finally {
117
124
if (scanner != null ) {
118
125
try {
@@ -125,6 +132,17 @@ public String getContent(final ClassLoader classLoader) {
125
132
}
126
133
}
127
134
135
+ public String getContent () {
136
+ if (content == null ) {
137
+ throw new IllegalStateException ();
138
+ }
139
+ return content ;
140
+ }
141
+
142
+ public String getSrc () {
143
+ return src ;
144
+ }
145
+
128
146
/**
129
147
* Gets the type of the script, for example, {@code javascript}.
130
148
* @return type of the script
You can’t perform that action at this time.
0 commit comments