private void populateEmbeddedIdFields(final MemberDetails details, final JavaType type) { final List<FieldMetadata> embeddedIdFields = MemberFindingUtils.getFieldsWithTag(details, CustomDataKeys.EMBEDDED_ID_FIELD); if (!embeddedIdFields.isEmpty()) { domainTypeEmbeddedIdFieldsCache.remove(type); domainTypeEmbeddedIdFieldsCache.put(type, new ArrayList<FieldMetadata>()); final MemberDetails memberDetails = getMemberDetails(embeddedIdFields.get(0).getFieldType()); if (memberDetails != null) { for (final FieldMetadata field : memberDetails.getFields()) { if (!field.getCustomData().keySet().contains(CustomDataKeys.SERIAL_VERSION_UUID_FIELD)) { domainTypeEmbeddedIdFieldsCache.get(type).add(field); } } } } else if (domainTypeEmbeddedIdFieldsCache.containsKey(type)) { domainTypeEmbeddedIdFieldsCache.remove(type); } }
/** * Returns all fields within the given {@link MemberDetails} that contain * the given {@link CustomData} tag. * * @param memberDetails the {@link MemberDetails} to search (can be * <code>null</code>) * @param tagKey the {@link CustomData} key to search for * @return zero or more fields (never <code>null</code>) */ public static List<FieldMetadata> getFieldsWithTag(final MemberDetails memberDetails, final Object tagKey) { Validate.notNull(tagKey, "Custom data key required"); final List<FieldMetadata> fields = new ArrayList<FieldMetadata>(); if (memberDetails != null) { for (final MemberHoldingTypeDetails memberHoldingTypeDetails : memberDetails.getDetails()) { for (final FieldMetadata field : memberHoldingTypeDetails.getDeclaredFields()) { if (field.getCustomData().keySet().contains(tagKey)) { fields.add(field); } } } } return fields; }
/** * Returns the {@link JpaEntityFactoryMetadata} for the entity that's the target * of the given reference field. * * @param entityFactoryMetadataId * @param field * @param entityFactoryTypes * @return <code>null</code> if it's not an n:1 or 1:1 field, or the DoD * metadata is simply not available */ private JpaEntityFactoryMetadata locateCollaboratingMetadata( final String entityFactoryMetadataId, final FieldMetadata field, final Iterable<ClassOrInterfaceTypeDetails> entityFactoryTypes) { if (!(field.getCustomData().keySet().contains(MANY_TO_ONE_FIELD) || field.getCustomData() .keySet().contains(ONE_TO_ONE_FIELD))) { return null; } final String otherEntityFactoryMetadataId = getEntityFactoryMetadataId(field.getFieldType(), entityFactoryTypes); if (otherEntityFactoryMetadataId == null || otherEntityFactoryMetadataId.equals(entityFactoryMetadataId)) { // No DoD for this field's type, or it's a self-reference return null; } // Make this DoD depend on the related entity (not its Dod, otherwise // we get a circular MD dependency) registerDependencyUponType(entityFactoryMetadataId, field.getFieldType()); return (JpaEntityFactoryMetadata) getMetadataService().get(otherEntityFactoryMetadataId); }
private void doModification(final FieldMetadata field, final CustomData customData) { final MemberHoldingTypeDetails memberHoldingTypeDetails = memberHoldingTypeDetailsMap.get(field.getDeclaredByMetadataId()); if (memberHoldingTypeDetails != null) { final FieldMetadata matchedField = memberHoldingTypeDetails.getField(field.getFieldName()); if (matchedField != null && !matchedField.getCustomData().keySet().containsAll(customData.keySet())) { final TypeDetailsBuilder typeDetailsBuilder = getTypeDetailsBuilder(memberHoldingTypeDetails); typeDetailsBuilder.addDataToField(field, customData); changed = true; } } }
dodMetadataId); final Set<Object> fieldCustomDataKeys = field.getCustomData().keySet();
if (field == null || field.getCustomData().keySet().contains(CustomDataKeys.TRANSIENT_FIELD) || !BeanInfoUtils.hasAccessorAndMutator(field, this)) { continue; if (!field.getCustomData().keySet().contains(EMBEDDED_FIELD)) { fieldTypes.add(returnType);
@SuppressWarnings("unchecked") final Map<String, Object> values = (Map<String, Object>) field.getCustomData().get(CustomDataKeys.COLUMN_FIELD); if (!isUnique && values != null && values.containsKey("unique")) { isUnique = (Boolean) values.get("unique"); bodyBuilder.append(getDecimalMinAndDecimalMaxBody(field, decimalMinAnnotation, decimalMaxAnnotation, suffix)); } else if (field.getCustomData().keySet().contains(CustomDataKeys.COLUMN_FIELD)) { @SuppressWarnings("unchecked") final Map<String, Object> values = (Map<String, Object>) field.getCustomData().get(CustomDataKeys.COLUMN_FIELD); bodyBuilder.append(getColumnPrecisionAndScaleBody(field, values, suffix));
String initializer = "null"; final String fieldInitializer = field.getFieldInitializer(); final Set<Object> fieldCustomDataKeys = field.getCustomData().keySet(); if (field.getCustomData().keySet().contains(CustomDataKeys.COLUMN_FIELD)) { @SuppressWarnings("unchecked") final Map<String, Object> columnValues = (Map<String, Object>) field.getCustomData().get(CustomDataKeys.COLUMN_FIELD); if (columnValues.keySet().contains("length")) { final Object lengthValue = columnValues.get("length");
private void populateEmbeddedIdFields(final MemberDetails details, final JavaType type) { final List<FieldMetadata> embeddedIdFields = MemberFindingUtils.getFieldsWithTag(details, CustomDataKeys.EMBEDDED_ID_FIELD); if (!embeddedIdFields.isEmpty()) { domainTypeEmbeddedIdFieldsCache.remove(type); domainTypeEmbeddedIdFieldsCache.put(type, new ArrayList<FieldMetadata>()); final MemberDetails memberDetails = getMemberDetails(embeddedIdFields.get(0).getFieldType()); if (memberDetails != null) { for (final FieldMetadata field : memberDetails.getFields()) { if (!field.getCustomData().keySet().contains(CustomDataKeys.SERIAL_VERSION_UUID_FIELD)) { domainTypeEmbeddedIdFieldsCache.get(type).add(field); } } } } else if (domainTypeEmbeddedIdFieldsCache.containsKey(type)) { domainTypeEmbeddedIdFieldsCache.remove(type); } }
/** * Returns all fields within the given {@link MemberDetails} that contain * the given {@link CustomData} tag. * * @param memberDetails the {@link MemberDetails} to search (can be * <code>null</code>) * @param tagKey the {@link CustomData} key to search for * @return zero or more fields (never <code>null</code>) */ public static List<FieldMetadata> getFieldsWithTag(final MemberDetails memberDetails, final Object tagKey) { Validate.notNull(tagKey, "Custom data key required"); final List<FieldMetadata> fields = new ArrayList<FieldMetadata>(); if (memberDetails != null) { for (final MemberHoldingTypeDetails memberHoldingTypeDetails : memberDetails.getDetails()) { for (final FieldMetadata field : memberHoldingTypeDetails.getDeclaredFields()) { if (field.getCustomData().keySet().contains(tagKey)) { fields.add(field); } } } } return fields; }
private IdentifierHolder getIdentifierHolder(final JavaType javaType) { final List<FieldMetadata> identifierFields = getPersistenceMemberLocator() .getIdentifierFields(javaType); if (identifierFields.isEmpty()) { return null; } final FieldMetadata identifierField = identifierFields.get(0); final boolean embeddedIdField = identifierField.getCustomData().get( CustomDataKeys.EMBEDDED_ID_FIELD) != null; final List<FieldMetadata> embeddedIdFields = getPersistenceMemberLocator() .getEmbeddedIdentifierFields(javaType); return new IdentifierHolder(identifierField, embeddedIdField, embeddedIdFields); }
/** * Returns the {@link JpaEntityFactoryMetadata} for the entity that's the target * of the given reference field. * * @param entityFactoryMetadataId * @param field * @param entityFactoryTypes * @return <code>null</code> if it's not an n:1 or 1:1 field, or the DoD * metadata is simply not available */ private JpaEntityFactoryMetadata locateCollaboratingMetadata( final String entityFactoryMetadataId, final FieldMetadata field, final Iterable<ClassOrInterfaceTypeDetails> entityFactoryTypes) { if (!(field.getCustomData().keySet().contains(MANY_TO_ONE_FIELD) || field.getCustomData() .keySet().contains(ONE_TO_ONE_FIELD))) { return null; } final String otherEntityFactoryMetadataId = getEntityFactoryMetadataId(field.getFieldType(), entityFactoryTypes); if (otherEntityFactoryMetadataId == null || otherEntityFactoryMetadataId.equals(entityFactoryMetadataId)) { // No DoD for this field's type, or it's a self-reference return null; } // Make this DoD depend on the related entity (not its Dod, otherwise // we get a circular MD dependency) registerDependencyUponType(entityFactoryMetadataId, field.getFieldType()); return (JpaEntityFactoryMetadata) getMetadataService().get(otherEntityFactoryMetadataId); }
private void doModification(final FieldMetadata field, final CustomData customData) { final MemberHoldingTypeDetails memberHoldingTypeDetails = memberHoldingTypeDetailsMap.get(field.getDeclaredByMetadataId()); if (memberHoldingTypeDetails != null) { final FieldMetadata matchedField = memberHoldingTypeDetails.getField(field.getFieldName()); if (matchedField != null && !matchedField.getCustomData().keySet().containsAll(customData.keySet())) { final TypeDetailsBuilder typeDetailsBuilder = getTypeDetailsBuilder(memberHoldingTypeDetails); typeDetailsBuilder.addDataToField(field, customData); changed = true; } } }
dodMetadataId); final Set<Object> fieldCustomDataKeys = field.getCustomData().keySet();
if (field == null || field.getCustomData().keySet().contains(CustomDataKeys.TRANSIENT_FIELD) || !BeanInfoUtils.hasAccessorAndMutator(field, this)) { continue; if (!field.getCustomData().keySet().contains(EMBEDDED_FIELD)) { fieldTypes.add(returnType);
if (field.getCustomData().keySet() .contains(CustomDataKeys.COLUMN_FIELD)) { @SuppressWarnings("unchecked") final Map<String, Object> values = (Map<String, Object>) field .getCustomData().get(CustomDataKeys.COLUMN_FIELD); if (values.keySet().contains("nullable") && (Boolean) values.get("nullable") == false) {
if (field.getCustomData().keySet() .contains(CustomDataKeys.EMBEDDED_ID_FIELD)) { continue; .build(); else if (field.getCustomData().keySet() .contains(CustomDataKeys.ONE_TO_MANY_FIELD)) { else if (field.getCustomData().keySet() .contains(CustomDataKeys.MANY_TO_ONE_FIELD) || field.getCustomData().keySet() .contains(CustomDataKeys.MANY_TO_MANY_FIELD) || field.getCustomData().keySet() .contains(CustomDataKeys.ONE_TO_ONE_FIELD)) { final JavaType referenceType = getJavaTypeForField(field); + getPathForType(getJavaTypeForField(field))) .build(); if (field.getCustomData().keySet() .contains(CustomDataKeys.MANY_TO_MANY_FIELD)) { fieldElement.setAttribute("multiple", "true"); else if (field.getCustomData().keySet() .contains(CustomDataKeys.LOB_FIELD)) { fieldElement = new XmlElementBuilder("field:textarea", document)
&& field.getCustomData().get( CustomDataKeys.ONE_TO_MANY_FIELD) != null) { continue;
&& field.getCustomData().get( CustomDataKeys.ONE_TO_MANY_FIELD) != null) { continue;
@SuppressWarnings("unchecked") final Map<String, Object> values = (Map<String, Object>) field.getCustomData().get(CustomDataKeys.COLUMN_FIELD); if (!isUnique && values != null && values.containsKey("unique")) { isUnique = (Boolean) values.get("unique"); bodyBuilder.append(getDecimalMinAndDecimalMaxBody(field, decimalMinAnnotation, decimalMaxAnnotation, suffix)); } else if (field.getCustomData().keySet().contains(CustomDataKeys.COLUMN_FIELD)) { @SuppressWarnings("unchecked") final Map<String, Object> values = (Map<String, Object>) field.getCustomData().get(CustomDataKeys.COLUMN_FIELD); bodyBuilder.append(getColumnPrecisionAndScaleBody(field, values, suffix));