Skip to content

Commit

Permalink
use DataObjectFactory for ibdo creation
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-mlb committed Sep 10, 2024
1 parent e402c8d commit 8fdbd6a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/main/java/emissary/core/IBaseDataObjectHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private IBaseDataObjectHelper() {}
public static IBaseDataObject clone(final IBaseDataObject iBaseDataObject, final boolean fullClone) {
Validate.notNull(iBaseDataObject, "Required: iBaseDataObject not null");

final BaseDataObject bdo = fullClone ? new InternalIdBaseDataObject(iBaseDataObject.getInternalId()) : new BaseDataObject();
final IBaseDataObject bdo = fullClone ? new InternalIdBaseDataObject(iBaseDataObject.getInternalId()) : DataObjectFactory.getInstance();

final SeekableByteChannelFactory sbcf = iBaseDataObject.getChannelFactory();
if (sbcf != null) {
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/emissary/core/IBaseDataObjectXmlCodecs.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ public final class IBaseDataObjectXmlCodecs {
*/
public static final Map<String, Object> PRIMITVE_NAME_DEFAULT_MAP = Collections
.unmodifiableMap(new ConcurrentHashMap<>(Stream.of(
new AbstractMap.SimpleEntry<>(BIRTH_ORDER, new BaseDataObject().getBirthOrder()),
new AbstractMap.SimpleEntry<>(BROKEN, new BaseDataObject().isBroken()),
new AbstractMap.SimpleEntry<>(NUM_CHILDREN, new BaseDataObject().getNumChildren()),
new AbstractMap.SimpleEntry<>(NUM_SIBLINGS, new BaseDataObject().getNumSiblings()),
new AbstractMap.SimpleEntry<>(OUTPUTABLE, new BaseDataObject().isOutputable()),
new AbstractMap.SimpleEntry<>(PRIORITY, new BaseDataObject().getPriority()))
new AbstractMap.SimpleEntry<>(BIRTH_ORDER, DataObjectFactory.getInstance().getBirthOrder()),
new AbstractMap.SimpleEntry<>(BROKEN, DataObjectFactory.getInstance().isBroken()),
new AbstractMap.SimpleEntry<>(NUM_CHILDREN, DataObjectFactory.getInstance().getNumChildren()),
new AbstractMap.SimpleEntry<>(NUM_SIBLINGS, DataObjectFactory.getInstance().getNumSiblings()),
new AbstractMap.SimpleEntry<>(OUTPUTABLE, DataObjectFactory.getInstance().isOutputable()),
new AbstractMap.SimpleEntry<>(PRIORITY, DataObjectFactory.getInstance().getPriority()))
.collect(Collectors.toMap(AbstractMap.SimpleEntry::getKey, AbstractMap.SimpleEntry::getValue))));
/**
* The XML namespace for "xml".
Expand Down Expand Up @@ -824,6 +824,6 @@ public static Element protectedElementSha256(final String name, final byte[] byt
*/
public static Method getIbdoMethod(final String methodName, final Class<?>... parameterTypes)
throws NoSuchMethodException {
return IBaseDataObject.class.getDeclaredMethod(methodName, parameterTypes);
return IBaseDataObject.class.getMethod(methodName, parameterTypes);
}
}
6 changes: 3 additions & 3 deletions src/main/java/emissary/core/IBaseDataObjectXmlHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private IBaseDataObjectXmlHelper() {}
*/
public static IBaseDataObject createStandardInitialIbdo(final IBaseDataObject ibdo, final SeekableByteChannelFactory sbcf,
final String classification, final String formAndFileType, final KffDataObjectHandler kff) {
final IBaseDataObject tempIbdo = new BaseDataObject();
final IBaseDataObject tempIbdo = DataObjectFactory.getInstance();

// We want to return the ibdo with the data field equal to null. This can only
// be accomplished if the data is never set. Therefore, we have to set the data
Expand Down Expand Up @@ -96,13 +96,13 @@ public static IBaseDataObject ibdoFromXml(final Document document, final List<IB

final Element root = document.getRootElement();
final Element answersElement = root.getChild(ANSWERS);
final IBaseDataObject parentIbdo = new BaseDataObject();
final IBaseDataObject parentIbdo = DataObjectFactory.getInstance();
final List<Element> answerChildren = answersElement.getChildren();

ibdoFromXmlMainElements(answersElement, parentIbdo, decoders);

for (final Element answerChild : answerChildren) {
final IBaseDataObject childIbdo = new BaseDataObject();
final IBaseDataObject childIbdo = DataObjectFactory.getInstance();
final String childName = answerChild.getName();

if (childName.startsWith(EXTRACTED_RECORD_ELEMENT_PREFIX)) {
Expand Down

0 comments on commit 8fdbd6a

Please sign in to comment.