import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.argeo.server.ArgeoServerException;
+import org.argeo.ArgeoException;
import org.argeo.server.dao.AbstractTabularDaoSupport;
import org.argeo.server.dao.LightDaoSupport;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContextAware;
-import org.springframework.core.io.Resource;
import org.springframework.util.StringUtils;
public class JxlDaoSupport extends AbstractTabularDaoSupport implements
loadSheet(sheet, references);
}
} catch (Exception e) {
- throw new ArgeoServerException("Cannot load workbook", e);
+ throw new ArgeoException("Cannot load workbook", e);
}
}
if (keyProperty == null)
keyProperty = fieldName;
if (!espSt.hasMoreTokens())
- throw new ArgeoServerException("Badly formatted sheetname "
+ throw new ArgeoException("Badly formatted sheetname "
+ sheetName);
String fieldValue = espSt.nextToken();
bw.setPropertyValue(fieldName, fieldValue);
for (int col = 1; col < currentRow.length; col++) {
subKeys.add(getCellValue(currentRow[col]));
}
+ if (log.isTraceEnabled())
+ log.trace(" subKeys=" + subKeys);
row++;
String firstColContents = firstColumn[row].getContents();
mapRows: for (; row < firstColumn.length; row++) {
Object key = firstColContents;
Map<Object, Object> subMap = new HashMap<Object, Object>();
- for (int col = 0; col < currentRow.length
- && col < subKeys.size(); col++) {
- Object subKey = subKeys.get(col);
+ for (int col = 1; col < currentRow.length
+ && col < subKeys.size() + 1; col++) {
+ Object subKey = subKeys.get(col - 1);
Cell cell = currentRow[col];
if (log.isTraceEnabled())
log.trace(" row=" + row
if (bw.isWritableProperty(firstColContents)
|| firstColContents.trim().equals("")
|| row == firstColumn.length - 1) {
+ log.trace(map);
bw.setPropertyValue(propertyName, map);
if (log.isTraceEnabled())
log.trace(" set map " + propertyName
String formula = ((FormulaCell) cell).getFormula();
int index = formula.indexOf('!');
if (index < 0)
- throw new ArgeoServerException("Cannot interpret formula "
+ throw new ArgeoException("Cannot interpret formula "
+ formula);
;
String targetSheet = formula.substring(0, index);
return false;
}
- /**
- * @deprecated use
- * {@link #overrideCell(Cell, BeanWrapper, String, String, Integer, List)}
- * instead. This method is not called anymore.
- */
- protected Boolean overrideCell(Cell cell, BeanWrapper bw,
- String propertyName, String keyProperty, Integer row,
- List<Reference> references, Map<String, List<Object>> tempRefs) {
- throw new UnsupportedOperationException();
- }
-
public void setEncoding(String encoding) {
this.encoding = encoding;
}
this.locale = locale;
}
- /** @deprecated use {@link #setResources(List)} instead. */
- public void setWorkbooks(List<Resource> workbooks) {
- setResources(workbooks);
- log.warn("###\n" + "### Use of the 'workbooks' property is deprecated!"
- + " It will be removed in one of the next releases."
- + " Use the 'resources' property instead." + "\n###");
- }
}