Builder Fix
This commit is contained in:
parent
a6ef5d3547
commit
b23305d0fc
|
@ -31,13 +31,18 @@ public class FileSets {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RequestBuilder setFieldPath(String path){
|
public RequestBuilder setFieldDefinitionPath(String path){
|
||||||
theRequest.setDestinationPath(path);
|
theRequest.setFieldDefinitionPath(path);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RequestBuilder setFieldDescriptionPath(String path){
|
public RequestBuilder setParentPath(String path){
|
||||||
theRequest.setFieldPath(path);
|
theRequest.setParentPath(path);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RequestBuilder setFieldName(String fieldName){
|
||||||
|
theRequest.setFieldName(fieldName);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,12 +60,12 @@ public class FileSets {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static RequestBuilder build(String path) {
|
public static RequestBuilder build(String parent,String fieldName, String fieldDefinition) {
|
||||||
return new RequestBuilder().setFieldPath(path);
|
return new RequestBuilder().setParentPath(parent).setFieldDefinitionPath(fieldDefinition).setFieldName(fieldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RequestBuilder build(String path, TempFile...files) {
|
public static RequestBuilder build(String parent,String fieldName, String fieldDefinition, TempFile...files) {
|
||||||
return new RequestBuilder().setFieldPath(path).add(files);
|
return build(parent,fieldName,fieldDefinition).add(files);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TempFile asTemp(StorageUtils storage,InputStreamDescriptor descriptor) throws RemoteBackendException, FileNotFoundException {
|
public static TempFile asTemp(StorageUtils storage,InputStreamDescriptor descriptor) throws RemoteBackendException, FileNotFoundException {
|
||||||
|
@ -74,17 +79,19 @@ public class FileSets {
|
||||||
return toReturn.toArray(new TempFile[toReturn.size()]);
|
return toReturn.toArray(new TempFile[toReturn.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RegisterFileSetRequest prepareRequestFromFolder(StorageUtils storage, String path, File directory) throws FileNotFoundException {
|
public static RegisterFileSetRequest prepareRequestFromFolder(StorageUtils storage,
|
||||||
|
String parentPath,String fieldName,String fieldDefinition, File directory) throws FileNotFoundException {
|
||||||
|
|
||||||
File[] children =directory.listFiles();
|
File[] children =directory.listFiles();
|
||||||
InputStreamDescriptor[] iss=new InputStreamDescriptor[children.length];
|
InputStreamDescriptor[] iss=new InputStreamDescriptor[children.length];
|
||||||
return prepareRequest(storage,path,children);
|
return prepareRequest(storage,parentPath,fieldName,fieldDefinition,children);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RegisterFileSetRequest prepareRequest(StorageUtils storage, String path, File... toUpload) throws FileNotFoundException {
|
public static RegisterFileSetRequest prepareRequest(StorageUtils storage,
|
||||||
|
String parentPath,String fieldName,String fieldDefinition, File... toUpload) throws FileNotFoundException {
|
||||||
|
|
||||||
FileSets.RequestBuilder builder = FileSets.build(path);
|
FileSets.RequestBuilder builder = FileSets.build(parentPath,fieldName,fieldDefinition);
|
||||||
for (File f : toUpload) {
|
for (File f : toUpload) {
|
||||||
if(!f.isDirectory())
|
if(!f.isDirectory())
|
||||||
builder.add(FileSets.asTemp(storage, new InputStreamDescriptor(new FileInputStream(f), f.getName())));
|
builder.add(FileSets.asTemp(storage, new InputStreamDescriptor(new FileInputStream(f), f.getName())));
|
||||||
|
|
Loading…
Reference in New Issue