Skip to content

Commit

Permalink
Merge branch 'master' into refactor/modser-57
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Golding committed Oct 22, 2024
2 parents 98dd852 + 766cb9b commit 3cac7ae
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ def should_expand = [
]

@Field InternalCombinationPiece internalCombinationPiece
json g.render(internalCombinationPiece, [excludes: ['owner'], expand: should_expand])
json g.render(internalCombinationPiece, [excludes: ['owner'], expand: should_expand]){
'class' internalCombinationPiece.class.name
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ def should_expand = [
]

@Field InternalOmissionPiece internalOmissionPiece
json g.render(internalOmissionPiece, [expand: should_expand])
json g.render(internalOmissionPiece, [excludes: ['owner'], expand: should_expand]){
'class' internalOmissionPiece.class.name
}
17 changes: 16 additions & 1 deletion service/grails-app/views/internalPiece/_internalPiece.gson
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
import groovy.transform.*
import org.olf.internalPiece.InternalPiece
import groovy.transform.Field
import org.grails.orm.hibernate.cfg.GrailsHibernateUtil

def should_expand = ['receivingPieces', 'templateMetadata']

@Field InternalPiece internalPiece
json g.render(internalPiece, [expand: should_expand])
internalPiece = GrailsHibernateUtil.unwrapIfProxy(internalPiece) as InternalPiece

switch(internalPiece.class.name){
case 'org.olf.internalPiece.InternalOmissionPiece':
json g.render (template: '/internalOmissionPiece/internalOmissionPiece', model: [internalOmissionPiece: binding.variables.internalPiece])
break;
case 'org.olf.internalPiece.InternalRecurrencePiece':
json g.render (template: '/internalRecurrencePiece/internalRecurrencePiece', model: [internalRecurrencePiece: binding.variables.internalPiece])
break;
case 'org.olf.internalPiece.InternalCombinationPiece':
json g.render (template: '/internalCombinationPiece/internalCombinationPiece', model: [internalCombinationPiece: binding.variables.internalPiece])
break;
default:
throw new RuntimeException("Unexpected internalPiece class ${internalPiece.class.name}")
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ def should_expand = [
]

@Field InternalRecurrencePiece internalRecurrencePiece
json g.render(internalRecurrencePiece, [excludes: ['owner'], expand: should_expand])
json g.render(internalRecurrencePiece, [excludes: ['owner'], expand: should_expand]){
'class' internalRecurrencePiece.class.name
}

0 comments on commit 3cac7ae

Please sign in to comment.