use of org.motechproject.mds.domain.FieldMetadata in project motech by motech.
the class FieldTestHelper method field.
public static Field field(String name, Class<?> typeClass, boolean required, boolean exposedViaRest, boolean autoGenerated) {
Field field = field(name, name + " Display", typeClass);
field.setRequired(required);
field.setExposedViaRest(exposedViaRest);
field.addMetadata(new FieldMetadata(field, Constants.Util.AUTO_GENERATED, String.valueOf(autoGenerated)));
return field;
}
use of org.motechproject.mds.domain.FieldMetadata in project motech by motech.
the class FieldHelper method addOrUpdateMetadataForCombobox.
public static void addOrUpdateMetadataForCombobox(Field field) {
if (field.getType().isCombobox()) {
FieldMetadata metadata = field.getMetadata(ENUM_CLASS_NAME);
if (metadata == null) {
metadata = new FieldMetadata(field, ENUM_CLASS_NAME);
metadata.setValue(MemberUtil.getDefaultEnumName(field.getEntity().getClassName(), field.getName()));
field.addMetadata(metadata);
} else {
field.setMetadataValue(ENUM_CLASS_NAME, MemberUtil.getDefaultEnumName(field.getEntity().getClassName(), field.getName()));
}
}
}
use of org.motechproject.mds.domain.FieldMetadata in project motech by motech.
the class FieldHelper method setMetadataForOneToManyRelationship.
private static void setMetadataForOneToManyRelationship(Field field) {
setMetadataForOneToOneRelationship(field);
if (field != null) {
FieldMetadata metadata = new FieldMetadata(field, RELATIONSHIP_COLLECTION_TYPE);
field.addMetadata(metadata);
}
}
use of org.motechproject.mds.domain.FieldMetadata in project motech by motech.
the class FieldHelper method setMetadataForManyToManyRelationship.
public static void setMetadataForManyToManyRelationship(Field field, boolean isOwningSide) {
setMetadataForOneToManyRelationship(field);
if (field != null) {
FieldMetadata metadata = new FieldMetadata(field, RELATED_FIELD);
field.addMetadata(metadata);
if (isOwningSide) {
metadata = new FieldMetadata(field, OWNING_SIDE);
metadata.setValue("true");
field.addMetadata(metadata);
}
}
}
use of org.motechproject.mds.domain.FieldMetadata in project motech by motech.
the class FieldHelper method setMetadataForOneToOneRelationship.
private static void setMetadataForOneToOneRelationship(Field field) {
if (field != null) {
FieldMetadata metadata = new FieldMetadata(field, RELATED_CLASS);
field.addMetadata(metadata);
}
}
Aggregations