예제 #1
0
  public CategoryEntity createCategory(
      String name,
      String parentCategoryName,
      String contentTypeName,
      String unitName,
      String ownerUid,
      String modifierUid,
      boolean autoApprove) {
    CategoryEntity category = new CategoryEntity();
    category.setKey(new CategoryKey(mockKeyService.generateNextKeySafe("TCATEGORY")));
    category.setName(name);
    if (contentTypeName != null) {
      category.setContentType(fixture.findContentTypeByName(contentTypeName));
    }
    category.setUnit(fixture.findUnitByName(unitName));
    category.setCreated(new Date());
    category.setTimestamp(new Date());
    category.setOwner(fixture.findUserByName(ownerUid));
    category.setModifier(fixture.findUserByName(modifierUid));
    category.setAutoMakeAvailable(autoApprove);
    category.setDeleted(false);

    if (parentCategoryName != null) {
      CategoryEntity parentCategory = fixture.findCategoryByName(parentCategoryName);
      category.setParent(parentCategory);
    }
    return category;
  }