Java Code Examples for javax.persistence.criteria.CriteriaBuilder#createTupleQuery()

The following examples show how to use javax.persistence.criteria.CriteriaBuilder#createTupleQuery() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StatsUserProblemHibernateDao.java    From judgels with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Map<String, Long> selectTotalScoresByProblemJids(Set<String> problemJids) {
    if (problemJids.isEmpty()) {
        return Collections.emptyMap();
    }

    CriteriaBuilder cb = currentSession().getCriteriaBuilder();
    CriteriaQuery<Tuple> cq = cb.createTupleQuery();
    Root<StatsUserProblemModel> root = cq.from(getEntityClass());

    cq.select(cb.tuple(
            root.get(StatsUserProblemModel_.problemJid),
            cb.sum(root.get(StatsUserProblemModel_.score))));

    cq.where(
            root.get(StatsUserProblemModel_.problemJid).in(problemJids));

    cq.groupBy(
            root.get(StatsUserProblemModel_.problemJid));

    return currentSession().createQuery(cq).getResultList()
            .stream()
            .collect(Collectors.toMap(tuple -> tuple.get(0, String.class), tuple -> tuple.get(1, Long.class)));
}
 
Example 2
Source File: StatsUserProblemHibernateDao.java    From judgels with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Map<String, Long> selectCountsAcceptedByProblemJids(Set<String> problemJids) {
    if (problemJids.isEmpty()) {
        return Collections.emptyMap();
    }

    CriteriaBuilder cb = currentSession().getCriteriaBuilder();
    CriteriaQuery<Tuple> cq = cb.createTupleQuery();
    Root<StatsUserProblemModel> root = cq.from(getEntityClass());

    cq.select(cb.tuple(
            root.get(StatsUserProblemModel_.problemJid),
            cb.count(root)));

    cq.where(
            cb.equal(root.get(StatsUserProblemModel_.verdict), Verdict.ACCEPTED.getCode()),
            root.get(StatsUserProblemModel_.problemJid).in(problemJids));

    cq.groupBy(
            root.get(StatsUserProblemModel_.problemJid));

    return currentSession().createQuery(cq).getResultList()
            .stream()
            .collect(Collectors.toMap(tuple -> tuple.get(0, String.class), tuple -> tuple.get(1, Long.class)));
}
 
Example 3
Source File: StatsUserProblemHibernateDao.java    From judgels with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Map<String, Long> selectCountsTriedByProblemJids(Set<String> problemJids) {
    if (problemJids.isEmpty()) {
        return Collections.emptyMap();
    }

    CriteriaBuilder cb = currentSession().getCriteriaBuilder();
    CriteriaQuery<Tuple> cq = cb.createTupleQuery();
    Root<StatsUserProblemModel> root = cq.from(getEntityClass());

    cq.select(cb.tuple(
            root.get(StatsUserProblemModel_.problemJid),
            cb.count(root)));

    cq.where(
            root.get(StatsUserProblemModel_.problemJid).in(problemJids));

    cq.groupBy(
            root.get(StatsUserProblemModel_.problemJid));

    return currentSession().createQuery(cq).getResultList()
            .stream()
            .collect(Collectors.toMap(tuple -> tuple.get(0, String.class), tuple -> tuple.get(1, Long.class)));
}
 
Example 4
Source File: StatsUserProblemHibernateDao.java    From judgels with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Map<String, Long> selectCountsVerdictByUserJid(String userJid) {
    CriteriaBuilder cb = currentSession().getCriteriaBuilder();
    CriteriaQuery<Tuple> cq = cb.createTupleQuery();
    Root<StatsUserProblemModel> root = cq.from(getEntityClass());

    cq.select(cb.tuple(
            root.get(StatsUserProblemModel_.verdict),
            cb.count(root)));

    cq.where(
            cb.equal(root.get(StatsUserProblemModel_.userJid), userJid));

    cq.groupBy(
            root.get(StatsUserProblemModel_.verdict));

    return currentSession().createQuery(cq).getResultList()
            .stream()
            .collect(Collectors.toMap(tuple -> tuple.get(0, String.class), tuple -> tuple.get(1, Long.class)));
}
 
Example 5
Source File: TestCriteriaFunction.java    From HibernateTips with MIT License 6 votes vote down vote up
@Test
public void callSizeFunction() {
	log.info("... callSizeFunction ...");

	EntityManager em = emf.createEntityManager();
	em.getTransaction().begin();

	CriteriaBuilder cb = em.getCriteriaBuilder();
	CriteriaQuery<Tuple> cq = cb.createTupleQuery();
	Root<Author> root = cq.from(Author.class);
	cq.multiselect(root, cb.size(root.get(Author_.books)));
	cq.groupBy(root.get(Author_.id));
	
	TypedQuery<Tuple> q = em.createQuery(cq);
	List<Tuple> results = q.getResultList();
	
	for (Tuple r :  results) {
		log.info(r.get(0) + " wrote " +  r.get(1) + " books.");
	}

	em.getTransaction().commit();
	em.close();
}
 
Example 6
Source File: TestMetamodel.java    From HibernateTips with MIT License 6 votes vote down vote up
@Test
public void getBooks() {
	log.info("... getBooks ...");

	EntityManager em = emf.createEntityManager();
	em.getTransaction().begin();

	CriteriaBuilder cb = em.getCriteriaBuilder();
	CriteriaQuery<Tuple> cq = cb.createTupleQuery();
	Root<Book> root = cq.from(Book.class);
	cq.multiselect(root.get(Book_.title), root.get(Book_.publishingDate));
			
	List<Tuple> results = em.createQuery(cq).getResultList();
	
	for (Tuple r : results) {
		log.info(r.get(0) + " was published on " + r.get(1));
	}
	
	em.getTransaction().commit();
	em.close();
}
 
Example 7
Source File: ProductMilestoneProviderImpl.java    From pnc with Apache License 2.0 6 votes vote down vote up
private CriteriaQuery<Tuple> milestoneInfoQuery(CriteriaBuilder cb, Set<Integer> milestoneIds) {
    CriteriaQuery<Tuple> query = cb.createTupleQuery();

    Root<org.jboss.pnc.model.ProductMilestone> milestone = query.from(org.jboss.pnc.model.ProductMilestone.class);
    Root<ProductRelease> release = query.from(ProductRelease.class);
    Path<ProductVersion> version = milestone.get(ProductMilestone_.productVersion);
    Path<Product> product = version.get(ProductVersion_.product);
    query.multiselect(
            product.get(Product_.id),
            product.get(Product_.name),
            version.get(ProductVersion_.id),
            version.get(ProductVersion_.version),
            milestone.get(ProductMilestone_.id),
            milestone.get(ProductMilestone_.version),
            milestone.get(ProductMilestone_.endDate),
            release.get(ProductRelease_.id),
            release.get(ProductRelease_.version),
            release.get(ProductRelease_.releaseDate));
    query.where(
            cb.and(cb.equal(release.get(ProductRelease_.productMilestone), milestone)),
            milestone.get(ProductMilestone_.id).in(milestoneIds));
    query.orderBy(cb.desc(milestone.get(ProductMilestone_.endDate)), cb.desc(milestone.get(ProductMilestone_.id)));
    return query;
}
 
Example 8
Source File: ChapterProblemHibernateDao.java    From judgels with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Map<String, Long> selectCountProgrammingByChapterJids(Set<String> chapterJids) {
    if (chapterJids.isEmpty()) {
        return Collections.emptyMap();
    }

    CriteriaBuilder cb = currentSession().getCriteriaBuilder();
    CriteriaQuery<Tuple> cq = cb.createTupleQuery();
    Root<ChapterProblemModel> root = cq.from(getEntityClass());

    cq.select(cb.tuple(
            root.get(ChapterProblemModel_.chapterJid),
            cb.count(root)));

    cq.where(
            cb.equal(root.get(ChapterProblemModel_.status), "VISIBLE"),
            cb.equal(root.get(ChapterProblemModel_.type), ProblemType.PROGRAMMING.name()),
            root.get(ChapterProblemModel_.chapterJid).in(chapterJids));

    cq.groupBy(
            root.get(ChapterProblemModel_.chapterJid));

    return currentSession().createQuery(cq).getResultList()
            .stream()
            .collect(Collectors.toMap(tuple -> tuple.get(0, String.class), tuple -> tuple.get(1, Long.class)));

}
 
Example 9
Source File: AbstractProgrammingSubmissionHibernateDao.java    From judgels with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Map<String, Long> selectCounts(String containerJid, String userJid, Set<String> problemJids) {
    if (problemJids.isEmpty()) {
        return Collections.emptyMap();
    }

    CriteriaBuilder cb = currentSession().getCriteriaBuilder();
    CriteriaQuery<Tuple> cq = cb.createTupleQuery();
    Root<M> root = cq.from(getEntityClass());

    cq.select(cb.tuple(
            root.get(AbstractProgrammingSubmissionModel_.problemJid),
            cb.count(root)));

    cq.where(
            cb.equal(root.get(AbstractProgrammingSubmissionModel_.containerJid), containerJid),
            cb.equal(root.get(JudgelsModel_.createdBy), userJid),
            root.get(AbstractProgrammingSubmissionModel_.problemJid).in(problemJids));

    cq.groupBy(
            root.get(AbstractProgrammingSubmissionModel_.containerJid),
            root.get(JudgelsModel_.createdBy),
            root.get(AbstractProgrammingSubmissionModel_.problemJid));

    return currentSession().createQuery(cq).getResultList()
            .stream()
            .collect(Collectors.toMap(tuple -> tuple.get(0, String.class), tuple -> tuple.get(1, Long.class)));
}
 
Example 10
Source File: ProblemSetProblemHibernateDao.java    From judgels with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Map<String, Long> selectCountsByProblemSetJids(Set<String> problemSetJids) {
    if (problemSetJids.isEmpty()) {
        return Collections.emptyMap();
    }

    CriteriaBuilder cb = currentSession().getCriteriaBuilder();
    CriteriaQuery<Tuple> cq = cb.createTupleQuery();
    Root<ProblemSetProblemModel> root = cq.from(getEntityClass());

    cq.select(cb.tuple(
            root.get(ProblemSetProblemModel_.problemSetJid),
            cb.count(root)));

    cq.where(
            cb.equal(root.get(ProblemSetProblemModel_.status), "VISIBLE"),
            cb.equal(root.get(ProblemSetProblemModel_.type), ProblemType.PROGRAMMING.name()),
            root.get(ProblemSetProblemModel_.problemSetJid).in(problemSetJids));

    cq.groupBy(
            root.get(ProblemSetProblemModel_.problemSetJid));

    return currentSession().createQuery(cq).getResultList()
            .stream()
            .collect(Collectors.toMap(tuple -> tuple.get(0, String.class), tuple -> tuple.get(1, Long.class)));

}
 
Example 11
Source File: SecurityRoleFunctionDaoImpl.java    From herd with Apache License 2.0 5 votes vote down vote up
@Override
public List<SecurityRoleFunctionKey> getSecurityRoleFunctionKeysBySecurityFunction(String securityFunctionName)
{
    // Create the criteria builder and a tuple style criteria query.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<Tuple> criteria = builder.createTupleQuery();

    // The criteria root is the security role to function mapping.
    Root<SecurityRoleFunctionEntity> securityRoleFunctionEntityRoot = criteria.from(SecurityRoleFunctionEntity.class);

    // Join to the other tables.
    Join<SecurityRoleFunctionEntity, SecurityRoleEntity> securityRoleEntityJoin =
        securityRoleFunctionEntityRoot.join(SecurityRoleFunctionEntity_.securityRole);
    Join<SecurityRoleFunctionEntity, SecurityFunctionEntity> securityFunctionEntityJoin =
        securityRoleFunctionEntityRoot.join(SecurityRoleFunctionEntity_.securityFunction);

    // Get the columns.
    Path<String> securityRoleNameColumn = securityRoleEntityJoin.get(SecurityRoleEntity_.code);
    Path<String> securityFunctionNameColumn = securityFunctionEntityJoin.get(SecurityFunctionEntity_.code);

    // Create the standard restrictions (i.e. the standard where clauses).
    Predicate queryRestriction =
        builder.equal(builder.upper(securityFunctionEntityJoin.get(SecurityFunctionEntity_.code)), securityFunctionName.toUpperCase());

    // Add all clauses to the query.
    criteria.multiselect(securityRoleNameColumn, securityFunctionNameColumn).where(queryRestriction).orderBy(builder.asc(securityRoleNameColumn));

    // Run the query to get a list of tuples back.
    List<Tuple> tuples = entityManager.createQuery(criteria).getResultList();

    // Populate the "keys" objects from the returned tuples (i.e. 1 tuple for each row).
    List<SecurityRoleFunctionKey> securityRoleFunctionKeys = new ArrayList<>();
    for (Tuple tuple : tuples)
    {
        securityRoleFunctionKeys.add(new SecurityRoleFunctionKey(tuple.get(securityRoleNameColumn), tuple.get(securityFunctionNameColumn)));
    }

    // Return the result list.
    return securityRoleFunctionKeys;
}
 
Example 12
Source File: StorageUnitNotificationRegistrationDaoImpl.java    From herd with Apache License 2.0 5 votes vote down vote up
@Override
public List<NotificationRegistrationKey> getStorageUnitNotificationRegistrationKeysByNamespace(String namespace)
{
    // Create the criteria builder and a tuple style criteria query.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<Tuple> criteria = builder.createTupleQuery();

    // The criteria root is the storage unit notification registration.
    Root<StorageUnitNotificationRegistrationEntity> businessObjectDataNotificationEntityRoot =
        criteria.from(StorageUnitNotificationRegistrationEntity.class);

    // Join to the other tables we can filter on.
    Join<StorageUnitNotificationRegistrationEntity, NamespaceEntity> namespaceEntityJoin =
        businessObjectDataNotificationEntityRoot.join(StorageUnitNotificationRegistrationEntity_.namespace);

    // Get the columns.
    Path<String> notificationRegistrationNamespaceColumn = namespaceEntityJoin.get(NamespaceEntity_.code);
    Path<String> notificationRegistrationNameColumn = businessObjectDataNotificationEntityRoot.get(StorageUnitNotificationRegistrationEntity_.name);

    // Create the standard restrictions (i.e. the standard where clauses).
    Predicate queryRestriction = builder.equal(builder.upper(namespaceEntityJoin.get(NamespaceEntity_.code)), namespace.toUpperCase());

    // Add the select clause.
    criteria.multiselect(notificationRegistrationNamespaceColumn, notificationRegistrationNameColumn);

    // Add the where clause.
    criteria.where(queryRestriction);

    // Add the order by clause.
    criteria.orderBy(builder.asc(notificationRegistrationNameColumn));

    // Run the query to get a list of tuples back.
    List<Tuple> tuples = entityManager.createQuery(criteria).getResultList();

    // Populate the list of keys from the returned tuples.
    return getNotificationRegistrationKeys(tuples, notificationRegistrationNamespaceColumn, notificationRegistrationNameColumn);
}
 
Example 13
Source File: CustomDdlDaoImpl.java    From herd with Apache License 2.0 4 votes vote down vote up
@Override
public List<CustomDdlKey> getCustomDdls(BusinessObjectFormatKey businessObjectFormatKey)
{
    // Create the criteria builder and a tuple style criteria query.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<Tuple> criteria = builder.createTupleQuery();

    // The criteria root is the business object format.
    Root<CustomDdlEntity> customDdlEntity = criteria.from(CustomDdlEntity.class);

    // Join to the other tables we can filter on.
    Join<CustomDdlEntity, BusinessObjectFormatEntity> businessObjectFormatEntity = customDdlEntity.join(CustomDdlEntity_.businessObjectFormat);
    Join<BusinessObjectFormatEntity, BusinessObjectDefinitionEntity> businessObjectDefinitionEntity = businessObjectFormatEntity.join(
        BusinessObjectFormatEntity_.businessObjectDefinition);
    Join<BusinessObjectFormatEntity, FileTypeEntity> fileTypeEntity = businessObjectFormatEntity.join(BusinessObjectFormatEntity_.fileType);
    Join<BusinessObjectDefinitionEntity, NamespaceEntity> namespaceEntity = businessObjectDefinitionEntity.join(BusinessObjectDefinitionEntity_.namespace);

    // Get the columns.
    Path<String> namespaceCodeColumn = namespaceEntity.get(NamespaceEntity_.code);
    Path<String> businessObjectDefinitionNameColumn = businessObjectDefinitionEntity.get(BusinessObjectDefinitionEntity_.name);
    Path<String> businessObjectFormatUsageColumn = businessObjectFormatEntity.get(BusinessObjectFormatEntity_.usage);
    Path<String> fileTypeCodeColumn = fileTypeEntity.get(FileTypeEntity_.code);
    Path<Integer> businessObjectFormatVersionColumn = businessObjectFormatEntity.get(BusinessObjectFormatEntity_.businessObjectFormatVersion);
    Path<String> customDdlNameColumn = customDdlEntity.get(CustomDdlEntity_.customDdlName);

    // Create the standard restrictions (i.e. the standard where clauses).
    Predicate queryRestriction = builder.equal(builder.upper(namespaceEntity.get(NamespaceEntity_.code)), businessObjectFormatKey.getNamespace()
        .toUpperCase());
    queryRestriction = builder.and(queryRestriction, builder.equal(builder.upper(businessObjectDefinitionEntity.get(BusinessObjectDefinitionEntity_.name)),
        businessObjectFormatKey.getBusinessObjectDefinitionName().toUpperCase()));
    queryRestriction = builder.and(queryRestriction, builder.equal(builder.upper(businessObjectFormatEntity.get(BusinessObjectFormatEntity_.usage)),
        businessObjectFormatKey.getBusinessObjectFormatUsage().toUpperCase()));
    queryRestriction = builder.and(queryRestriction, builder.equal(builder.upper(fileTypeEntity.get(FileTypeEntity_.code)), businessObjectFormatKey
        .getBusinessObjectFormatFileType().toUpperCase()));
    queryRestriction = builder.and(queryRestriction, builder.equal(businessObjectFormatEntity.get(BusinessObjectFormatEntity_.businessObjectFormatVersion),
        businessObjectFormatKey.getBusinessObjectFormatVersion()));

    // Add the select clause.
    criteria.multiselect(namespaceCodeColumn, businessObjectDefinitionNameColumn, businessObjectFormatUsageColumn, fileTypeCodeColumn,
        businessObjectFormatVersionColumn, customDdlNameColumn);

    // Add the where clause.
    criteria.where(queryRestriction);

    // Add the order by clause.
    criteria.orderBy(builder.asc(customDdlNameColumn));

    // Run the query to get a list of tuples back.
    List<Tuple> tuples = entityManager.createQuery(criteria).getResultList();

    // Populate the "keys" objects from the returned tuples (i.e. 1 tuple for each row).
    List<CustomDdlKey> customDdlKeys = new ArrayList<>();
    for (Tuple tuple : tuples)
    {
        CustomDdlKey customDdlKey = new CustomDdlKey();
        customDdlKeys.add(customDdlKey);
        customDdlKey.setNamespace(tuple.get(namespaceCodeColumn));
        customDdlKey.setBusinessObjectDefinitionName(tuple.get(businessObjectDefinitionNameColumn));
        customDdlKey.setBusinessObjectFormatUsage(tuple.get(businessObjectFormatUsageColumn));
        customDdlKey.setBusinessObjectFormatFileType(tuple.get(fileTypeCodeColumn));
        customDdlKey.setBusinessObjectFormatVersion(tuple.get(businessObjectFormatVersionColumn));
        customDdlKey.setCustomDdlName(tuple.get(customDdlNameColumn));
    }

    return customDdlKeys;
}
 
Example 14
Source File: BusinessObjectFormatDaoImpl.java    From herd with Apache License 2.0 4 votes vote down vote up
@Override
public List<BusinessObjectFormatKey> getBusinessObjectFormatsWithFilters(BusinessObjectDefinitionKey businessObjectDefinitionKey,
    String businessObjectFormatUsage, boolean latestBusinessObjectFormatVersion)
{
    // Create the criteria builder and a tuple style criteria query.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<Tuple> criteria = builder.createTupleQuery();

    // The criteria root is the business object format.
    Root<BusinessObjectFormatEntity> businessObjectFormatEntity = criteria.from(BusinessObjectFormatEntity.class);

    // Join to the other tables we can filter on.
    Join<BusinessObjectFormatEntity, BusinessObjectDefinitionEntity> businessObjectDefinitionEntity =
        businessObjectFormatEntity.join(BusinessObjectFormatEntity_.businessObjectDefinition);
    Join<BusinessObjectFormatEntity, FileTypeEntity> fileTypeEntity = businessObjectFormatEntity.join(BusinessObjectFormatEntity_.fileType);
    Join<BusinessObjectDefinitionEntity, NamespaceEntity> namespaceEntity = businessObjectDefinitionEntity.join(BusinessObjectDefinitionEntity_.namespace);

    // Get the columns.
    Path<String> namespaceCodeColumn = namespaceEntity.get(NamespaceEntity_.code);
    Path<String> businessObjectDefinitionNameColumn = businessObjectDefinitionEntity.get(BusinessObjectDefinitionEntity_.name);
    Path<String> businessObjectFormatUsageColumn = businessObjectFormatEntity.get(BusinessObjectFormatEntity_.usage);
    Path<String> fileTypeCodeColumn = fileTypeEntity.get(FileTypeEntity_.code);
    Path<Integer> businessObjectFormatVersionColumn = businessObjectFormatEntity.get(BusinessObjectFormatEntity_.businessObjectFormatVersion);
    Expression<Integer> maxBusinessObjectFormatVersionExpression =
        builder.max(businessObjectFormatEntity.get(BusinessObjectFormatEntity_.businessObjectFormatVersion));

    // Create the standard restrictions (i.e. the standard where clauses).
    Predicate queryRestriction =
        builder.equal(builder.upper(namespaceEntity.get(NamespaceEntity_.code)), businessObjectDefinitionKey.getNamespace().toUpperCase());
    queryRestriction = builder.and(queryRestriction, builder.equal(builder.upper(businessObjectDefinitionEntity.get(BusinessObjectDefinitionEntity_.name)),
        businessObjectDefinitionKey.getBusinessObjectDefinitionName().toUpperCase()));

    // Add the business object format usage where parameter is not empty
    if (StringUtils.isNotEmpty(businessObjectFormatUsage))
    {
        queryRestriction = builder.and(queryRestriction,
            builder.equal(builder.upper(businessObjectFormatEntity.get(BusinessObjectFormatEntity_.usage)), businessObjectFormatUsage.toUpperCase()));
    }

    // Add the select clause.
    criteria.multiselect(namespaceCodeColumn, businessObjectDefinitionNameColumn, businessObjectFormatUsageColumn, fileTypeCodeColumn,
        latestBusinessObjectFormatVersion ? maxBusinessObjectFormatVersionExpression : businessObjectFormatVersionColumn);

    // Add the where clause.
    criteria.where(queryRestriction);

    // If only the latest (maximum) business object format versions to be returned, create and apply the group by clause.
    if (latestBusinessObjectFormatVersion)
    {
        List<Expression<?>> grouping = new ArrayList<>();
        grouping.add(namespaceCodeColumn);
        grouping.add(businessObjectDefinitionNameColumn);
        grouping.add(businessObjectFormatUsageColumn);
        grouping.add(fileTypeCodeColumn);
        criteria.groupBy(grouping);
    }

    // Add the order by clause.
    List<Order> orderBy = new ArrayList<>();
    orderBy.add(builder.asc(businessObjectFormatUsageColumn));
    orderBy.add(builder.asc(fileTypeCodeColumn));
    if (!latestBusinessObjectFormatVersion)
    {
        orderBy.add(builder.asc(businessObjectFormatVersionColumn));
    }
    criteria.orderBy(orderBy);

    // Run the query to get a list of tuples back.
    List<Tuple> tuples = entityManager.createQuery(criteria).getResultList();

    // Populate the "keys" objects from the returned tuples (i.e. 1 tuple for each row).
    List<BusinessObjectFormatKey> businessObjectFormatKeys = new ArrayList<>();
    for (Tuple tuple : tuples)
    {
        BusinessObjectFormatKey businessObjectFormatKey = new BusinessObjectFormatKey();
        businessObjectFormatKeys.add(businessObjectFormatKey);
        businessObjectFormatKey.setNamespace(tuple.get(namespaceCodeColumn));
        businessObjectFormatKey.setBusinessObjectDefinitionName(tuple.get(businessObjectDefinitionNameColumn));
        businessObjectFormatKey.setBusinessObjectFormatUsage(tuple.get(businessObjectFormatUsageColumn));
        businessObjectFormatKey.setBusinessObjectFormatFileType(tuple.get(fileTypeCodeColumn));
        businessObjectFormatKey.setBusinessObjectFormatVersion(
            tuple.get(latestBusinessObjectFormatVersion ? maxBusinessObjectFormatVersionExpression : businessObjectFormatVersionColumn));
    }

    return businessObjectFormatKeys;
}
 
Example 15
Source File: BusinessObjectDefinitionTagDaoImpl.java    From herd with Apache License 2.0 4 votes vote down vote up
@Override
public List<BusinessObjectDefinitionTagKey> getBusinessObjectDefinitionTagsByTagEntities(List<TagEntity> tagEntities)
{
    // Create the criteria builder and a tuple style criteria query.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<Tuple> criteria = builder.createTupleQuery();

    // The criteria root is the business object definition tag entity.
    Root<BusinessObjectDefinitionTagEntity> businessObjectDefinitionTagEntityRoot = criteria.from(BusinessObjectDefinitionTagEntity.class);

    // Join to the other tables we can filter on.
    Join<BusinessObjectDefinitionTagEntity, BusinessObjectDefinitionEntity> businessObjectDefinitionEntityJoin =
        businessObjectDefinitionTagEntityRoot.join(BusinessObjectDefinitionTagEntity_.businessObjectDefinition);
    Join<BusinessObjectDefinitionEntity, NamespaceEntity> namespaceEntityJoin =
        businessObjectDefinitionEntityJoin.join(BusinessObjectDefinitionEntity_.namespace);
    Join<BusinessObjectDefinitionTagEntity, TagEntity> tagEntityJoin = businessObjectDefinitionTagEntityRoot.join(BusinessObjectDefinitionTagEntity_.tag);
    Join<TagEntity, TagTypeEntity> tagTypeEntityJoin = tagEntityJoin.join(TagEntity_.tagType);

    // Get the columns.
    Path<String> namespaceCodeColumn = namespaceEntityJoin.get(NamespaceEntity_.code);
    Path<String> businessObjectDefinitionNameColumn = businessObjectDefinitionEntityJoin.get(BusinessObjectDefinitionEntity_.name);
    Path<String> businessObjectDefinitionDisplayNameColumn = businessObjectDefinitionEntityJoin.get(BusinessObjectDefinitionEntity_.displayName);
    Path<String> tagTypeCodeColumn = tagTypeEntityJoin.get(TagTypeEntity_.code);
    Path<String> tagCodeColumn = tagEntityJoin.get(TagEntity_.tagCode);
    Path<String> tagDisplayNameColumn = tagEntityJoin.get(TagEntity_.displayName);

    // Create the standard restrictions (i.e. the standard where clauses).
    Predicate predicate = getPredicateForInClause(builder, businessObjectDefinitionTagEntityRoot.get(BusinessObjectDefinitionTagEntity_.tag), tagEntities);

    // Order the results by business object definition display name (an optional column),
    // business object definition namespace, business object definition name, tag display name,
    // and tag type code (since tag display name is unique across a tag type).
    List<Order> orderBy = new ArrayList<>();
    orderBy.add(builder.asc(businessObjectDefinitionDisplayNameColumn));
    orderBy.add(builder.asc(namespaceCodeColumn));
    orderBy.add(builder.asc(businessObjectDefinitionNameColumn));
    orderBy.add(builder.asc(tagDisplayNameColumn));
    orderBy.add(builder.asc(tagTypeCodeColumn));

    // Add the clauses for the query.
    criteria.multiselect(namespaceCodeColumn, businessObjectDefinitionNameColumn, tagTypeCodeColumn, tagCodeColumn).where(predicate).orderBy(orderBy);

    // Run the query to get a list of tuples back.
    List<Tuple> tuples = entityManager.createQuery(criteria).getResultList();

    // Populate the "keys" objects from the returned tuples (i.e. 1 tuple for each row).
    List<BusinessObjectDefinitionTagKey> businessObjectDefinitionTagKeys = new ArrayList<>();
    for (Tuple tuple : tuples)
    {
        businessObjectDefinitionTagKeys.add(new BusinessObjectDefinitionTagKey(
            new BusinessObjectDefinitionKey(tuple.get(namespaceCodeColumn), tuple.get(businessObjectDefinitionNameColumn)),
            new TagKey(tuple.get(tagTypeCodeColumn), tuple.get(tagCodeColumn))));
    }

    return businessObjectDefinitionTagKeys;
}
 
Example 16
Source File: StorageUnitNotificationRegistrationDaoImpl.java    From herd with Apache License 2.0 4 votes vote down vote up
@Override
public List<NotificationRegistrationKey> getStorageUnitNotificationRegistrationKeysByNotificationFilter(
    StorageUnitNotificationFilter businessObjectDataNotificationFilter)
{
    // Create the criteria builder and a tuple style criteria query.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<Tuple> criteria = builder.createTupleQuery();

    // The criteria root is the storage unit notification registration.
    Root<StorageUnitNotificationRegistrationEntity> notificationRegistrationEntityRoot = criteria.from(StorageUnitNotificationRegistrationEntity.class);

    // Join to the other tables we can filter on.
    Join<StorageUnitNotificationRegistrationEntity, NamespaceEntity> notificationRegistrationNamespaceEntityJoin =
        notificationRegistrationEntityRoot.join(StorageUnitNotificationRegistrationEntity_.namespace);
    Join<StorageUnitNotificationRegistrationEntity, BusinessObjectDefinitionEntity> businessObjectDefinitionEntity =
        notificationRegistrationEntityRoot.join(StorageUnitNotificationRegistrationEntity_.businessObjectDefinition);
    Join<BusinessObjectDefinitionEntity, NamespaceEntity> businessObjectDefinitionNamespaceEntity =
        businessObjectDefinitionEntity.join(BusinessObjectDefinitionEntity_.namespace);
    Join<StorageUnitNotificationRegistrationEntity, FileTypeEntity> fileTypeEntity =
        notificationRegistrationEntityRoot.join(StorageUnitNotificationRegistrationEntity_.fileType, JoinType.LEFT);

    // Get the columns.
    Path<String> notificationRegistrationNamespaceColumn = notificationRegistrationNamespaceEntityJoin.get(NamespaceEntity_.code);
    Path<String> notificationRegistrationNameColumn = notificationRegistrationEntityRoot.get(StorageUnitNotificationRegistrationEntity_.name);

    // Create the standard restrictions (i.e. the standard where clauses).
    List<Predicate> predicates = new ArrayList<>();
    predicates.add(builder.equal(builder.upper(businessObjectDefinitionNamespaceEntity.get(NamespaceEntity_.code)),
        businessObjectDataNotificationFilter.getNamespace().toUpperCase()));
    predicates.add(builder.equal(builder.upper(businessObjectDefinitionEntity.get(BusinessObjectDefinitionEntity_.name)),
        businessObjectDataNotificationFilter.getBusinessObjectDefinitionName().toUpperCase()));
    if (StringUtils.isNotBlank(businessObjectDataNotificationFilter.getBusinessObjectFormatUsage()))
    {
        predicates.add(builder.or(builder.isNull(notificationRegistrationEntityRoot.get(StorageUnitNotificationRegistrationEntity_.usage)), builder
            .equal(builder.upper(notificationRegistrationEntityRoot.get(StorageUnitNotificationRegistrationEntity_.usage)),
                businessObjectDataNotificationFilter.getBusinessObjectFormatUsage().toUpperCase())));
    }
    if (StringUtils.isNotBlank(businessObjectDataNotificationFilter.getBusinessObjectFormatFileType()))
    {
        predicates.add(builder.or(builder.isNull(notificationRegistrationEntityRoot.get(StorageUnitNotificationRegistrationEntity_.fileType)), builder
            .equal(builder.upper(fileTypeEntity.get(FileTypeEntity_.code)),
                businessObjectDataNotificationFilter.getBusinessObjectFormatFileType().toUpperCase())));
    }

    // Add the select and where clauses to the query.
    criteria.multiselect(notificationRegistrationNamespaceColumn, notificationRegistrationNameColumn)
        .where(builder.and(predicates.toArray(new Predicate[predicates.size()])));

    // Add the order by clause to the query.
    criteria.orderBy(builder.asc(notificationRegistrationNamespaceColumn), builder.asc(notificationRegistrationNameColumn));

    // Run the query to get a list of tuples back.
    List<Tuple> tuples = entityManager.createQuery(criteria).getResultList();

    // Populate the list of keys from the returned tuples.
    return getNotificationRegistrationKeys(tuples, notificationRegistrationNamespaceColumn, notificationRegistrationNameColumn);
}
 
Example 17
Source File: BusinessObjectDataNotificationRegistrationDaoImpl.java    From herd with Apache License 2.0 4 votes vote down vote up
@Override
public List<NotificationRegistrationKey> getBusinessObjectDataNotificationRegistrationKeysByNotificationFilter(
    BusinessObjectDataNotificationFilter businessObjectDataNotificationFilter)
{
    // Create the criteria builder and a tuple style criteria query.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<Tuple> criteria = builder.createTupleQuery();

    // The criteria root is the business object data notification registration.
    Root<BusinessObjectDataNotificationRegistrationEntity> notificationRegistrationEntityRoot =
        criteria.from(BusinessObjectDataNotificationRegistrationEntity.class);

    // Join to the other tables we can filter on.
    Join<BusinessObjectDataNotificationRegistrationEntity, NamespaceEntity> notificationRegistrationNamespaceEntityJoin =
        notificationRegistrationEntityRoot.join(BusinessObjectDataNotificationRegistrationEntity_.namespace);
    Join<BusinessObjectDataNotificationRegistrationEntity, BusinessObjectDefinitionEntity> businessObjectDefinitionEntity =
        notificationRegistrationEntityRoot.join(BusinessObjectDataNotificationRegistrationEntity_.businessObjectDefinition);
    Join<BusinessObjectDefinitionEntity, NamespaceEntity> businessObjectDefinitionNamespaceEntity =
        businessObjectDefinitionEntity.join(BusinessObjectDefinitionEntity_.namespace);
    Join<BusinessObjectDataNotificationRegistrationEntity, FileTypeEntity> fileTypeEntity =
        notificationRegistrationEntityRoot.join(BusinessObjectDataNotificationRegistrationEntity_.fileType, JoinType.LEFT);

    // Get the columns.
    Path<String> notificationRegistrationNamespaceColumn = notificationRegistrationNamespaceEntityJoin.get(NamespaceEntity_.code);
    Path<String> notificationRegistrationNameColumn = notificationRegistrationEntityRoot.get(BusinessObjectDataNotificationRegistrationEntity_.name);

    // Create the standard restrictions (i.e. the standard where clauses).
    List<Predicate> predicates = new ArrayList<>();
    predicates.add(builder.equal(builder.upper(businessObjectDefinitionNamespaceEntity.get(NamespaceEntity_.code)),
        businessObjectDataNotificationFilter.getNamespace().toUpperCase()));
    predicates.add(builder.equal(builder.upper(businessObjectDefinitionEntity.get(BusinessObjectDefinitionEntity_.name)),
        businessObjectDataNotificationFilter.getBusinessObjectDefinitionName().toUpperCase()));
    if (StringUtils.isNotBlank(businessObjectDataNotificationFilter.getBusinessObjectFormatUsage()))
    {
        predicates.add(builder.or(builder.isNull(notificationRegistrationEntityRoot.get(BusinessObjectDataNotificationRegistrationEntity_.usage)), builder
            .equal(builder.upper(notificationRegistrationEntityRoot.get(BusinessObjectDataNotificationRegistrationEntity_.usage)),
                businessObjectDataNotificationFilter.getBusinessObjectFormatUsage().toUpperCase())));
    }
    if (StringUtils.isNotBlank(businessObjectDataNotificationFilter.getBusinessObjectFormatFileType()))
    {
        predicates.add(builder.or(builder.isNull(notificationRegistrationEntityRoot.get(BusinessObjectDataNotificationRegistrationEntity_.fileType)),
            builder.equal(builder.upper(fileTypeEntity.get(FileTypeEntity_.code)),
                businessObjectDataNotificationFilter.getBusinessObjectFormatFileType().toUpperCase())));
    }

    // Add the select and where clauses to the query.
    criteria.multiselect(notificationRegistrationNamespaceColumn, notificationRegistrationNameColumn)
        .where(builder.and(predicates.toArray(new Predicate[predicates.size()])));

    // Add the order by clause to the query.
    criteria.orderBy(builder.asc(notificationRegistrationNamespaceColumn), builder.asc(notificationRegistrationNameColumn));

    // Run the query to get a list of tuples back.
    List<Tuple> tuples = entityManager.createQuery(criteria).getResultList();

    // Populate the list of keys from the returned tuples.
    return getNotificationRegistrationKeys(tuples, notificationRegistrationNamespaceColumn, notificationRegistrationNameColumn);
}
 
Example 18
Source File: BusinessObjectDefinitionTagDaoImpl.java    From herd with Apache License 2.0 4 votes vote down vote up
@Override
public List<BusinessObjectDefinitionTagKey> getBusinessObjectDefinitionTagsByBusinessObjectDefinitionEntity(
    BusinessObjectDefinitionEntity businessObjectDefinitionEntity)
{
    // Create the criteria builder and a tuple style criteria query.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<Tuple> criteria = builder.createTupleQuery();

    // The criteria root is the business object definition.
    Root<TagEntity> tagEntityRoot = criteria.from(TagEntity.class);

    // Join to the other tables we can filter on.
    Join<TagEntity, TagTypeEntity> tagTypeEntityJoin = tagEntityRoot.join(TagEntity_.tagType);
    Join<TagEntity, BusinessObjectDefinitionTagEntity> businessObjectDefinitionTagEntityJoin = tagEntityRoot.join(TagEntity_.businessObjectDefinitionTags);
    Join<BusinessObjectDefinitionTagEntity, BusinessObjectDefinitionEntity> businessObjectDefinitionEntityJoin =
        businessObjectDefinitionTagEntityJoin.join(BusinessObjectDefinitionTagEntity_.businessObjectDefinition);

    // Get the columns.
    Path<String> tagTypeCodeColumn = tagTypeEntityJoin.get(TagTypeEntity_.code);
    Path<String> tagCodeColumn = tagEntityRoot.get(TagEntity_.tagCode);
    Path<String> tagDisplayNameColumn = tagEntityRoot.get(TagEntity_.displayName);

    // Create the standard restrictions (i.e. the standard where clauses).
    List<Predicate> predicates = new ArrayList<>();
    predicates.add(builder.equal(businessObjectDefinitionEntityJoin, businessObjectDefinitionEntity));

    // Add the clauses for the query.
    criteria.multiselect(tagTypeCodeColumn, tagCodeColumn).where(builder.and(predicates.toArray(new Predicate[predicates.size()])))
        .orderBy(builder.asc(tagDisplayNameColumn));

    // Run the query to get a list of tuples back.
    List<Tuple> tuples = entityManager.createQuery(criteria).getResultList();

    // Get the business object definition key.
    BusinessObjectDefinitionKey businessObjectDefinitionKey =
        new BusinessObjectDefinitionKey(businessObjectDefinitionEntity.getNamespace().getCode(), businessObjectDefinitionEntity.getName());

    // Populate the "keys" objects from the returned tuples (i.e. 1 tuple for each row).
    List<BusinessObjectDefinitionTagKey> businessObjectDefinitionTagKeys = new ArrayList<>();
    for (Tuple tuple : tuples)
    {
        businessObjectDefinitionTagKeys
            .add(new BusinessObjectDefinitionTagKey(businessObjectDefinitionKey, new TagKey(tuple.get(tagTypeCodeColumn), tuple.get(tagCodeColumn))));
    }

    return businessObjectDefinitionTagKeys;
}
 
Example 19
Source File: BusinessObjectDataDaoImpl.java    From herd with Apache License 2.0 4 votes vote down vote up
@Override
public Map<BusinessObjectDataEntity, StoragePolicyEntity> getBusinessObjectDataEntitiesMatchingStoragePolicies(
    StoragePolicyPriorityLevel storagePolicyPriorityLevel, List<String> supportedBusinessObjectDataStatuses, int storagePolicyTransitionMaxAllowedAttempts,
    int startPosition, int maxResult)
{
    // Create the criteria builder and a tuple style criteria query.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<Tuple> criteria = builder.createTupleQuery();

    // The criteria root is the business object data along with the storage policy.
    Root<BusinessObjectDataEntity> businessObjectDataEntityRoot = criteria.from(BusinessObjectDataEntity.class);
    Root<StoragePolicyEntity> storagePolicyEntityRoot = criteria.from(StoragePolicyEntity.class);

    // Join to the other tables we can filter on.
    Join<BusinessObjectDataEntity, StorageUnitEntity> storageUnitEntityJoin = businessObjectDataEntityRoot.join(BusinessObjectDataEntity_.storageUnits);
    Join<BusinessObjectDataEntity, BusinessObjectFormatEntity> businessObjectFormatEntityJoin =
        businessObjectDataEntityRoot.join(BusinessObjectDataEntity_.businessObjectFormat);

    // Create main query restrictions based on the specified parameters.
    List<Predicate> predicates = new ArrayList<>();

    // Add restriction on business object definition.
    predicates.add(storagePolicyPriorityLevel.isBusinessObjectDefinitionIsNull() ?
        builder.isNull(storagePolicyEntityRoot.get(StoragePolicyEntity_.businessObjectDefinitionId)) : builder
        .equal(businessObjectFormatEntityJoin.get(BusinessObjectFormatEntity_.businessObjectDefinitionId),
            storagePolicyEntityRoot.get(StoragePolicyEntity_.businessObjectDefinitionId)));

    // Add restriction on business object format usage.
    predicates.add(storagePolicyPriorityLevel.isUsageIsNull() ? builder.isNull(storagePolicyEntityRoot.get(StoragePolicyEntity_.usage)) : builder
        .equal(builder.upper(businessObjectFormatEntityJoin.get(BusinessObjectFormatEntity_.usage)),
            builder.upper(storagePolicyEntityRoot.get(StoragePolicyEntity_.usage))));

    // Add restriction on business object format file type.
    predicates.add(storagePolicyPriorityLevel.isFileTypeIsNull() ? builder.isNull(storagePolicyEntityRoot.get(StoragePolicyEntity_.fileType)) : builder
        .equal(businessObjectFormatEntityJoin.get(BusinessObjectFormatEntity_.fileTypeCode),
            storagePolicyEntityRoot.get(StoragePolicyEntity_.fileTypeCode)));

    // Add restriction on storage policy filter storage.
    predicates.add(builder.equal(storageUnitEntityJoin.get(StorageUnitEntity_.storageName), storagePolicyEntityRoot.get(StoragePolicyEntity_.storageName)));

    // Add restriction on storage policy latest version flag.
    predicates.add(builder.isTrue(storagePolicyEntityRoot.get(StoragePolicyEntity_.latestVersion)));

    // Add restriction on storage policy status.
    predicates.add(builder.equal(storagePolicyEntityRoot.get(StoragePolicyEntity_.statusCode), StoragePolicyStatusEntity.ENABLED));

    // Add restriction on supported business object data statuses.
    predicates.add(businessObjectDataEntityRoot.get(BusinessObjectDataEntity_.statusCode).in(supportedBusinessObjectDataStatuses));

    // Add restrictions as per storage policy transition type.
    predicates
        .add(builder.equal(storagePolicyEntityRoot.get(StoragePolicyEntity_.storagePolicyTransitionTypeCode), StoragePolicyTransitionTypeEntity.GLACIER));
    predicates.add(storageUnitEntityJoin.get(StorageUnitEntity_.statusCode)
        .in(Lists.newArrayList(StorageUnitStatusEntity.ENABLED, StorageUnitStatusEntity.ARCHIVING)));

    // If specified, add restriction on maximum allowed attempts for a storage policy transition.
    if (storagePolicyTransitionMaxAllowedAttempts > 0)
    {
        predicates.add(builder.or(builder.isNull(storageUnitEntityJoin.get(StorageUnitEntity_.storagePolicyTransitionFailedAttempts)), builder
            .lessThan(storageUnitEntityJoin.get(StorageUnitEntity_.storagePolicyTransitionFailedAttempts), storagePolicyTransitionMaxAllowedAttempts)));
    }

    // Order the results by business object data "created on" value.
    Order orderByCreatedOn = builder.asc(businessObjectDataEntityRoot.get(BusinessObjectDataEntity_.createdOn));

    // Add the select clause to the main query.
    criteria.multiselect(businessObjectDataEntityRoot, storagePolicyEntityRoot);

    // Add the where clause to the main query.
    criteria.where(predicates.toArray(new Predicate[] {}));

    // Add the order by clause to the main query.
    criteria.orderBy(orderByCreatedOn);

    // Run the query to get a list of tuples back.
    List<Tuple> tuples = entityManager.createQuery(criteria).setFirstResult(startPosition).setMaxResults(maxResult).getResultList();

    // Populate the result map from the returned tuples (i.e. 1 tuple for each row).
    Map<BusinessObjectDataEntity, StoragePolicyEntity> result = new LinkedHashMap<>();
    for (Tuple tuple : tuples)
    {
        // Since multiple storage policies can contain identical filters, we add the below check to select each business object data instance only once.
        if (!result.containsKey(tuple.get(businessObjectDataEntityRoot)))
        {
            result.put(tuple.get(businessObjectDataEntityRoot), tuple.get(storagePolicyEntityRoot));
        }
    }

    return result;
}
 
Example 20
Source File: BusinessObjectDefinitionDaoImpl.java    From herd with Apache License 2.0 4 votes vote down vote up
@Override
public List<BusinessObjectDefinitionKey> getBusinessObjectDefinitionKeysByNamespace(String namespaceCode)
{
    // Create the criteria builder and a tuple style criteria query.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<Tuple> criteria = builder.createTupleQuery();

    // The criteria root is the business object definition.
    Root<BusinessObjectDefinitionEntity> businessObjectDefinitionEntity = criteria.from(BusinessObjectDefinitionEntity.class);

    // Join to the other tables we can filter on.
    Join<BusinessObjectDefinitionEntity, NamespaceEntity> namespaceEntity = businessObjectDefinitionEntity.join(BusinessObjectDefinitionEntity_.namespace);

    // Get the columns.
    Path<String> namespaceCodeColumn = namespaceEntity.get(NamespaceEntity_.code);
    Path<String> businessObjectDefinitionNameColumn = businessObjectDefinitionEntity.get(BusinessObjectDefinitionEntity_.name);

    // Add the select clause.
    criteria.multiselect(namespaceCodeColumn, businessObjectDefinitionNameColumn);

    // If namespace code is specified, add the where clause.
    if (StringUtils.isNotBlank(namespaceCode))
    {
        criteria.where(builder.equal(builder.upper(namespaceEntity.get(NamespaceEntity_.code)), namespaceCode.toUpperCase()));
    }

    // Add the order by clause.
    if (StringUtils.isNotBlank(namespaceCode))
    {
        criteria.orderBy(builder.asc(businessObjectDefinitionNameColumn));
    }
    else
    {
        criteria.orderBy(builder.asc(businessObjectDefinitionNameColumn), builder.asc(namespaceCodeColumn));
    }

    // Run the query to get a list of tuples back.
    List<Tuple> tuples = entityManager.createQuery(criteria).getResultList();

    // Populate the "keys" objects from the returned tuples (i.e. 1 tuple for each row).
    List<BusinessObjectDefinitionKey> businessObjectDefinitionKeys = new ArrayList<>();
    for (Tuple tuple : tuples)
    {
        BusinessObjectDefinitionKey businessObjectDefinitionKey = new BusinessObjectDefinitionKey();
        businessObjectDefinitionKeys.add(businessObjectDefinitionKey);
        businessObjectDefinitionKey.setNamespace(tuple.get(namespaceCodeColumn));
        businessObjectDefinitionKey.setBusinessObjectDefinitionName(tuple.get(businessObjectDefinitionNameColumn));
    }

    return businessObjectDefinitionKeys;
}