1
1
package de .intranda .goobi .plugins ;
2
2
3
- import java .io .IOException ;
4
- import java .io .InputStream ;
5
- import java .nio .file .Files ;
6
- import java .nio .file .Path ;
7
- import java .nio .file .StandardCopyOption ;
8
- import java .util .HashMap ;
9
-
10
- import org .goobi .beans .Step ;
11
- import org .goobi .production .enums .PluginGuiType ;
12
- import org .goobi .production .enums .PluginType ;
13
- import org .goobi .production .enums .StepReturnValue ;
14
- import org .goobi .production .plugin .interfaces .IRestGuiPlugin ;
15
-
16
3
import de .intranda .goobi .plugins .ocrselector .Routes ;
17
4
import lombok .Data ;
18
5
import lombok .extern .log4j .Log4j ;
19
6
import net .xeoh .plugins .base .annotations .PluginImplementation ;
7
+ import org .goobi .beans .Step ;
8
+ import org .goobi .production .enums .PluginGuiType ;
9
+ import org .goobi .production .enums .PluginType ;
10
+ import org .goobi .production .enums .StepReturnValue ;
11
+ import org .goobi .production .plugin .interfaces .IGuiPlugin ;
12
+ import org .goobi .production .plugin .interfaces .IRestPlugin ;
13
+ import org .goobi .production .plugin .interfaces .IStepPlugin ;
20
14
import spark .Service ;
21
15
16
+ import java .util .HashMap ;
17
+
22
18
@ Log4j
23
19
@ Data
24
20
@ PluginImplementation
25
- public class OcrSelector implements IRestGuiPlugin {
21
+ public class OcrSelector implements IRestPlugin , IGuiPlugin , IStepPlugin {
26
22
private Step step ;
27
23
private String returnPath ;
28
24
private String title = "intranda_step_ocrselector" ;
29
25
30
- @ Override
31
- public void extractAssets (Path assetsDir ) {
32
- String [] paths = new String [] { "css/style.css" , "js/app.js" , "js/riot.min.js" , "js/tags.js" , "js/ugh.js" };
33
- for (String p : paths ) {
34
- extractFile (p , assetsDir );
35
- }
36
- }
37
-
38
- private void extractFile (String filePath , Path assetsDir ) {
39
- Path out = assetsDir .resolve ("plugins" ).resolve (title ).resolve (filePath );
40
- try (InputStream is = getClass ().getClassLoader ().getResourceAsStream ("/frontend/" + filePath )) {
41
- if (!Files .exists (out .getParent ())) {
42
- Files .createDirectories (out .getParent ());
43
- }
44
- if (is != null ) {
45
- Files .copy (is , out , StandardCopyOption .REPLACE_EXISTING );
46
- }
47
- } catch (IOException e ) {
48
- // TODO Auto-generated catch block
49
- log .error (e );
50
- }
51
- }
52
-
53
26
@ Override
54
27
public String cancel () {
55
28
return "/uii/" + returnPath ;
@@ -67,7 +40,7 @@ public String finish() {
67
40
68
41
@ Override
69
42
public String getPagePath () {
70
- return "/uii/guiPlugin .xhtml" ;
43
+ return "/uii/guiPluginNew .xhtml" ;
71
44
}
72
45
73
46
@ Override
@@ -97,12 +70,16 @@ public PluginType getType() {
97
70
98
71
@ Override
99
72
public String [] getJsPaths () {
100
- return new String [] { "js/riot.min.js" , "js/tags.js" , "js/app.js" , "js/ugh.js" };
73
+ return new String [] { "riot.min.js" , "tags.js" , "app.js" , "ugh.js" };
74
+ }
75
+
76
+ @ Override
77
+ public String [] getCssPaths () {
78
+ return new String [] { "style.css" };
101
79
}
102
80
103
81
@ Override
104
82
public void initRoutes (Service http ) {
105
83
Routes .initRoutes (http );
106
-
107
84
}
108
85
}
0 commit comments