Loading pom.xml +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ <dependency> <groupId>com.inteligr8.alfresco</groupId> <artifactId>aps-public-rest-api</artifactId> <version>2.0.11</version> <version>2.0.14</version> </dependency> <dependency> <groupId>com.inteligr8.alfresco</groupId> Loading src/main/java/com/inteligr8/maven/aps/modeling/crawler/ApsTemplateCrawlable.java 0 → 100644 +31 −0 Original line number Diff line number Diff line /* * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <https://www.gnu.org/licenses/>. */ package com.inteligr8.maven.aps.modeling.crawler; /** * An interface for APS template export transformation implementations. * * An APS template is a JSON file. * * @author brian@inteligr8.com */ public interface ApsTemplateCrawlable { /** * @return A file transformer for APS template JSON files. */ ApsFileTransformer getTemplateJsonTransformer(); } src/main/java/com/inteligr8/maven/aps/modeling/crawler/ApsTemplateCrawler.java 0 → 100644 +74 −0 Original line number Diff line number Diff line /* * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <https://www.gnu.org/licenses/>. */ package com.inteligr8.maven.aps.modeling.crawler; import java.io.File; import java.io.IOException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * A class that implements a APS App export crawler. The crawler does not * directly perform any transformations. Those are handled through a callback. * * @author brian@inteligr8.com */ public class ApsTemplateCrawler { private final Logger logger = LoggerFactory.getLogger(ApsTemplateCrawler.class); private final File templateDirectory; private final boolean failOnIntegrityViolation; /** * @param apsAppName A name for the APS App. * @param apsAppDirectory A directory to the unpacked APS App export. * @param failOnIntegrityViolation true to fail on file integrity issues; false to log warnings. */ public ApsTemplateCrawler(File apsTemplateDirectory, boolean failOnIntegrityViolation) { this.templateDirectory = apsTemplateDirectory; this.failOnIntegrityViolation = failOnIntegrityViolation; } /** * @param crawlable A crawlable implementation; the callback for potential transformations. * @throws IOException A file access exception occurred. */ public void execute(ApsTemplateCrawlable crawlable) throws IOException { this.logger.info("Crawling APS templates ..."); this.crawlTemplates(crawlable.getTemplateJsonTransformer()); } protected void crawlTemplates(ApsFileTransformer transformer) throws IOException { for (File templateFile : this.templateDirectory.listFiles()) { if (!templateFile.getName().endsWith(".json")) continue; this.logger.trace("Transforming template: {}", templateFile); try { transformer.transformFile(templateFile, null, null); } catch (IllegalArgumentException | IllegalStateException ie) { if (this.failOnIntegrityViolation) { throw ie; } else { this.logger.warn(ie.getMessage()); } } } } } src/main/java/com/inteligr8/maven/aps/modeling/goal/ApsAddressibleGoal.java +18 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ */ package com.inteligr8.maven.aps.modeling.goal; import java.util.List; import org.apache.maven.execution.MavenSession; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.settings.Server; Loading @@ -21,6 +23,7 @@ import org.apache.maven.settings.Server; import com.inteligr8.alfresco.activiti.ApsClientJerseyConfiguration; import com.inteligr8.alfresco.activiti.ApsClientJerseyImpl; import com.inteligr8.alfresco.activiti.ApsPublicRestApiJerseyImpl; import com.inteligr8.alfresco.activiti.model.Tenant; /** * This class adds APS addressbility to extending goals. Loading Loading @@ -129,4 +132,19 @@ public abstract class ApsAddressibleGoal extends DisablableGoal { return this.api; } /** * This method makes the appropriate service calls to find the first APS * tenant ID from the configured APS service. * * This method does not cache the result. * * @return An APS tenant ID; null only if there are no tenants. */ protected Long findTenantId() { List<Tenant> tenants = this.getApsApi().getAdminApi().getTenants(); if (tenants == null || tenants.isEmpty()) return null; return tenants.iterator().next().getId(); } } src/main/java/com/inteligr8/maven/aps/modeling/goal/ApsAppAccessibleGoal.java→src/main/java/com/inteligr8/maven/aps/modeling/goal/ApsAppAddressibleGoal.java +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ import com.inteligr8.alfresco.activiti.model.Tenant; * * @author brian@inteligr8.com */ public abstract class ApsAppAccessibleGoal extends ApsAddressibleGoal { public abstract class ApsAppAddressibleGoal extends ApsAddressibleGoal { @Parameter( property = "aps-model.appName", required = true ) protected String apsAppName; Loading Loading
pom.xml +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ <dependency> <groupId>com.inteligr8.alfresco</groupId> <artifactId>aps-public-rest-api</artifactId> <version>2.0.11</version> <version>2.0.14</version> </dependency> <dependency> <groupId>com.inteligr8.alfresco</groupId> Loading
src/main/java/com/inteligr8/maven/aps/modeling/crawler/ApsTemplateCrawlable.java 0 → 100644 +31 −0 Original line number Diff line number Diff line /* * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <https://www.gnu.org/licenses/>. */ package com.inteligr8.maven.aps.modeling.crawler; /** * An interface for APS template export transformation implementations. * * An APS template is a JSON file. * * @author brian@inteligr8.com */ public interface ApsTemplateCrawlable { /** * @return A file transformer for APS template JSON files. */ ApsFileTransformer getTemplateJsonTransformer(); }
src/main/java/com/inteligr8/maven/aps/modeling/crawler/ApsTemplateCrawler.java 0 → 100644 +74 −0 Original line number Diff line number Diff line /* * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <https://www.gnu.org/licenses/>. */ package com.inteligr8.maven.aps.modeling.crawler; import java.io.File; import java.io.IOException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * A class that implements a APS App export crawler. The crawler does not * directly perform any transformations. Those are handled through a callback. * * @author brian@inteligr8.com */ public class ApsTemplateCrawler { private final Logger logger = LoggerFactory.getLogger(ApsTemplateCrawler.class); private final File templateDirectory; private final boolean failOnIntegrityViolation; /** * @param apsAppName A name for the APS App. * @param apsAppDirectory A directory to the unpacked APS App export. * @param failOnIntegrityViolation true to fail on file integrity issues; false to log warnings. */ public ApsTemplateCrawler(File apsTemplateDirectory, boolean failOnIntegrityViolation) { this.templateDirectory = apsTemplateDirectory; this.failOnIntegrityViolation = failOnIntegrityViolation; } /** * @param crawlable A crawlable implementation; the callback for potential transformations. * @throws IOException A file access exception occurred. */ public void execute(ApsTemplateCrawlable crawlable) throws IOException { this.logger.info("Crawling APS templates ..."); this.crawlTemplates(crawlable.getTemplateJsonTransformer()); } protected void crawlTemplates(ApsFileTransformer transformer) throws IOException { for (File templateFile : this.templateDirectory.listFiles()) { if (!templateFile.getName().endsWith(".json")) continue; this.logger.trace("Transforming template: {}", templateFile); try { transformer.transformFile(templateFile, null, null); } catch (IllegalArgumentException | IllegalStateException ie) { if (this.failOnIntegrityViolation) { throw ie; } else { this.logger.warn(ie.getMessage()); } } } } }
src/main/java/com/inteligr8/maven/aps/modeling/goal/ApsAddressibleGoal.java +18 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ */ package com.inteligr8.maven.aps.modeling.goal; import java.util.List; import org.apache.maven.execution.MavenSession; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.settings.Server; Loading @@ -21,6 +23,7 @@ import org.apache.maven.settings.Server; import com.inteligr8.alfresco.activiti.ApsClientJerseyConfiguration; import com.inteligr8.alfresco.activiti.ApsClientJerseyImpl; import com.inteligr8.alfresco.activiti.ApsPublicRestApiJerseyImpl; import com.inteligr8.alfresco.activiti.model.Tenant; /** * This class adds APS addressbility to extending goals. Loading Loading @@ -129,4 +132,19 @@ public abstract class ApsAddressibleGoal extends DisablableGoal { return this.api; } /** * This method makes the appropriate service calls to find the first APS * tenant ID from the configured APS service. * * This method does not cache the result. * * @return An APS tenant ID; null only if there are no tenants. */ protected Long findTenantId() { List<Tenant> tenants = this.getApsApi().getAdminApi().getTenants(); if (tenants == null || tenants.isEmpty()) return null; return tenants.iterator().next().getId(); } }
src/main/java/com/inteligr8/maven/aps/modeling/goal/ApsAppAccessibleGoal.java→src/main/java/com/inteligr8/maven/aps/modeling/goal/ApsAppAddressibleGoal.java +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ import com.inteligr8.alfresco.activiti.model.Tenant; * * @author brian@inteligr8.com */ public abstract class ApsAppAccessibleGoal extends ApsAddressibleGoal { public abstract class ApsAppAddressibleGoal extends ApsAddressibleGoal { @Parameter( property = "aps-model.appName", required = true ) protected String apsAppName; Loading