Skip to content

Commit

Permalink
make variables final
Browse files Browse the repository at this point in the history
Signed-off-by: Joanne Wang <[email protected]>
  • Loading branch information
jowg-amazon committed Jul 3, 2024
1 parent 4b1d699 commit f511eea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,26 +152,10 @@ public void indexIocs(List<STIX2IOC> iocs) throws IOException {
if (saTifSourceConfig.getIocStoreConfig() instanceof DefaultIocStoreConfig) {
List<DefaultIocStoreConfig.IocToIndexDetails> listOfIocToIndexDetails =
((DefaultIocStoreConfig) saTifSourceConfig.getIocStoreConfig()).getIocToIndexDetails();

boolean containsType = false;
DefaultIocStoreConfig.IocToIndexDetails newIoctoIndexDetails = null;

for (DefaultIocStoreConfig.IocToIndexDetails iocToIndexDetails: listOfIocToIndexDetails) {
if (iocToIndexDetails.getIocType() == iocType) {
containsType = true;
newIoctoIndexDetails = iocToIndexDetails;
break;
}
}

if (containsType) {
newIoctoIndexDetails.setWriteIndex(writeIndex);
} else {
DefaultIocStoreConfig.IocToIndexDetails iocToIndexDetails =
new DefaultIocStoreConfig.IocToIndexDetails(iocType, iocIndexPattern, writeIndex);
listOfIocToIndexDetails.add(iocToIndexDetails);
}

listOfIocToIndexDetails.removeIf(iocToIndexDetails -> iocToIndexDetails.getIocType() == iocType);
DefaultIocStoreConfig.IocToIndexDetails iocToIndexDetails =
new DefaultIocStoreConfig.IocToIndexDetails(iocType, iocIndexPattern, writeIndex);
listOfIocToIndexDetails.add(iocToIndexDetails);
}
});
bulkIndexIocs(iocs, iocAlias);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ public static class IocToIndexDetails implements Writeable, ToXContent {
public static final String IOC_TYPE_FIELD = "ioc_type";
public static final String INDEX_PATTERN_FIELD = "index_pattern";
public static final String WRITE_INDEX_FIELD = "write_index";
IOCType iocType;
String indexPattern;
String writeIndex;
private final IOCType iocType;
private final String indexPattern;
private final String writeIndex;

public IocToIndexDetails(IOCType iocType, String indexPattern, String writeIndex) {
this.iocType = iocType;
Expand Down Expand Up @@ -161,24 +161,13 @@ public IOCType getIocType() {
return iocType;
}

public void setIocType(IOCType iocType) {
this.iocType = iocType;
}

public String getIndexPattern() {
return indexPattern;
}

public void setIndexPattern(String indexPattern) {
this.indexPattern = indexPattern;
}

public String getWriteIndex() {
return writeIndex;
}

public void setWriteIndex(String writeIndex) {
this.writeIndex = writeIndex;
}
}
}

0 comments on commit f511eea

Please sign in to comment.