protected Content(final Builder builder) { Preconditions.checkNotNull(builder.name, "name is required for a Content"); Preconditions.checkNotNull(builder.parentPath, "parentPath is required for a Content"); Preconditions.checkNotNull(builder.data, "data is required for a Content"); if (builder.page != null) { Preconditions.checkArgument( !(builder.page.getController() != null && builder.page.getTemplate() != null), "A Page cannot have both have a controller and a template set"); } if (builder.type == null) { builder.type = ContentTypeName.unstructured(); } this.valid = builder.valid; this.displayName = builder.displayName; this.type = builder.type; this.name = builder.name; this.parentPath = builder.parentPath; this.path = ContentPath.from(builder.parentPath, builder.name.toString()); this.id = builder.id; this.data = builder.data; this.attachments = builder.attachments; this.extraDatas = builder.extraDatas; this.createdTime = builder.createdTime; this.modifiedTime = builder.modifiedTime; this.creator = builder.creator; this.modifier = builder.modifier; this.owner = builder.owner; this.page = builder.page; this.thumbnail = builder.thumbnail; this.hasChildren = builder.hasChildren; this.childOrder = builder.childOrder; this.permissions = builder.permissions == null ? AccessControlList.empty() : builder.permissions; this.inheritPermissions = builder.inheritPermissions; this.language = builder.language; this.contentState = builder.contentState == null ? ContentState.DEFAULT : builder.contentState; }