Created
March 21, 2013 21:09
-
-
Save phillipuniverse/5216769 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public DynamicResultSet inspect(PersistencePackage persistencePackage, DynamicEntityDao dynamicEntityDao, InspectHelper inspectHelper) throws ServiceException { | |
try { | |
PersistencePerspective persistencePerspective = persistencePackage.getPersistencePerspective(); | |
Map<MergedPropertyType, Map<String, FieldMetadata>> allMergedProperties = new HashMap<MergedPropertyType, Map<String, FieldMetadata>>(); | |
//Grab the default properties for the Sku | |
Map<String, FieldMetadata> properties = inspectHelper.getSimpleMergedProperties(PaymentResponseItem.class.getName(), persistencePerspective); | |
//Create the metadata for the collection | |
MapMetadata md = new MapMetadata(); | |
md.setFriendlyName("Additional Fields"); | |
md.setFieldName("additionalFields"); | |
md.setMutable(false); | |
md.setKeyPropertyFriendlyName("Name"); | |
md.setTargetClass(PaymentResponseItemImpl.class.getName()); | |
md.setValuePropertyFriendlyName("Value"); | |
md.setAvailableToTypes(new String[]{PaymentResponseItemImpl.class.getName()}); | |
md.setDataSourceName("additionalFields"); | |
md.setFieldName("additionalFields"); | |
md.setOwningClass(PaymentResponseItemImpl.class.getName()); | |
properties.put("additionalFields", md); | |
properties.remove("transactionSuccess"); | |
allMergedProperties.put(MergedPropertyType.PRIMARY, properties); | |
Class<?>[] entityClasses = dynamicEntityDao.getAllPolymorphicEntitiesFromCeiling(PaymentResponseItem.class); | |
ClassMetadata mergedMetadata = inspectHelper.getMergedClassMetadata(entityClasses, allMergedProperties); | |
DynamicResultSet results = new DynamicResultSet(mergedMetadata, null, null); | |
return results; | |
} catch (Exception e) { | |
ServiceException ex = new ServiceException("Unable to retrieve inspection results for " + | |
persistencePackage.getCeilingEntityFullyQualifiedClassname(), e); | |
throw ex; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment