diff --git a/pom.xml b/pom.xml
index bfbb77a..35d38ff 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
Analytics Cloud Datatset Utils
datasetutils
jar
- 32.0.18-SNAPSHOT
+ 32.0.19-SNAPSHOT
https://github.com/forcedotcom/Analytics-Cloud-Dataset-Utils
salesforce.com
diff --git a/src/main/java/com/sforce/dataset/loader/EbinFormatWriter.java b/src/main/java/com/sforce/dataset/loader/EbinFormatWriter.java
index c09b857..fb7ab65 100644
--- a/src/main/java/com/sforce/dataset/loader/EbinFormatWriter.java
+++ b/src/main/java/com/sforce/dataset/loader/EbinFormatWriter.java
@@ -187,6 +187,12 @@ public void addrow(String[] values) throws IOException,NumberFormatException, P
while(key_value_count<_dataTypes.size())
{
+// System.err.println("Count: " + count + " ; key_value_count: " + key_value_count );
+// System.err.println(_dataTypes.get(key_value_count).getName() + ":" + _dataTypes.get(key_value_count).getType() + " = " + values[count]);
+// System.err.println();
+
+ if(_dataTypes.get(key_value_count).isComputedField)
+
if(_dataTypes.get(key_value_count).isSkipped)
{
key_value_count++;
@@ -268,7 +274,7 @@ public void addrow(String[] values) throws IOException,NumberFormatException, P
{
//The date is null we don't add null dims
// dim_values.add("");
- dim_keys.add(_dataTypes.get(key_value_count).getName());
+// dim_keys.add(_dataTypes.get(key_value_count).getName());
curr.put(_dataTypes.get(key_value_count).getName(), null);
key_value_count++;
@@ -392,6 +398,7 @@ public void addrow(String[] values) throws IOException,NumberFormatException, P
long sec_epoch = dt.getTime()/(1000);
long day_epoch = dt.getTime()/(1000*60*60*24);
+
measure_values.add(sec_epoch);
curr.put(_dataTypes.get(key_value_count).getName(), sec_epoch);
key_value_count++;
@@ -414,6 +421,7 @@ public void addrow(String[] values) throws IOException,NumberFormatException, P
dim_values.add(Integer.toString(year));
dim_keys.add(_dataTypes.get(key_value_count).getName());
curr.put(_dataTypes.get(key_value_count).getName(), year);
+// System.out.println(_dataTypes.get(key_value_count).getName() + ": "+columnValue + " - "+ year);
key_value_count++;
dim_values.add(Integer.toString(quarter));
@@ -509,9 +517,9 @@ public void addrow(String[] values) throws IOException,NumberFormatException, P
dim_values.add(columnValue.toString());
dim_keys.add(_dataTypes.get(key_value_count).getName());
}
- curr.put(_dataTypes.get(key_value_count).getName(), columnValue.toString());
- key_value_count++;
}
+ curr.put(_dataTypes.get(key_value_count).getName(), columnValue);
+ key_value_count++;
}
count++;
}
@@ -566,6 +574,8 @@ protected void vInt(long i) throws IOException
protected void dict(LinkedList dim_keys, LinkedList dim_values) throws IOException
{
+// System.out.println(dim_keys);
+// System.out.println(dim_values);
int dlen = dim_values.size();
vInt(dlen);
for (int i = 0; i < dlen; i++) {
diff --git a/src/main/java/com/sforce/dataset/loader/file/schema/FieldType.java b/src/main/java/com/sforce/dataset/loader/file/schema/FieldType.java
index 65f95d3..e6debab 100644
--- a/src/main/java/com/sforce/dataset/loader/file/schema/FieldType.java
+++ b/src/main/java/com/sforce/dataset/loader/file/schema/FieldType.java
@@ -26,24 +26,109 @@
package com.sforce.dataset.loader.file.schema;
+
public class FieldType {
- public String name = null; //Required
- public String fullyQualifiedName = null; //Required
- public String label = null; //Required
- public String description = null; //Optional
- public String type = null; //Required - Text, Numeric, Date
- public int precision = 0; //Required if type is Numeric, the number 256.99 has a precision of 5
- public int scale = 0; //Required if type is Numeric, the number 256.99 has a scale of 2
- public String decimalSeparator = ".";
- public String defaultValue = null; //required for numeric types
- public String format = null; //Required if type is Date
+ protected String name = null; //Required
+ protected String fullyQualifiedName = null; //Required
+ protected String label = null; //Required
+ protected String description = null; //Optional
+ protected String type = null; //Required - Text, Numeric, Date
+ protected int precision = 0; //Required if type is Numeric, the number 256.99 has a precision of 5
+ protected int scale = 0; //Required if type is Numeric, the number 256.99 has a scale of 2
+ protected String decimalSeparator = ".";
+ protected String defaultValue = null; //required for numeric types
+ protected String format = null; //Required if type is Date
public boolean isSystemField = false; //Optional
public boolean isUniqueId = false; //Optional
public boolean isMultiValue = false; //Optional
- public String multiValueSeparator = null; //Optional - only used if IsMultiValue = true separator
- public int fiscalMonthOffset = 0;
- public int firstDayOfWeek = -1; //1=SUNDAY, 2=MONDAY etc.. -1 the week starts on 1st day of year and is always 7 days long
- public boolean isYearEndFiscalYear = true; //Optional
- public boolean canTruncateValue = true; //Optional
- public boolean isSkipped = false; //Optional
+ protected String multiValueSeparator = null; //Optional - only used if IsMultiValue = true separator
+ protected int fiscalMonthOffset = 0; //The month in which the fiscal quarter starts
+ protected int firstDayOfWeek = -1; //1=SUNDAY, 2=MONDAY etc.. -1 the week starts on 1st day of year and is always 7 days long
+ public boolean isYearEndFiscalYear = true; //Optional
+ public boolean canTruncateValue = true; //Optional
+ public boolean isSkipped = false; //Optional
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getFullyQualifiedName() {
+ return fullyQualifiedName;
+ }
+ public void setFullyQualifiedName(String fullyQualifiedName) {
+ this.fullyQualifiedName = fullyQualifiedName;
+ }
+ public String getLabel() {
+ return label;
+ }
+ public void setLabel(String label) {
+ this.label = label;
+ }
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public String getType() {
+ return type;
+ }
+ public void setType(String type) {
+ this.type = type;
+ }
+ public int getPrecision() {
+ return precision;
+ }
+ public void setPrecision(int precision) {
+ this.precision = precision;
+ }
+ public int getScale() {
+ return scale;
+ }
+ public void setScale(int scale) {
+ this.scale = scale;
+ }
+ public String getDecimalSeparator() {
+ return decimalSeparator;
+ }
+ public void setDecimalSeparator(String decimalSeparator) {
+ this.decimalSeparator = decimalSeparator;
+ }
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+ public void setDefaultValue(String defaultValue) {
+ if(defaultValue!=null && !defaultValue.isEmpty())
+ {
+ this.defaultValue = defaultValue;
+ }
+ }
+ public String getFormat() {
+ return format;
+ }
+ public void setFormat(String format) {
+ this.format = format;
+ }
+ public String getMultiValueSeparator() {
+ return multiValueSeparator;
+ }
+ public void setMultiValueSeparator(String multiValueSeparator) {
+ this.multiValueSeparator = multiValueSeparator;
+ }
+ public int getFiscalMonthOffset() {
+ return fiscalMonthOffset;
+ }
+ public void setFiscalMonthOffset(int fiscalMonthOffset) {
+ this.fiscalMonthOffset = fiscalMonthOffset;
+ }
+ public int getFirstDayOfWeek() {
+ return firstDayOfWeek;
+ }
+ public void setFirstDayOfWeek(int firstDayOfWeek) {
+ this.firstDayOfWeek = firstDayOfWeek;
+ }
+
+
}
diff --git a/src/main/java/com/sforce/dataset/loader/file/schema/ext/FieldType.java b/src/main/java/com/sforce/dataset/loader/file/schema/ext/FieldType.java
index 37e0a44..49d88dc 100644
--- a/src/main/java/com/sforce/dataset/loader/file/schema/ext/FieldType.java
+++ b/src/main/java/com/sforce/dataset/loader/file/schema/ext/FieldType.java
@@ -350,22 +350,25 @@ public void setMultiValueSeparator(String multiValueSeparator) {
}
public String getDefaultValue() {
- return defaultValue;
+ if(defaultValue!=null && !defaultValue.isEmpty())
+ return defaultValue;
+ return null;
}
- public void setDefaultValue(String defaultValue) {
- if(this.type != null && this.type.equals(FieldType.DATE_TYPE) && getCompiledDateFormat() != null)
+ public void setDefaultValue(String defaultValue)
+ {
+ if(defaultValue!=null && !defaultValue.isEmpty())
{
- if(defaultValue!=null && !defaultValue.isEmpty())
+ if(this.type != null && this.type.equals(FieldType.DATE_TYPE) && getCompiledDateFormat() != null)
{
- try {
- this.defaultDate = getCompiledDateFormat().parse(defaultValue);
- } catch (ParseException e) {
- throw new IllegalArgumentException(e.toString());
- }
+ try {
+ this.defaultDate = getCompiledDateFormat().parse(defaultValue);
+ } catch (ParseException e) {
+ throw new IllegalArgumentException(e.toString());
+ }
}
+ this.defaultValue = defaultValue;
}
- this.defaultValue = defaultValue;
}
public String getFullyQualifiedName() {
diff --git a/src/main/java/com/sforce/dataset/server/CsvUploadWorker.java b/src/main/java/com/sforce/dataset/server/CsvUploadWorker.java
index b189f35..181e8ad 100644
--- a/src/main/java/com/sforce/dataset/server/CsvUploadWorker.java
+++ b/src/main/java/com/sforce/dataset/server/CsvUploadWorker.java
@@ -216,12 +216,13 @@ public static void moveInputFile(File inputFile, boolean isSuccess, Session sess
return;
// File parent = inputFile.getAbsoluteFile().getParentFile();
-
+
File directory = DatasetUtilConstants.getSuccessDir(session.getOrgId());
if(!isSuccess)
directory = DatasetUtilConstants.getErrorDir(session.getOrgId());
- File doneFile = new File(directory, FilenameUtils.getBaseName(inputFile.getName())+"_"+session.getId()+"."+FilenameUtils.getExtension(inputFile.getName()));
+// File doneFile = new File(directory, FilenameUtils.getBaseName(inputFile.getName())+"_"+session.getId()+"."+FilenameUtils.getExtension(inputFile.getName()));
+ File doneFile = new File(directory, inputFile.getName());
try {
FileUtils.moveFile(inputFile, doneFile);
} catch (IOException e) {
@@ -230,7 +231,8 @@ public static void moveInputFile(File inputFile, boolean isSuccess, Session sess
File sortedtFile = new File(inputFile.getParent(), FilenameUtils.getBaseName(inputFile.getName())+ "_sorted." + FilenameUtils.getExtension(inputFile.getName()));
if(sortedtFile.exists())
{
- File sortedDoneFile = new File(directory,FilenameUtils.getBaseName(sortedtFile.getName())+"_"+session.getId()+"."+FilenameUtils.getExtension(sortedtFile.getName()));
+// File sortedDoneFile = new File(directory,FilenameUtils.getBaseName(sortedtFile.getName())+"_"+session.getId()+"."+FilenameUtils.getExtension(sortedtFile.getName()));
+ File sortedDoneFile = new File(directory,sortedtFile.getName());
try {
FileUtils.moveFile(sortedtFile, sortedDoneFile);
} catch (IOException e) {
diff --git a/src/main/java/com/sforce/dataset/server/MultipartRequestHandler.java b/src/main/java/com/sforce/dataset/server/MultipartRequestHandler.java
index d94fe0b..472e817 100644
--- a/src/main/java/com/sforce/dataset/server/MultipartRequestHandler.java
+++ b/src/main/java/com/sforce/dataset/server/MultipartRequestHandler.java
@@ -127,7 +127,7 @@ public static List uploadByApacheFileUpload(List it
fm.setInputCsv(inputCsv);
fm.setInputJson(inputJson);
// File outFile = new File(parent,fm.getInputFileName());
- File outFile = new File(parent,session.getId()+".csv");
+ File outFile = new File(parent,datasetName+"_"+session.getId()+".csv");
if(fm.getInputFileName().equalsIgnoreCase(inputJson))
{
ExternalFileSchema schema = ExternalFileSchema.load(fm.inputFileStream, Charset.forName("UTF-8"), System.out);