31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/liquigen/scaffold/schema.rb', line 31
def methods_lines
lines = []
skip_ones = %w[id created_at updated_at]
lines += [
'@PresentationField(primary = true, i18nKey = Constants.I18nCommon.Property.ID, type = FieldType.Number)',
'@PresentationColumn(type = ColumnType.LinkShow, width = "50px")',
'@PresentationDetailField',
'private Long id;',
''
]
props.each do |property|
key, value = property.to_s.split(':')
next if skip_ones.include?(key.underscore)
next if key.casecmp('available').zero?
type = Liquigen::TypeMap.new(value).java_type
stype = Liquigen::TypeMap.new(value).statement_type
if (stype && !stype.size.zero?)
lines += ["@PresentationField(type = FieldType.#{stype})"]
else
lines += ["@PresentationField//(i18nKey = Constants.I18nCommon.Property.#{key.upcase})"]
end
lines += [
'@PresentationColumn',
'@PresentationFormField(rules = { @PresentationRule(required = true) })',
'@PresentationDetailField',
'//@PresentationSearchField',
"private #{type} #{key.camelize(:lower)};",
''
]
end
lines += [
'@PresentationField(type = FieldType.Datetime, i18nKey = Constants.I18nCommon.Property.CREATED_AT)',
'@PresentationColumn(width = "140px")',
'@PresentationDetailField',
'private Date createdAt;',
'',
'@PresentationField(type = FieldType.Datetime, i18nKey = Constants.I18nCommon.Property.UPDATED_AT)',
'@PresentationColumn(width = "140px")',
'@PresentationDetailField',
'private Date updatedAt;'
]
lines
end
|