Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Pds4ProductFactory.createDataFiles() #294

Merged
merged 1 commit into from
Mar 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

/**
* Creates Pds4Product object from opensearch key-value field map.
*
*
* @author karpenko
*/
public class Pds4ProductFactory {
Expand Down Expand Up @@ -46,7 +46,7 @@ public class Pds4ProductFactory {

/**
* Create Pds4Product object from opensearch key-value field map.
*
*
* @param lidvid product LIDVID
* @param fieldMap key-value field map
* @return new Pds4Product object
Expand Down Expand Up @@ -137,20 +137,24 @@ private static Pds4MetadataOpsLabelFileInfo createLabelFile(Map<String, Object>

@SuppressWarnings("rawtypes")
private static List<Pds4MetadataOpsDataFile> createDataFiles(Map<String, Object> fieldMap) {
List<Pds4MetadataOpsDataFile> items = new ArrayList<Pds4MetadataOpsDataFile>();
ArrayList<String> vals = (ArrayList<String>) fieldMap.get(FLD_DATA_FILE_NAME);
Pds4MetadataOpsDataFile item = new Pds4MetadataOpsDataFile();
if (vals == null) {
return new ArrayList<Pds4MetadataOpsDataFile>();
}

List<Pds4MetadataOpsDataFile> items = new ArrayList<Pds4MetadataOpsDataFile>();

for (int i = 0; i < ((List) vals).size(); i++) {
Pds4MetadataOpsDataFile item = new Pds4MetadataOpsDataFile();
item.setOpsColonFileName((String) ((List) fieldMap.get(FLD_DATA_FILE_CREATION)).get(i));
item.setOpsColonCreationDate((String) ((List) fieldMap.get(FLD_DATA_FILE_CREATION)).get(i));
item.opsColonFileRef((String) ((List) fieldMap.get(FLD_DATA_FILE_REF)).get(i));
item.setOpsColonFileSize((String) ((List) fieldMap.get(FLD_DATA_FILE_SIZE)).get(i));
item.setOpsColonMd5Checksum((String) ((List) fieldMap.get(FLD_DATA_FILE_MD5)).get(i));
item.setOpsColonMimeType((String) ((List) fieldMap.get(FLD_DATA_FILE_MIME_TYPE)).get(i));
items.add(item);
item = new Pds4MetadataOpsDataFile();
}

return items;
}

Expand Down