List of usage examples for java.io Serializable getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:org.unitime.timetable.security.evaluation.UniTimePermissionCheck.java
@Override public void checkPermission(UserContext user, Serializable targetId, String targetType, Right right) throws AccessDeniedException { if (user == null) throw new AccessDeniedException(MSG.noAuthentication(right == null ? "NULL" : right.toString())); if (user.getCurrentAuthority() == null) throw new AccessDeniedException(MSG.noAuthority(right == null ? "NULL" : right.toString())); if (right == null) throw new AccessDeniedException(MSG.noRight()); if (!user.getCurrentAuthority().hasRight(right)) throw new AccessDeniedException(MSG.missingRight(right.toString())); if (targetType == null && right.hasType()) targetType = right.type().getSimpleName(); if (targetType == null) return;//from w w w . j a v a 2 s . c o m if (targetId != null && targetId instanceof Collection) { for (Serializable id : (Collection<Serializable>) targetId) checkPermission(user, id, targetType, right); return; } if (targetId != null && targetId.getClass().isArray()) { for (Serializable id : (Serializable[]) targetId) checkPermission(user, id, targetType, right); return; } try { String className = targetType; if (className.indexOf('.') < 0) className = "org.unitime.timetable.model." + className; // Special cases if (targetId == null && Session.class.getName().equals(className)) targetId = user.getCurrentAcademicSessionId(); if (targetId == null && Department.class.getName().equals(className)) { AccessDeniedException firstDenial = null; for (Department d : Department.getUserDepartments(user)) { try { checkPermission(user, d, right); return; } catch (AccessDeniedException e) { if (firstDenial == null) firstDenial = e; } } if (firstDenial != null) throw firstDenial; throw new AccessDeniedException(MSG.noDepartment(right.toString())); } if (targetId == null && SubjectArea.class.getName().equals(className)) { AccessDeniedException firstDenial = null; for (SubjectArea sa : SubjectArea.getUserSubjectAreas(user)) { try { checkPermission(user, sa, right); return; } catch (AccessDeniedException e) { if (firstDenial == null) firstDenial = e; } } if (firstDenial != null) throw firstDenial; throw new AccessDeniedException(MSG.noSubject(right.toString())); } if (targetId == null && SolverGroup.class.getName().equals(className)) { AccessDeniedException firstDenial = null; for (SolverGroup g : SolverGroup.getUserSolverGroups(user)) { try { checkPermission(user, g, right); return; } catch (AccessDeniedException e) { if (firstDenial == null) firstDenial = e; } } if (firstDenial != null) throw firstDenial; throw new AccessDeniedException(MSG.noSolverGroup(right.toString())); } if (targetId == null) { throw new AccessDeniedException(MSG.noDomainObject(right.toString(), targetType)); } if (targetId instanceof Qualifiable) { Qualifiable q = (Qualifiable) targetId; if (targetType == null || targetType.equals(q.getQualifierType())) { checkPermission(user, q.getQualifierId(), q.getQualifierType(), right); return; } else { throw new AccessDeniedException( MSG.wrongDomainObject(right.toString(), q.getQualifierType(), targetType)); } } if (targetId instanceof String && Department.class.getName().equals(className)) { Department dept = Department.findByDeptCode((String) targetId, user.getCurrentAcademicSessionId()); if (dept != null) { checkPermission(user, dept, right); return; } } if (targetId instanceof String) { try { targetId = Long.valueOf((String) targetId); } catch (NumberFormatException e) { } } if (!(targetId instanceof Long)) { try { targetId = (Serializable) targetId.getClass().getMethod("getUniqueId").invoke(targetId); } catch (Exception e) { } try { targetId = (Serializable) targetId.getClass().getMethod("getId").invoke(targetId); } catch (Exception e) { } } Object domainObject = new _RootDAO().getSession().get(Class.forName(className), targetId); if (domainObject == null) throw new AccessDeniedException(MSG.domainObjectNotExists(right.toString(), targetType)); checkPermission(user, domainObject, right); } catch (AccessDeniedException e) { throw e; } catch (Exception e) { throw new AccessDeniedException( MSG.permissionCheckFailedException(right.toString(), targetType, e.getMessage())); } }
From source file:org.sparkcommerce.openadmin.server.service.persistence.module.MapStructurePersistenceModule.java
protected Serializable procureSandBoxMapValue(MapStructure mapStructure, Entity entity) { try {//from ww w.ja v a 2 s.co m Serializable valueInstance = null; //this is probably a sync from another sandbox where they've updated a map item for which we've updated the key in our own sandbox //(i.e. the map entry key was changed by us in our sandbox, so our map does not have the requested key) Class<?> valueClass = Class.forName(mapStructure.getValueClassName()); Map<String, Object> idMetadata = getPersistenceManager().getDynamicEntityDao() .getIdMetadata(valueClass); String idProperty = (String) idMetadata.get("name"); Property prop = entity.findProperty(idProperty); if (prop != null) { Serializable identifier; if (!(((Type) idMetadata.get("type")) instanceof StringType)) { identifier = Long.parseLong(prop.getValue()); } else { identifier = prop.getValue(); } valueInstance = (Serializable) getPersistenceManager().getDynamicEntityDao().find(valueClass, identifier); SparkRequestContext context = SparkRequestContext.getSparkRequestContext(); if (sandBoxHelper.isSandBoxable(valueInstance.getClass().getName()) && context != null && !context.isProductionSandBox()) { if (sandBoxHelper.isPromote() && !sandBoxHelper.isReject()) { //if this is a prod record (i.e. the destination map has deleted our record), then duplicate our value //so it's available in this sandbox valueInstance = getPersistenceManager().getDynamicEntityDao().merge(valueInstance); } else { valueInstance = null; } } } return valueInstance; } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
From source file:org.broadleafcommerce.openadmin.server.service.persistence.module.MapStructurePersistenceModule.java
protected Serializable procureSandBoxMapValue(MapStructure mapStructure, Entity entity) { try {// w ww. jav a 2 s . com Serializable valueInstance = null; //this is probably a sync from another sandbox where they've updated a map item for which we've updated the key in our own sandbox //(i.e. the map entry key was changed by us in our sandbox, so our map does not have the requested key) Class<?> valueClass = Class.forName(mapStructure.getValueClassName()); Map<String, Object> idMetadata = getPersistenceManager().getDynamicEntityDao() .getIdMetadata(valueClass); String idProperty = (String) idMetadata.get("name"); Property prop = entity.findProperty(idProperty); if (prop != null) { Serializable identifier; if (!(((Type) idMetadata.get("type")) instanceof StringType)) { identifier = Long.parseLong(prop.getValue()); } else { identifier = prop.getValue(); } valueInstance = (Serializable) getPersistenceManager().getDynamicEntityDao().find(valueClass, identifier); BroadleafRequestContext context = BroadleafRequestContext.getBroadleafRequestContext(); if (sandBoxHelper.isSandBoxable(valueInstance.getClass().getName()) && context != null && !context.isProductionSandBox()) { if (sandBoxHelper.isPromote() && !sandBoxHelper.isReject()) { //if this is a prod record (i.e. the destination map has deleted our record), then duplicate our value //so it's available in this sandbox valueInstance = getPersistenceManager().getDynamicEntityDao().merge(valueInstance); } else { valueInstance = null; } } } return valueInstance; } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
From source file:org.sparkcommerce.openadmin.server.service.persistence.module.AdornedTargetListPersistenceModule.java
@Override public Entity update(PersistencePackage persistencePackage) throws ServiceException { String[] customCriteria = persistencePackage.getCustomCriteria(); if (customCriteria != null && customCriteria.length > 0) { LOG.warn(/*from ww w .j a v a 2 s . co m*/ "custom persistence handlers and custom criteria not supported for update types other than BASIC"); } PersistencePerspective persistencePerspective = persistencePackage.getPersistencePerspective(); Entity entity = persistencePackage.getEntity(); AdornedTargetList adornedTargetList = (AdornedTargetList) persistencePerspective .getPersistencePerspectiveItems().get(PersistencePerspectiveItemType.ADORNEDTARGETLIST); if (!adornedTargetList.getMutable()) { throw new SecurityServiceException("Field is not mutable"); } try { AdornedTargetRetrieval adornedTargetRetrieval = new AdornedTargetRetrieval(persistencePackage, entity, adornedTargetList).invokeForUpdate(); List<Serializable> records = adornedTargetRetrieval.getRecords(); Assert.isTrue(!CollectionUtils.isEmpty(records), "Entity not found"); int index = adornedTargetRetrieval.getIndex(); Map<String, FieldMetadata> mergedProperties = adornedTargetRetrieval.getMergedProperties(); FieldManager fieldManager = getFieldManager(); Serializable myRecord; if (adornedTargetList.getSortField() != null && entity.findProperty(adornedTargetList.getSortField()).getValue() != null) { myRecord = records.get(index); Integer requestedSequence = Integer .valueOf(entity.findProperty(adornedTargetList.getSortField()).getValue()); Integer previousSequence = new BigDecimal( String.valueOf(getFieldManager().getFieldValue(myRecord, adornedTargetList.getSortField()))) .intValue(); if (!previousSequence.equals(requestedSequence)) { // Sequence has changed. Rebalance the list myRecord = records.remove(index); myRecord = createPopulatedInstance(myRecord, entity, mergedProperties, false); if (CollectionUtils.isEmpty(records)) { records.add(myRecord); } else { records.add(requestedSequence - 1, myRecord); } index = 1; Class<?> type = fieldManager.getField(myRecord.getClass(), adornedTargetList.getSortField()) .getType(); boolean isBigDecimal = BigDecimal.class.isAssignableFrom(type); for (Serializable record : records) { fieldManager.setFieldValue(record, adornedTargetList.getSortField(), isBigDecimal ? new BigDecimal(index) : Long.valueOf(index)); index++; } } } else { myRecord = records.get(index); } String ceilingEntityFullyQualifiedClassname = persistencePackage .getCeilingEntityFullyQualifiedClassname(); Class<?>[] entities = persistenceManager.getPolymorphicEntities(ceilingEntityFullyQualifiedClassname); Map<String, FieldMetadata> mergedPropertiesTarget = persistenceManager.getDynamicEntityDao() .getMergedProperties(ceilingEntityFullyQualifiedClassname, entities, null, persistencePerspective.getAdditionalNonPersistentProperties(), persistencePerspective.getAdditionalForeignKeys(), MergedPropertyType.PRIMARY, persistencePerspective.getPopulateToOneFields(), persistencePerspective.getIncludeFields(), persistencePerspective.getExcludeFields(), persistencePerspective.getConfigurationKey(), ""); myRecord = createPopulatedInstance(myRecord, entity, mergedProperties, false); myRecord = persistenceManager.getDynamicEntityDao().merge(myRecord); List<Serializable> myList = new ArrayList<Serializable>(); myList.add(myRecord); Entity[] payload = getRecords(mergedPropertiesTarget, myList, mergedProperties, adornedTargetList.getTargetObjectPath()); entity = payload[0]; return entity; } catch (Exception e) { throw new ServiceException("Problem updating entity : " + e.getMessage(), e); } }
From source file:org.broadleafcommerce.openadmin.server.service.persistence.module.BasicPersistenceModule.java
protected void cleanupFailedPersistenceAttempt(Serializable instance) throws IllegalAccessException { //Remove the entity from ORM management - no further attempts to persist if (getPersistenceManager().getDynamicEntityDao().getStandardEntityManager().contains(instance)) { getPersistenceManager().getDynamicEntityDao().getStandardEntityManager().detach(instance); }/* www .j a va 2 s . com*/ //Remove the id field value, if it's set String idFieldName = (String) getPersistenceManager().getDynamicEntityDao() .getIdMetadata(instance.getClass()).get("name"); Field idField = FieldUtils.getField(instance.getClass(), idFieldName, true); if (idField == null) { throw ExceptionHelper.refineException(new NoSuchFieldException( "Entity " + instance.getClass().getName() + " does not contain id field " + idFieldName)); } idField.setAccessible(true); if (idField.get(instance) != null) { idField.set(instance, null); } }
From source file:org.broadleafcommerce.openadmin.server.service.persistence.module.BasicPersistenceModule.java
@Override public Entity[] getRecords(Map<String, FieldMetadata> primaryUnfilteredMergedProperties, List<? extends Serializable> records, Map<String, FieldMetadata> alternateUnfilteredMergedProperties, String pathToTargetObject) { Map<String, FieldMetadata> primaryMergedProperties = filterOutCollectionMetadata( primaryUnfilteredMergedProperties); Map<String, FieldMetadata> alternateMergedProperties = filterOutCollectionMetadata( alternateUnfilteredMergedProperties); Entity[] entities = new Entity[records.size()]; int j = 0;/* w ww . j av a 2s .c o m*/ for (Serializable recordEntity : records) { Serializable entity; if (pathToTargetObject != null) { try { entity = (Serializable) getFieldManager().getFieldValue(recordEntity, pathToTargetObject); } catch (Exception e) { throw new PersistenceException(e); } } else { entity = recordEntity; } Entity entityItem = new Entity(); entityItem.setType(new String[] { entity.getClass().getName() }); entities[j] = entityItem; List<Property> props = new ArrayList<Property>(primaryMergedProperties.size()); extractPropertiesFromPersistentEntity(primaryMergedProperties, entity, props); if (alternateMergedProperties != null) { extractPropertiesFromPersistentEntity(alternateMergedProperties, recordEntity, props); } // Try to add the "main name" property. Log a debug message if we can't try { Property p = new Property(); p.setName(MAIN_ENTITY_NAME_PROPERTY); String mainEntityName = (String) MethodUtils.invokeMethod(entity, "getMainEntityName"); p.setValue(mainEntityName); props.add(p); } catch (Exception e) { LOG.debug(String.format("Could not execute the getMainEntityName() method for [%s]", entity.getClass().getName()), e); } // Try to add the alternate id property if available if (alternateMergedProperties != null) { for (Entry<String, FieldMetadata> entry : alternateMergedProperties.entrySet()) { if (entry.getValue() instanceof BasicFieldMetadata) { if (((BasicFieldMetadata) entry.getValue()).getFieldType() == SupportedFieldType.ID) { Map<String, FieldMetadata> alternateOnEntity = new HashMap<String, FieldMetadata>(); alternateOnEntity.put(entry.getKey(), entry.getValue()); List<Property> props2 = new ArrayList<Property>(); extractPropertiesFromPersistentEntity(alternateOnEntity, recordEntity, props2); if (props2.size() == 1 && !props2.get(0).getName().contains(".")) { Property alternateIdProp = props2.get(0); alternateIdProp.setName(ALTERNATE_ID_PROPERTY); props.add(alternateIdProp); } } } } } Property[] properties = new Property[props.size()]; properties = props.toArray(properties); entityItem.setProperties(properties); j++; } return entities; }
From source file:org.alfresco.repo.domain.propval.AbstractPropertyValueDAOImpl.java
/** * @param propIndex a unique index within the context of the current property root *///w w w . j a v a2 s .co m @SuppressWarnings("unchecked") private long createPropertyImpl(Long rootPropId, long propIndex, long containedIn, Long keyPropId, Serializable value) { // Keep track of the index for this property. It gets used later when making the link entry. long thisPropIndex = propIndex; Long valuePropId = null; if (value == null) { // The key and the value are the same valuePropId = getOrCreatePropertyValue(value).getFirst(); } else if (value instanceof Map<?, ?>) { Map<Serializable, Serializable> map = (Map<Serializable, Serializable>) value; // Check if the it has a default constructor Serializable emptyInstance = constructEmptyContainer(value.getClass()); if (emptyInstance == null) { // No default constructor, so we just throw the whole thing in as a single property valuePropId = getOrCreatePropertyValue(value).getFirst(); } else { // Persist the empty map valuePropId = getOrCreatePropertyValue(emptyInstance).getFirst(); // Persist the individual entries for (Map.Entry<Serializable, Serializable> entry : map.entrySet()) { // Recurse for each value Serializable mapKey = entry.getKey(); Serializable mapValue = entry.getValue(); // Get the IDs for these Long mapKeyId = getOrCreatePropertyValue(mapKey).getFirst(); propIndex = createPropertyImpl(rootPropId, propIndex + 1L, thisPropIndex, mapKeyId, mapValue); } } } else if (value instanceof Collection<?>) { Collection<Serializable> collection = (Collection<Serializable>) value; // Check if the it has a default constructor Serializable emptyInstance = constructEmptyContainer(value.getClass()); if (emptyInstance == null) { // No default constructor, so we just throw the whole thing in as a single property valuePropId = getOrCreatePropertyValue(value).getFirst(); } else { // Persist the empty collection valuePropId = getOrCreatePropertyValue(emptyInstance).getFirst(); // Persist the individual entries for (Serializable collectionValue : collection) { // Recurse for each value propIndex = createPropertyImpl(rootPropId, propIndex + 1L, thisPropIndex, null, collectionValue); } } } else { // The key and the value are the same valuePropId = getOrCreatePropertyValue(value).getFirst(); } // Create a link entry if (keyPropId == null) { // If the key matches the value then it is the root keyPropId = valuePropId; } createPropertyLink(rootPropId, thisPropIndex, containedIn, keyPropId, valuePropId); // Done return propIndex; }
From source file:com.mnxfst.testing.plan.ctx.TSPlanExecutionContext.java
/** * Evaluates the given pattern which either starts with ${global.} or ${run.}. If there is no context variable * that matches the named contained in the pattern, the pattern itself will be returned. * @param replacementPattern/*w ww . jav a 2 s. c om*/ * @return * @throws TSVariableEvaluationFailedException */ public Object evaluate(String replacementPattern) throws TSVariableEvaluationFailedException { // validate the replacement pattern if (replacementPattern == null || replacementPattern.isEmpty()) throw new TSVariableEvaluationFailedException("No replacement pattern provided"); // find replacement pattern in map of previously computed pattern TSPlanExecutionReplacementPattern pattern = replacementPatternMapping.get(replacementPattern); if (pattern != null) { switch (pattern.getVariableStoreType()) { case GLOBAL: { Serializable variable = globalValues.get(pattern.getName()); return evaluateObject(variable, pattern.getAccessMethods()); } case RUN: { Serializable variable = transientRunValues.get(pattern.getName()); return evaluateObject(variable, pattern.getAccessMethods()); } default: throw new TSVariableEvaluationFailedException("Invalid variable storage type ('" + pattern.getVariableStoreType() + "') found for pattern: " + replacementPattern); } } // if the pattern is not contained in the mentioned map, figure out how to evaluate it: for global or transient run variables if (replacementPattern.startsWith(REPLACEMENT_PATTERN_PREFIX_GLOBAL) && replacementPattern.endsWith("}")) { // extract the name of the context variable and try to fetch the associated value. if there is no value, return null String ctxVar = extractContextVariableName(replacementPattern, REPLACEMENT_PATTERN_PREFIX_GLOBAL); Serializable variable = globalValues.get(ctxVar); if (variable == null) return null; // if the variable has been found, try to extract the getter method names along the path described String[] getterMethodNames = extractGetterMethodNames(replacementPattern, REPLACEMENT_PATTERN_PREFIX_GLOBAL); if (getterMethodNames == null || getterMethodNames.length < 1) return variable; // convert the getter names into method representations List<Method> getterMethods = new ArrayList<Method>(); extractGetterMethods(variable.getClass(), getterMethodNames, getterMethods); // create entity for previously mentioned association map for pattern information and insert it TSPlanExecutionReplacementPattern patternMapping = new TSPlanExecutionReplacementPattern( replacementPattern, ctxVar, ExecutionContextValueType.GLOBAL); for (Method m : getterMethods) patternMapping.addAccessMethod(m); replacementPatternMapping.put(replacementPattern, patternMapping); // evaluate the getter methods against the variable value return evaluateObject(variable, getterMethods); } else if (replacementPattern.startsWith(REPLACEMENT_PATTERN_PREFIX_RUN) && replacementPattern.endsWith("}")) { // extract the name of the context variable and try to fetch the associated value. if there is no value, return null String ctxVar = extractContextVariableName(replacementPattern, REPLACEMENT_PATTERN_PREFIX_RUN); Serializable variable = transientRunValues.get(ctxVar); if (variable == null) return null; // if the variable has been found, try to extract the getter method names along the path described String[] getterMethodNames = extractGetterMethodNames(replacementPattern, REPLACEMENT_PATTERN_PREFIX_RUN); if (getterMethodNames == null || getterMethodNames.length < 1) return variable; // convert the getter names into method representations List<Method> getterMethods = new ArrayList<Method>(); extractGetterMethods(variable.getClass(), getterMethodNames, getterMethods); // create entity for previously mentioned association map for pattern information and insert it TSPlanExecutionReplacementPattern patternMapping = new TSPlanExecutionReplacementPattern( replacementPattern, ctxVar, ExecutionContextValueType.RUN); for (Method m : getterMethods) patternMapping.addAccessMethod(m); replacementPatternMapping.put(replacementPattern, patternMapping); // evaluate the getter methods against the variable value return evaluateObject(variable, getterMethods); } throw new TSVariableEvaluationFailedException( "Invalid replacement pattern: " + replacementPattern + ". Expected prefix: ${global||run...}"); }
From source file:org.broadleafcommerce.openadmin.server.service.persistence.module.MapStructurePersistenceModule.java
protected Entity[] getMapRecords(Serializable record, MapStructure mapStructure, Map<String, FieldMetadata> ceilingMergedProperties, Map<String, FieldMetadata> valueMergedProperties, Property symbolicIdProperty)//from ww w .jav a2s . c om throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, SecurityException, IllegalArgumentException, ClassNotFoundException, NoSuchFieldException { //compile a list of mapKeys that were used as mapFields List<String> mapFieldKeys = new ArrayList<String>(); String mapProperty = mapStructure.getMapProperty(); for (Map.Entry<String, FieldMetadata> entry : ceilingMergedProperties.entrySet()) { if (entry.getKey().startsWith(mapProperty + FieldManager.MAPFIELDSEPARATOR)) { mapFieldKeys.add(entry.getKey().substring(entry.getKey().indexOf(FieldManager.MAPFIELDSEPARATOR) + FieldManager.MAPFIELDSEPARATOR.length(), entry.getKey().length())); } } Collections.sort(mapFieldKeys); FieldManager fieldManager = getFieldManager(); Map map; try { map = (Map) fieldManager.getFieldValue(record, mapProperty); } catch (FieldNotAvailableException e) { throw new IllegalArgumentException(e); } List<Entity> entities = new ArrayList<Entity>(map.size()); for (Object key : map.keySet()) { if (key instanceof String && mapFieldKeys.contains(key)) { continue; } entities.add(getMapRecord(record.getClass().getName(), (Serializable) map.get(key), mapStructure, valueMergedProperties, symbolicIdProperty, key)); } return entities.toArray(new Entity[entities.size()]); }
From source file:org.sparkcommerce.openadmin.server.service.persistence.module.MapStructurePersistenceModule.java
protected Entity[] getMapRecords(Serializable record, MapStructure mapStructure, Map<String, FieldMetadata> ceilingMergedProperties, Map<String, FieldMetadata> valueMergedProperties, Property symbolicIdProperty)/*from w ww. j a v a 2s. co m*/ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, SecurityException, IllegalArgumentException, ClassNotFoundException, NoSuchFieldException { //compile a list of mapKeys that were used as mapFields List<String> mapFieldKeys = new ArrayList<String>(); String mapProperty = mapStructure.getMapProperty(); for (Map.Entry<String, FieldMetadata> entry : ceilingMergedProperties.entrySet()) { if (entry.getKey().startsWith(mapProperty + FieldManager.MAPFIELDSEPARATOR)) { mapFieldKeys.add(entry.getKey().substring(entry.getKey().indexOf(FieldManager.MAPFIELDSEPARATOR) + FieldManager.MAPFIELDSEPARATOR.length(), entry.getKey().length())); } } Collections.sort(mapFieldKeys); FieldManager fieldManager = getFieldManager(); Map map; try { map = (Map) fieldManager.getFieldValue(record, mapProperty); } catch (FieldNotAvailableException e) { throw new IllegalArgumentException(e); } List<Entity> entities = new ArrayList<Entity>(map.size()); for (Object key : map.keySet()) { if (key instanceof String && mapFieldKeys.contains(key)) { continue; } Entity entityItem = new Entity(); entityItem.setType(new String[] { record.getClass().getName() }); entities.add(entityItem); List<Property> props = new ArrayList<Property>(); Property propertyItem = new Property(); propertyItem.setName(mapStructure.getKeyPropertyName()); props.add(propertyItem); String strVal; if (Date.class.isAssignableFrom(key.getClass())) { strVal = getSimpleDateFormatter().format((Date) key); } else if (Timestamp.class.isAssignableFrom(key.getClass())) { strVal = getSimpleDateFormatter().format(new Date(((Timestamp) key).getTime())); } else if (Calendar.class.isAssignableFrom(key.getClass())) { strVal = getSimpleDateFormatter().format(((Calendar) key).getTime()); } else if (Double.class.isAssignableFrom(key.getClass())) { strVal = getDecimalFormatter().format(key); } else if (BigDecimal.class.isAssignableFrom(key.getClass())) { strVal = getDecimalFormatter().format(key); } else { strVal = key.toString(); } propertyItem.setValue(strVal); PersistentClass persistentClass = persistenceManager.getDynamicEntityDao() .getPersistentClass(mapStructure.getValueClassName()); if (persistentClass == null) { Property temp = new Property(); temp.setName(((SimpleValueMapStructure) mapStructure).getValuePropertyName()); temp.setValue(String.valueOf(map.get(key))); props.add(temp); } else { extractPropertiesFromPersistentEntity(valueMergedProperties, (Serializable) map.get(key), props); } if (symbolicIdProperty != null) { props.add(symbolicIdProperty); } Property[] properties = new Property[props.size()]; properties = props.toArray(properties); entityItem.setProperties(properties); } return entities.toArray(new Entity[entities.size()]); }