-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
107 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
deployment/src/main/java/io/quarkiverse/jasperreports/deployment/ReportFileBuildItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package io.quarkiverse.jasperreports.deployment; | ||
|
||
import java.nio.file.Path; | ||
import java.util.List; | ||
import java.util.Locale; | ||
|
||
import org.apache.commons.io.FilenameUtils; | ||
|
||
import io.quarkus.builder.item.MultiBuildItem; | ||
|
||
/** | ||
* This build item represents a single watched Report file either .jrxml, .jasper, or .jrtx | ||
*/ | ||
public final class ReportFileBuildItem extends MultiBuildItem { | ||
|
||
public final static String EXT_REPORT = "jrxml"; | ||
public final static String EXT_STYLE = "jrtx"; | ||
public final static String EXT_COMPILED = "jasper"; | ||
public final static List<String> EXTENSIONS = List.of("." + EXT_REPORT, "." + EXT_COMPILED, "." + EXT_STYLE); | ||
|
||
private final Path path; | ||
|
||
public ReportFileBuildItem(Path path) { | ||
this.path = path; | ||
} | ||
|
||
public Path getPath() { | ||
return path; | ||
} | ||
|
||
public String getFileName() { | ||
return path.getFileName().toString(); | ||
} | ||
|
||
public String getParent() { | ||
return path.getParent().toString(); | ||
} | ||
|
||
public String getType() { | ||
String extension = FilenameUtils.getExtension(path.getFileName().toString()).toLowerCase(Locale.ROOT); | ||
return switch (extension) { | ||
case EXT_COMPILED -> "COMPILED"; | ||
case EXT_REPORT -> "REPORT"; | ||
case EXT_STYLE -> "STYLES"; | ||
default -> "???"; | ||
}; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters