@Test public void shouldGetCustomPropsFromKeyValues() { List<StockCardEntryKV> keyValues = new ArrayList<>(); keyValues.add(new StockCardEntryKV("testkey1", "testvalue1", new Date())); keyValues.add(new StockCardEntryKV("testkey2", "testvalue2", new Date())); StockCardEntry entry = new StockCardEntry(new StockCard(), StockCardEntryType.ADJUSTMENT, 1L, null, null); entry.setKeyValues(keyValues); Map<String, String> customProps = entry.getCustomProps(); assertEquals(customProps.get("testkey1"), "testvalue1"); assertEquals(customProps.get("testkey2"), "testvalue2"); }
public Map<String, String> getCustomProps() { Map<String, String> customProps = new HashMap<>(); for (StockCardEntryKV item : keyValues) { customProps.put(item.getKeyColumn(), item.getValueColumn()); } return customProps.isEmpty() ? null : customProps; }
StockCardEntry extends BaseModel { public Map<String, String> getCustomProps() { Map<String, String> customProps = new HashMap<>(); for (StockCardEntryKV item : keyValues) { customProps.put(item.getKeyColumn(), item.getValueColumn()); } return customProps.isEmpty() ? null : customProps; } }
StockCardEntry extends BaseModel { public Map<String, String> getCustomProps() { Map<String, String> customProps = new HashMap<>(); for (StockCardEntryKV item : keyValues) { customProps.put(item.getKeyColumn(), item.getValueColumn()); } return customProps.isEmpty() ? null : customProps; } StockCardEntry(StockCard card, StockCardEntryType type, long quantity, Date occurred, String referenceNumber); }
StockCardEntry extends BaseModel { public Map<String, String> getCustomProps() { Map<String, String> customProps = new HashMap<>(); for (StockCardEntryKV item : keyValues) { customProps.put(item.getKeyColumn(), item.getValueColumn()); } return customProps.isEmpty() ? null : customProps; } StockCardEntry(StockCard card, StockCardEntryType type, long quantity, Date occurred, String referenceNumber); @JsonIgnore final boolean isValid(); @JsonIgnore final boolean isValidAdjustment(); Map<String, String> getCustomProps(); void addKeyValue(String key, String value); }
StockCardEntry extends BaseModel { public Map<String, String> getCustomProps() { Map<String, String> customProps = new HashMap<>(); for (StockCardEntryKV item : keyValues) { customProps.put(item.getKeyColumn(), item.getValueColumn()); } return customProps.isEmpty() ? null : customProps; } StockCardEntry(StockCard card, StockCardEntryType type, long quantity, Date occurred, String referenceNumber); @JsonIgnore final boolean isValid(); @JsonIgnore final boolean isValidAdjustment(); Map<String, String> getCustomProps(); void addKeyValue(String key, String value);  }