@Test public void testReduceCompoundKey_CompoutKeyMultiValue() { Map<String, Object> multiKeyMap = new HashMap<String, Object>(); multiKeyMap.put("myAwesomeId", 123456L); multiKeyMap.put("myOtherAwesomeId", "abcdefg"); CompoundKey multiKey = new CompoundKey(multiKeyMap); assertEquals(multiKey, service.reduceCompoundKey(multiKey)); }
protected Object reduceCompoundKey(Object id) { if (id instanceof CompoundKey) { CompoundKey compoundKey = (CompoundKey)id; if (compoundKey.getKeys().size() == 1) { id = compoundKey.getKeys().values().iterator().next(); } } return id; }
ProviderBasedDataObjectService implements DataObjectService { protected Object reduceCompoundKey(Object id) { if (id instanceof CompoundKey) { CompoundKey compoundKey = (CompoundKey)id; if (compoundKey.getKeys().size() == 1) { id = compoundKey.getKeys().values().iterator().next(); } } return id; } }
ProviderBasedDataObjectService implements DataObjectService { protected Object reduceCompoundKey(Object id) { if (id instanceof CompoundKey) { CompoundKey compoundKey = (CompoundKey)id; if (compoundKey.getKeys().size() == 1) { id = compoundKey.getKeys().values().iterator().next(); } } return id; }  }
ProviderBasedDataObjectService implements DataObjectService { protected Object reduceCompoundKey(Object id) { if (id instanceof CompoundKey) { CompoundKey compoundKey = (CompoundKey)id; if (compoundKey.getKeys().size() == 1) { id = compoundKey.getKeys().values().iterator().next(); } } return id; }  @Override T find(Class<T> type, Object id); @Override QueryResults<T> findMatching(Class<T> type, QueryByCriteria queryByCriteria); @Override QueryResults<T> findAll(Class<T> type); @Override T findUnique(Class<T> type, QueryByCriteria queryByCriteria); @Override void delete(Object dataObject); @Override void deleteMatching(Class<T> type, QueryByCriteria queryByCriteria); @Override void deleteAll(Class<T> type); @Override T save(T dataObject, PersistenceOption... options); @Override MetadataRepository getMetadataRepository(); @Override T copyInstance(T dataObject, CopyOption... options); @Override DataObjectWrapper<T> wrap(T dataObject); @Override boolean supports(Class<T> type); @Override void flush(Class<?> type); @Required void setProviderRegistry(ProviderRegistry providerRegistry); @Required void setMetadataRepository(MetadataRepository metadataRepository); ReferenceLinker getReferenceLinker(); @Required void setReferenceLinker(ReferenceLinker referenceLinker); }
ProviderBasedDataObjectService implements DataObjectService { protected Object reduceCompoundKey(Object id) { if (id instanceof CompoundKey) { CompoundKey compoundKey = (CompoundKey)id; if (compoundKey.getKeys().size() == 1) { id = compoundKey.getKeys().values().iterator().next(); } } return id; }  @Override T find(Class<T> type, Object id); @Override QueryResults<T> findMatching(Class<T> type, QueryByCriteria queryByCriteria); @Override QueryResults<T> findAll(Class<T> type); @Override T findUnique(Class<T> type, QueryByCriteria queryByCriteria); @Override void delete(Object dataObject); @Override void deleteMatching(Class<T> type, QueryByCriteria queryByCriteria); @Override void deleteAll(Class<T> type); @Override T save(T dataObject, PersistenceOption... options); @Override MetadataRepository getMetadataRepository(); @Override T copyInstance(T dataObject, CopyOption... options); @Override DataObjectWrapper<T> wrap(T dataObject); @Override boolean supports(Class<T> type); @Override void flush(Class<?> type); @Required void setProviderRegistry(ProviderRegistry providerRegistry); @Required void setMetadataRepository(MetadataRepository metadataRepository); ReferenceLinker getReferenceLinker(); @Required void setReferenceLinker(ReferenceLinker referenceLinker);  }