<artifactId>org.argeo.suite.workbench.rap</artifactId>
<version>0.1.13-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>org.argeo.connect</groupId>
- <artifactId>org.argeo.theme.argeo2</artifactId>
- <version>2.1.79-SNAPSHOT</version>
- </dependency>
<dependency>
<groupId>org.argeo.suite</groupId>
<artifactId>org.argeo.suite.web</artifactId>
<artifactId>org.argeo.connect.platform</artifactId>
<version>${version.argeo-connect}</version>
</dependency>
+
+ <!-- Argeo TP Extras -->
+ <dependency>
+ <groupId>org.argeo.tp.payment</groupId>
+ <artifactId>com.stripe</artifactId>
+ </dependency>
+
</dependencies>
<profiles>
<profile>
--- /dev/null
+package org.argeo.suite.workbench.commands;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.argeo.connect.ConnectException;
+import org.argeo.eclipse.ui.EclipseUiUtils;
+
+import jxl.Cell;
+import jxl.CellType;
+import jxl.JXLException;
+import jxl.Sheet;
+import jxl.Workbook;
+import jxl.WorkbookSettings;
+
+/** Centralise useful methods to simplify development with JXL library */
+class JxlUtils {
+
+ public static boolean isEmptyCell(Sheet sheet, int x, int y) {
+ Cell cell = sheet.getCell(x, y);
+ CellType type = cell.getType();
+ return type == CellType.EMPTY;
+ }
+
+ public static String getStringValue(Sheet sheet, int x, int y) {
+ Cell cell = sheet.getCell(x, y);
+ CellType type = cell.getType();
+ String stringValue = null;
+ if (type == CellType.LABEL || type == CellType.NUMBER)
+ stringValue = cell.getContents();
+ return stringValue;
+ }
+
+ public static String getCompulsoryStringValue(Sheet sheet, int x, int y) {
+ Cell cell = sheet.getCell(x, y);
+ CellType type = cell.getType();
+ String stringValue = null;
+ if (type == CellType.LABEL)
+ stringValue = cell.getContents();
+ else if (type == CellType.NUMBER)
+ stringValue = cell.getContents();
+ if (EclipseUiUtils.isEmpty(stringValue))
+ throw new ConnectException("No name defined at [" + x + "," + y + "], cannot parse indicator file");
+ return stringValue;
+ }
+
+ public static Double getNumberValue(Sheet sheet, int x, int y) {
+ Cell cell = sheet.getCell(x, y);
+ CellType type = cell.getType();
+ if (type == CellType.NUMBER)
+ return new Double(cell.getContents());
+ else if (type == CellType.EMPTY)
+ return null;
+ else
+ throw new ConnectException("Not a number at [" + x + "," + y + "]: " + type.toString());
+ }
+
+ public static Sheet getOnlySheet(InputStream in, String encoding) throws IOException {
+ Workbook wkb = toWorkbook(in, encoding);
+ Sheet sheet = wkb.getSheet(0);
+ return sheet;
+ }
+
+ public static Sheet getSheet(InputStream in, String encoding, int index) throws IOException {
+ Workbook wkb = toWorkbook(in, encoding);
+ return wkb.getSheet(index);
+ }
+
+ public static Workbook toWorkbook(InputStream in, String encoding) throws IOException {
+ try {
+ WorkbookSettings ws = new WorkbookSettings();
+ ws.setEncoding(encoding);
+ return Workbook.getWorkbook(in, ws);
+ } catch (JXLException e) {
+ throw new ConnectException("Unable to open XLS file", e);
+ }
+ }
+
+ // Prevents instantiation
+ private JxlUtils() {
+ }
+}
<modules>
<module>org.argeo.suite.web</module>
<module>org.argeo.suite.workbench.rap</module>
-<!-- <module>org.argeo.suite.theme.argeo2</module> -->
+ <!-- <module>org.argeo.suite.theme.argeo2</module> -->
<module>org.argeo.suite.apps</module>
<module>org.argeo.suite.apps.web</module>
<module>dep</module>
<role>QA</role>
</roles>
</developer>
- <developer>
- <id>bsinou</id>
- <name>Bruno Sinou</name>
- <email><![CDATA[http://www.google.com/recaptcha/mailhide/d?k=01SZoYvDnJzcw0KOR7M7u6Qg==&c=SVgEjXA_Uu9ZrNzLES92w1ght6puLFiVpoNUddCfSU8=]]></email>
- <organization>Argeo</organization>
- <organizationUrl>http://www.argeo.org</organizationUrl>
- <roles>
- <role>architect</role>
- <role>developer</role>
- <role>QA</role>
- </roles>
- </developer>
</developers>
<build>
<plugins>
</plugin>
</plugins>
</build>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.argeo.tp.extras</groupId>
+ <artifactId>argeo-tp-extras</artifactId>
+ <version>${version.argeo-tp-extras}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
<dependencies>
<!-- RAP workbench -->
<dependency>