Skip to content

Instantly share code, notes, and snippets.

@smaldini
Created December 5, 2011 14:22
Show Gist options
  • Save smaldini/1433726 to your computer and use it in GitHub Desktop.
Save smaldini/1433726 to your computer and use it in GitHub Desktop.
class DocumentModel implements DocumentModelNode {
static final SCORE = 40
String id // UUID , for replications / optimization
String name
String description = ''
Date dateCreated
Date lastUpdated
long estimatedScore = 0
long score = 0
Map<String, Object> parameters = new HashMap<String, Object>()
DocumentStyle layout
static hasMany = [
scripts: ContentScript,
entities: DocumentEntity,
dataElements: DocumentData,
texts: TextBlock,
attachments: Attachment
]
static belongsTo = [workspace:Workspace, category:Category]
static mapping = {
id generator:'uuid'
name index: 'idx_doc_name'
description size:0..300, nullable:true
}
static constraints = {
estimatedScore min: 0l
score min: 0l
layout nullable: true
name blank: false, unique: 'workspace'
}
void accept(DocumentModelVisitor visitor) {
visitor.visit(this)
for (s in scripts) { s.accept visitor }
for (e in entities) { e.accept visitor }
for (d in dataElements) { d.accept visitor }
for (t in texts) { t.accept visitor }
for (a in attachments) { a.accept visitor }
layout?.accept visitor
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment