Beispiel #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;
  }
Beispiel #2
0
 public MenuItemEntity createPageMenuItem(
     String name,
     Integer order,
     String menuName,
     String displayName,
     String site,
     String owner,
     String modifier,
     boolean hasSection,
     Boolean isOrderedSection,
     String language,
     String parentName,
     Integer parentOrder,
     Date timestamp,
     boolean isHidden,
     Document xmlData) {
   MenuItemEntity menuItem = new MenuItemEntity();
   menuItem.setKey(new MenuItemKey(mockKeyService.generateNextKeySafe("TMENUITEM")));
   menuItem.setName(name);
   menuItem.setOrder(order);
   menuItem.setMenuName(menuName);
   menuItem.setDisplayName(displayName);
   menuItem.setSite(fixture.findSiteByName(site));
   menuItem.setOwner(fixture.findUserByName(owner));
   menuItem.setModifier(fixture.findUserByName(modifier));
   menuItem.setType(MenuItemType.PAGE);
   menuItem.setSection(hasSection);
   menuItem.setOrderedSection(isOrderedSection);
   menuItem.setLanguage(fixture.findLanguageByCode(language));
   if (parentName != null) {
     menuItem.setParent(fixture.findMenuItemByName(parentName));
   }
   menuItem.setTimestamp(timestamp == null ? new Date() : timestamp);
   menuItem.setHidden(isHidden);
   menuItem.setXmlData(xmlData);
   return menuItem;
 }
Beispiel #3
0
 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;
 }
Beispiel #4
0
 public CategoryAccessEntity createCategoryAccessForUser(
     String categoryName, String userName, String accesses) {
   UserEntity user = fixture.findUserByName(userName);
   return createCategoryAccess(categoryName, user.getUserGroup(), accesses);
 }
Beispiel #5
0
 public ContentVersionEntity createContentVersion(String status, String modiferQualifiedName) {
   ContentVersionEntity version = new ContentVersionEntity();
   version.setStatus(ContentStatus.get(Integer.valueOf(status)));
   version.setModifiedBy(fixture.findUserByName(modiferQualifiedName));
   return version;
 }