public ContentEntity createContent( String contentName, String categoryName, String languageCode, String ownerQualifiedName, String priority, Date created) { ContentEntity content = new ContentEntity(); content.setLanguage(fixture.findLanguageByCode(languageCode)); content.setCategory(fixture.findCategoryByName(categoryName)); content.setOwner(fixture.findUserByName(ownerQualifiedName)); content.setPriority(Integer.valueOf(priority)); content.setCreatedAt(created); // Not-null field in database. content.setDeleted(false); // Not-null field in database. content.setName(contentName); return content; }
public static void enforceNoLazyInitialization(ContentEntity content) { content.setCategory( content.getCategory() != null ? new CategoryEntity(content.getCategory()) : null); content.setAssignee( content.getAssignee() != null ? new UserEntity(content.getAssignee()) : null); content.setAssigner( content.getAssigner() != null ? new UserEntity(content.getAssigner()) : null); content.setOwner(content.getOwner() != null ? new UserEntity(content.getOwner()) : null); content.setLanguage( content.getLanguage() != null ? new LanguageEntity(content.getLanguage()) : null); content.setDraftVersion( content.getDraftVersion() != null ? new ContentVersionEntity(content.getDraftVersion()) : null); content.setMainVersion( content.getMainVersion() != null ? new ContentVersionEntity(content.getMainVersion()) : null); }