Skip to content

Commit

Permalink
Added support for new fiscal date parts
Browse files Browse the repository at this point in the history
date now includes hour/minutes/seconds and fiscal parts
  • Loading branch information
datasetutil committed Apr 15, 2015
1 parent e01ce88 commit fe2a7b7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/sforce/dataset/DatasetUtilConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class DatasetUtilConstants {

public static final int DEFAULT_BUFFER_SIZE = 8*1024*1024;

public static boolean createNewDateParts = false;
// public static boolean createNewDateParts = false;

public static final String defaultEndpoint = "https://login.salesforce.com/services/Soap/u/32.0";
public static final String defaultTestEndpoint = "https://test.salesforce.com/services/Soap/u/32.0";
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/sforce/dataset/DatasetUtilMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@ else if(args[i-1].equalsIgnoreCase("--rootObject"))
{
params.rootObject = args[i];
}
else if(args[i-1].equalsIgnoreCase("--createNewDateParts"))
{
if(args[i]!=null && args[i].trim().equalsIgnoreCase("true"))
DatasetUtilConstants.createNewDateParts = true;
}
// else if(args[i-1].equalsIgnoreCase("--createNewDateParts"))
// {
// if(args[i]!=null && args[i].trim().equalsIgnoreCase("true"))
// DatasetUtilConstants.createNewDateParts = true;
// }
else if(args[i-1].equalsIgnoreCase("--fileEncoding"))
{
params.fileEncoding = args[i];
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/sforce/dataset/loader/DatasetLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ public static boolean uploadDataset(String inputFileString,
// }

ExternalFileSchema altSchema = schema;
if(DatasetUtilConstants.createNewDateParts)
altSchema = ExternalFileSchema.getSchemaWithNewDateParts(schema);
// if(DatasetUtilConstants.createNewDateParts)
// altSchema = ExternalFileSchema.getSchemaWithNewDateParts(schema);

String hdrId = getLastIncompleteFileHdr(partnerConnection, datasetAlias, logger);
if(hdrId!=null)
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/com/sforce/dataset/loader/EbinFormatWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ public EbinFormatWriter(OutputStream out, FieldType[] dataTypes,PrintStream logg
_dataTypes.add(FieldType.GetStringKeyDataType(dataType.getName() + "_Quarter", null, null));
_dataTypes.add(FieldType.GetStringKeyDataType(dataType.getName() + "_Week", null, null));

if(DatasetUtilConstants.createNewDateParts)
{
// if(DatasetUtilConstants.createNewDateParts)
// {
_dataTypes.add(FieldType.GetStringKeyDataType(dataType.getName() + "_Hour", null, null));
_dataTypes.add(FieldType.GetStringKeyDataType(dataType.getName() + "_Minute", null, null));
_dataTypes.add(FieldType.GetStringKeyDataType(dataType.getName() + "_Second", null, null));
Expand All @@ -143,7 +143,7 @@ public EbinFormatWriter(OutputStream out, FieldType[] dataTypes,PrintStream logg
_dataTypes.add(FieldType.GetStringKeyDataType(dataType.getName() + "_Quarter_Fiscal", null, null));
_dataTypes.add(FieldType.GetStringKeyDataType(dataType.getName() + "_Week_Fiscal", null, null));
}
}
// }
}
}

Expand Down Expand Up @@ -323,8 +323,8 @@ public void addrow(String[] values) throws IOException,NumberFormatException, P
key_value_count++;

//This check is temporary remove when schema supports these new data parts
if(DatasetUtilConstants.createNewDateParts)
{
// if(DatasetUtilConstants.createNewDateParts)
// {
//dim_values.add(Integer.toString(hour));
//dim_keys.add(_dataTypes.get(key_value_count).getName());
curr.put(_dataTypes.get(key_value_count).getName(), null);
Expand Down Expand Up @@ -362,7 +362,7 @@ public void addrow(String[] values) throws IOException,NumberFormatException, P
curr.put(_dataTypes.get(key_value_count).getName(), null);
key_value_count++;
}
}
// }
}else
{
Date dt = null;
Expand Down Expand Up @@ -444,8 +444,8 @@ public void addrow(String[] values) throws IOException,NumberFormatException, P
key_value_count++;

//This check is temporary remove when schema supports these new data parts
if(DatasetUtilConstants.createNewDateParts)
{
// if(DatasetUtilConstants.createNewDateParts)
// {
dim_values.add(df.format(hour));
dim_keys.add(_dataTypes.get(key_value_count).getName());
curr.put(_dataTypes.get(key_value_count).getName(), hour);
Expand Down Expand Up @@ -488,7 +488,7 @@ public void addrow(String[] values) throws IOException,NumberFormatException, P
curr.put(_dataTypes.get(key_value_count).getName(), fiscal_week);
key_value_count++;
}
}
// }

}

Expand Down

0 comments on commit fe2a7b7

Please sign in to comment.