|
| 1 | +package com.demcha.examples.flagships; |
| 2 | + |
| 3 | +import com.demcha.compose.GraphCompose; |
| 4 | +import com.demcha.compose.document.api.DocumentPageSize; |
| 5 | +import com.demcha.compose.document.api.DocumentSession; |
| 6 | +import com.demcha.compose.document.templates.api.DocumentTemplate; |
| 7 | +import com.demcha.compose.document.templates.cv.v2.data.CvDocument; |
| 8 | +import com.demcha.compose.document.templates.cv.v2.data.CvEntry; |
| 9 | +import com.demcha.compose.document.templates.cv.v2.data.CvIdentity; |
| 10 | +import com.demcha.compose.document.templates.cv.v2.data.CvSkill; |
| 11 | +import com.demcha.compose.document.templates.cv.v2.data.EntriesSection; |
| 12 | +import com.demcha.compose.document.templates.cv.v2.data.ParagraphSection; |
| 13 | +import com.demcha.compose.document.templates.cv.v2.data.RowStyle; |
| 14 | +import com.demcha.compose.document.templates.cv.v2.data.RowsSection; |
| 15 | +import com.demcha.compose.document.templates.cv.v2.data.SkillsSection; |
| 16 | +import com.demcha.compose.document.templates.cv.v2.presets.MintEditorial; |
| 17 | +import com.demcha.examples.support.ExampleOutputPaths; |
| 18 | + |
| 19 | +import java.nio.file.Path; |
| 20 | +import java.util.List; |
| 21 | + |
| 22 | +/** |
| 23 | + * Flagship "wow" hero used as the {@code assets/readme/repository_showcase_render.png} |
| 24 | + * source. Renders a polished two-page editorial CV (Mint Editorial preset) for a |
| 25 | + * meta narrative: the engine renders its own author's CV. |
| 26 | + * |
| 27 | + * <p><b>What it shows in one glance:</b></p> |
| 28 | + * <ul> |
| 29 | + * <li>Centered spaced-caps masthead with full-width mint accent rule (theme tokens |
| 30 | + * + canonical {@code pageBackgrounds} band).</li> |
| 31 | + * <li>Two-column page geometry — contact / skill / education sidebar against |
| 32 | + * profile / experience body (layered template slots).</li> |
| 33 | + * <li>Mixed content sections — paragraph (Profile), entries (Experience, Education), |
| 34 | + * skills with proficiency bars, rows (Awards), reference cards.</li> |
| 35 | + * <li>Deterministic pagination — two experience entries on page 1, continuation |
| 36 | + * onto page 2 with sidebar refresh; same {@code DocumentSession} cycle.</li> |
| 37 | + * <li>Substantive sample data — no Lorem ipsum, no placeholder reuse, so a |
| 38 | + * README hero feels like a real engineering artefact, not a template demo.</li> |
| 39 | + * </ul> |
| 40 | + * |
| 41 | + * <p>Output: |
| 42 | + * {@code examples/target/generated-pdfs/flagships/repository-hero-showcase.pdf} |
| 43 | + * — page 1 is rasterised by {@link com.demcha.examples.support.PdfPageRasterizer} |
| 44 | + * into {@code assets/readme/repository_showcase_render.png} during release prep.</p> |
| 45 | + * |
| 46 | + * @author Artem Demchyshyn |
| 47 | + * @since 1.6.6 |
| 48 | + */ |
| 49 | +public final class RepositoryHeroShowcase { |
| 50 | + |
| 51 | + private RepositoryHeroShowcase() { |
| 52 | + } |
| 53 | + |
| 54 | + public static Path generate() throws Exception { |
| 55 | + CvDocument doc = heroCv(); |
| 56 | + Path output = ExampleOutputPaths.prepare( |
| 57 | + "flagships", "repository-hero-showcase.pdf"); |
| 58 | + DocumentTemplate<CvDocument> template = MintEditorial.create(); |
| 59 | + float m = (float) MintEditorial.RECOMMENDED_MARGIN; |
| 60 | + try (DocumentSession document = GraphCompose.document(output) |
| 61 | + .pageSize(DocumentPageSize.A4) |
| 62 | + .margin(m, m, m, m) |
| 63 | + .create()) { |
| 64 | + template.compose(document, doc); |
| 65 | + document.buildPdf(); |
| 66 | + } |
| 67 | + return output; |
| 68 | + } |
| 69 | + |
| 70 | + private static CvDocument heroCv() { |
| 71 | + CvIdentity identity = CvIdentity.builder() |
| 72 | + .name("Mariia", "Demchyshyn") |
| 73 | + .jobTitle("Senior Software Engineer · Document Engine Author") |
| 74 | + .contact("+48 600 000 000", "hello@graphcompose.dev", "Kraków, Poland") |
| 75 | + .link("graphcompose.dev", "https://demchaav.github.io/GraphCompose/") |
| 76 | + .link("GitHub", "https://github.com/DemchaAV") |
| 77 | + .link("LinkedIn", "https://linkedin.com/in/demchaav") |
| 78 | + .link("Twitter", "https://twitter.com/demchaav") |
| 79 | + .build(); |
| 80 | + |
| 81 | + ParagraphSection profile = new ParagraphSection("Profile", |
| 82 | + "Senior engineer focused on declarative document composition for " |
| 83 | + + "business systems. Author and maintainer of GraphCompose — " |
| 84 | + + "a semantic Java DSL that lets services describe what a " |
| 85 | + + "document says, then resolves layout, pagination, and " |
| 86 | + + "PDFBox rendering deterministically. Eight years across " |
| 87 | + + "reporting platforms, fintech back-ends, and developer-" |
| 88 | + + "facing tooling. Believes business documents deserve the " |
| 89 | + + "same engineering rigour as the systems that produce them."); |
| 90 | + |
| 91 | + RowsSection interests = RowsSection.builder("Interests", RowStyle.PLAIN) |
| 92 | + .row("Layout Engines", "") |
| 93 | + .row("Type Design", "") |
| 94 | + .row("Determinism", "") |
| 95 | + .row("OSS Stewardship", "") |
| 96 | + .build(); |
| 97 | + |
| 98 | + EntriesSection education = EntriesSection.builder("Education") |
| 99 | + .entry("MSc Computer Science", |
| 100 | + "AGH University, Kraków", "2015 – 2017", "") |
| 101 | + .entry("BSc Software Eng.", |
| 102 | + "Lviv Polytechnic", "2011 – 2015", "") |
| 103 | + .build(); |
| 104 | + |
| 105 | + SkillsSection skills = SkillsSection.builder("Technical Skills") |
| 106 | + .leveledGroup("Layout Engines", |
| 107 | + List.of(CvSkill.of("Java + PDFBox", 0.92))) |
| 108 | + .leveledGroup("API Design", |
| 109 | + List.of(CvSkill.of("Sealed types", 0.86))) |
| 110 | + .leveledGroup("PDF Rendering", |
| 111 | + List.of(CvSkill.of("Glyph fallback", 0.81))) |
| 112 | + .leveledGroup("Test Engineering", |
| 113 | + List.of(CvSkill.of("Snapshot + japicmp", 0.78))) |
| 114 | + .leveledGroup("Release Engineering", |
| 115 | + List.of(CvSkill.of("Maven Central", 0.74))) |
| 116 | + .build(); |
| 117 | + |
| 118 | + String openSourceBody = |
| 119 | + "Authored and shipped GraphCompose v1.4 through v1.6 — declarative " |
| 120 | + + "Java DSL for structured business PDFs. ~1000 tests, no " |
| 121 | + + "breaking changes across the 1.x line, Maven Central debut " |
| 122 | + + "in v1.6.6 with signed artefacts and a japicmp binary-" |
| 123 | + + "compatibility gate.\n" |
| 124 | + + "- Designed Templates v2 layered architecture (ADR-0015) " |
| 125 | + + "and migrated 14 CV presets through it without a baseline " |
| 126 | + + "regression.\n" |
| 127 | + + "- Built the release runbook + automation that takes " |
| 128 | + + "tag-to-Central deploy under five minutes.\n" |
| 129 | + + "- Active maintainer; release cadence quarterly with " |
| 130 | + + "ADR-driven decisions visible in the repo."; |
| 131 | + |
| 132 | + String fintechBody = |
| 133 | + "Owned the PDF-rendering pipeline for invoice, account-statement, " |
| 134 | + + "and proposal generation across twelve markets. Replaced " |
| 135 | + + "the legacy HTML-to-PDF tooling with deterministic " |
| 136 | + + "semantic templates rendered through an early prototype " |
| 137 | + + "of GraphCompose.\n" |
| 138 | + + "- Measurable layout regressions cut by 80% through " |
| 139 | + + "snapshot-based regression tests.\n" |
| 140 | + + "- Designer-engineer feedback loop shortened from days " |
| 141 | + + "to hours via reviewable layout snapshots in CI.\n" |
| 142 | + + "- Mentored four engineers on declarative-layout patterns."; |
| 143 | + |
| 144 | + String reportingBody = |
| 145 | + "Java services for analytics dashboards backed by Postgres + Kafka. " |
| 146 | + + "Owned a custom PDF report exporter built on PDFBox — and " |
| 147 | + + "first ran into the layout-by-coordinates problem that " |
| 148 | + + "motivated GraphCompose's existence two years later."; |
| 149 | + |
| 150 | + EntriesSection experience = EntriesSection.builder("Experience") |
| 151 | + .entry("Author / Maintainer", |
| 152 | + "GraphCompose · Open Source", |
| 153 | + "2024 — Present", |
| 154 | + openSourceBody) |
| 155 | + .entry("Backend Engineer · Documents", |
| 156 | + "Iglika Fintech · Krakow, PL", |
| 157 | + "2020 — 2024", |
| 158 | + fintechBody) |
| 159 | + .entry("Software Engineer", |
| 160 | + "Northwind Reporting · Lviv, UA", |
| 161 | + "2017 — 2020", |
| 162 | + reportingBody) |
| 163 | + .build(); |
| 164 | + |
| 165 | + RowsSection awards = RowsSection.builder("Highlights", RowStyle.PLAIN) |
| 166 | + .row("GraphCompose v1.6 — Maven Central debut", |
| 167 | + "Cross-platform, signed artefacts · 2026") |
| 168 | + .row("Templates v2 — layered architecture (ADR-0015)", |
| 169 | + "14 CV presets migrated · 2025") |
| 170 | + .row("1,000+ test coverage maintained", |
| 171 | + "Snapshot + japicmp binary-compat gates · 2025") |
| 172 | + .row("Conference talk — \"Documents as Code\"", |
| 173 | + "Code Europe · 2024") |
| 174 | + .build(); |
| 175 | + |
| 176 | + RowsSection references = RowsSection.builder("References", RowStyle.PLAIN) |
| 177 | + .row("Available on request", "Shared during interview process.") |
| 178 | + .build(); |
| 179 | + |
| 180 | + return CvDocument.builder() |
| 181 | + .identity(identity) |
| 182 | + .sections(profile, interests, education, skills, experience, |
| 183 | + awards, references) |
| 184 | + .build(); |
| 185 | + } |
| 186 | + |
| 187 | + public static void main(String[] args) throws Exception { |
| 188 | + System.out.println("Generated: " + generate()); |
| 189 | + } |
| 190 | +} |
0 commit comments