org.bonitasoft.engine.bdm.model.Query.getName()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(11.2k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中org.bonitasoft.engine.bdm.model.Query.getName方法的一些代码示例,展示了Query.getName的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getName方法的具体详情如下:
包路径:org.bonitasoft.engine.bdm.model.Query
类名称:Query
方法名:getName

Query.getName介绍

暂无

代码示例

代码示例来源:origin: bonitasoft/bonita-engine

private static boolean containsQueryWithName(final BusinessObject businessObject, final String queryName) {
  for (final Query q : businessObject.getQueries()) {
    if (Objects.equals(queryName, q.getName())) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: bonitasoft/bonita-engine

private static boolean containsQueryWithName(final BusinessObject businessObject, final String queryName) {
  for (final Query q : businessObject.getQueries()) {
    if (Objects.equals(queryName, q.getName())) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: bonitasoft/bonita-engine

private Query findRelatedCountQuery(Query baseQuery, List<Query> queryList) {
  Query countQuery = null;
  Iterator<Query> iterator = queryList.iterator();
  while (iterator.hasNext() && countQuery == null) {
    Query currentQuery = iterator.next();
    if (Long.class.getName().equals(currentQuery.getReturnType())
        && currentQuery.getName().equals(BDMQueryUtil.getCountQueryName(baseQuery.getName()))) {
      countQuery = currentQuery;
    }
  }
  return countQuery;
}

代码示例来源:origin: bonitasoft/bonita-engine

private Query findRelatedCountQuery(Query baseQuery, List<Query> queryList) {
  Query countQuery = null;
  Iterator<Query> iterator = queryList.iterator();
  while (iterator.hasNext() && countQuery == null) {
    Query currentQuery = iterator.next();
    if (Long.class.getName().equals(currentQuery.getReturnType())
        && currentQuery.getName().equals(BDMQueryUtil.getCountQueryName(baseQuery.getName()))) {
      countQuery = currentQuery;
    }
  }
  return countQuery;
}

代码示例来源:origin: bonitasoft/bonita-engine

private static void addQueryAndNameIfNotNull(List<Query> queries, Set<String> queryNames, Query query) {
  if (query != null) {
    addQueryIfNotNull(queries, query);
    queryNames.add(query.getName());
  }
}

代码示例来源:origin: bonitasoft/bonita-engine

private static void addQueryAndNameIfNotNull(List<Query> queries, Set<String> queryNames, Query query) {
  if (query != null) {
    addQueryIfNotNull(queries, query);
    queryNames.add(query.getName());
  }
}

代码示例来源:origin: bonitasoft/bonita-engine

private void validateQueries(final BusinessObject bo, final ValidationStatus status) {
  final Set<String> queryNames = BDMQueryUtil.getAllProvidedQueriesNameForBusinessObject(bo);
  Map<String, Serializable> context = new HashMap<>();
  context.put(StatusContext.BUSINESS_OBJECT_NAME_KEY, bo.getQualifiedName());
  for (final Query q : bo.getQueries()) {
    if (queryNames.contains(q.getName())) {
      context.put(StatusContext.BDM_ARTIFACT_NAME_KEY, q.getName());
      status.addError(StatusCode.DUPLICATE_QUERY_NAME,
          "The query named \"" + q.getName() + "\" already exists for " + bo.getQualifiedName(),
          context);
    } else {
      queryNames.add(q.getName());
    }
  }
}

代码示例来源:origin: bonitasoft/bonita-engine

private void validateQueries(final BusinessObject bo, final ValidationStatus status) {
  final Set<String> queryNames = BDMQueryUtil.getAllProvidedQueriesNameForBusinessObject(bo);
  Map<String, Serializable> context = new HashMap<>();
  context.put(StatusContext.BUSINESS_OBJECT_NAME_KEY, bo.getQualifiedName());
  for (final Query q : bo.getQueries()) {
    if (queryNames.contains(q.getName())) {
      context.put(StatusContext.BDM_ARTIFACT_NAME_KEY, q.getName());
      status.addError(StatusCode.DUPLICATE_QUERY_NAME,
          "The query named \"" + q.getName() + "\" already exists for " + bo.getQualifiedName(),
          context);
    } else {
      queryNames.add(q.getName());
    }
  }
}

代码示例来源:origin: bonitasoft/bonita-engine

private Query getQueryDefinition(BusinessObject businessObject, String className, final String queryName) throws SBusinessDataRepositoryException {
  final List<Query> allQueries = new ArrayList<>();
  allQueries.addAll(businessObject.getQueries());
  allQueries.addAll(BDMQueryUtil.createProvidedQueriesForBusinessObject(businessObject));
  for (final Query query : allQueries) {
    if (query.getName().equals(queryName)) {
      return query;
    }
  }
  throw new SBusinessDataRepositoryException("unable to get query " + queryName + " for business object " + className);
}

代码示例来源:origin: bonitasoft/bonita-engine

private Query getQueryDefinition(BusinessObject businessObject, String className, final String queryName) throws SBusinessDataRepositoryException {
  final List<Query> allQueries = new ArrayList<>();
  allQueries.addAll(businessObject.getQueries());
  allQueries.addAll(BDMQueryUtil.createProvidedQueriesForBusinessObject(businessObject));
  for (final Query query : allQueries) {
    if (query.getName().equals(queryName)) {
      return query;
    }
  }
  throw new SBusinessDataRepositoryException("unable to get query " + queryName + " for business object " + className);
}

代码示例来源:origin: bonitasoft/bonita-engine

private boolean ensureQueryIsDefinedInEntity(Class<? extends Entity> businessDataClass, Query countQueryDefinition) {
  final NamedQueries namedQueries = businessDataClass.getAnnotation(NamedQueries.class);
  if (namedQueries == null || countQueryDefinition == null) {
    return false;
  }
  for (NamedQuery namedQuery : namedQueries.value()) {
    if (namedQuery.name().equals(getQualifiedQueryName(businessDataClass, countQueryDefinition.getName()))) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: bonitasoft/bonita-engine

private boolean ensureQueryIsDefinedInEntity(Class<? extends Entity> businessDataClass, Query countQueryDefinition) {
  final NamedQueries namedQueries = businessDataClass.getAnnotation(NamedQueries.class);
  if (namedQueries == null || countQueryDefinition == null) {
    return false;
  }
  for (NamedQuery namedQuery : namedQueries.value()) {
    if (namedQuery.name().equals(getQualifiedQueryName(businessDataClass, countQueryDefinition.getName()))) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: bonitasoft/bonita-engine

private void addQueriesAnnotation(final BusinessObject bo, final JDefinedClass entityClass) {
  final JAnnotationUse namedQueriesAnnotation = codeGenerator.addAnnotation(entityClass, NamedQueries.class);
  final JAnnotationArrayMember valueArray = namedQueriesAnnotation.paramArray("value");
  // Add provided queries
  for (final Query providedQuery : BDMQueryUtil.createProvidedQueriesForBusinessObject(bo)) {
    addNamedQuery(entityClass, valueArray, providedQuery.getName(), providedQuery.getContent());
  }
  // Add method for lazy fields
  for (final Query query : BDMQueryUtil.createProvidedQueriesForLazyField(bom, bo)) {
    addNamedQuery(entityClass, valueArray, query.getName(), query.getContent());
  }
  // Add custom queries
  for (final Query query : bo.getQueries()) {
    addNamedQuery(entityClass, valueArray, query.getName(), query.getContent());
  }
}

代码示例来源:origin: bonitasoft/bonita-engine

private void addQueriesAnnotation(final BusinessObject bo, final JDefinedClass entityClass) {
  final JAnnotationUse namedQueriesAnnotation = codeGenerator.addAnnotation(entityClass, NamedQueries.class);
  final JAnnotationArrayMember valueArray = namedQueriesAnnotation.paramArray("value");
  // Add provided queries
  for (final Query providedQuery : BDMQueryUtil.createProvidedQueriesForBusinessObject(bo)) {
    addNamedQuery(entityClass, valueArray, providedQuery.getName(), providedQuery.getContent());
  }
  // Add method for lazy fields
  for (final Query query : BDMQueryUtil.createProvidedQueriesForLazyField(bom, bo)) {
    addNamedQuery(entityClass, valueArray, query.getName(), query.getContent());
  }
  // Add custom queries
  for (final Query query : bo.getQueries()) {
    addNamedQuery(entityClass, valueArray, query.getName(), query.getContent());
  }
}

代码示例来源:origin: bonitasoft/bonita-engine

public BusinessObjectBuilder withQuery(final Query query) {
  final Query addQuery = businessObject.addQuery(query.getName(), query.getContent(), query.getReturnType());
  for (final QueryParameter qP : query.getQueryParameters()) {
    addQuery.addQueryParameter(qP.getName(), qP.getClassName());
  }
  return this;
}

代码示例来源:origin: bonitasoft/bonita-engine

private void createDAOImpl(final BusinessObject bo, final JDefinedClass entity, final JDefinedClass daoInterface) throws JClassAlreadyExistsException {
  final String daoImplClassName = toDaoImplClassname(bo);
  final JDefinedClass implClass = addClass(daoImplClassName);
  implClass._implements(daoInterface);
  final JFieldVar businessDataRepository = addConstructor(implClass);
  // Add method for provided queries
  for (final Query q : BDMQueryUtil.createProvidedQueriesForBusinessObject(bo)) {
    final JMethod method = createMethodForQuery(entity, implClass, q);
    addQueryMethodBody(entity, method, q.getName(), businessDataRepository);
  }
  // Add method for queries
  for (final Query q : bo.getQueries()) {
    final JMethod method = createMethodForQuery(entity, implClass, q);
    addQueryMethodBody(entity, method, q.getName(), businessDataRepository);
  }
  final JMethod method = createMethodForNewInstance(bo, entity, implClass);
  addNewInstanceMethodBody(method, entity);
}

代码示例来源:origin: bonitasoft/bonita-engine

protected JMethod createMethodForQuery(final JDefinedClass entity, final JDefinedClass targetClass, final Query query) {
  final String methodName = query.getName();
  final JMethod queryMethod = createQueryMethod(entity, targetClass, methodName, query.getReturnType());
  for (final QueryParameter param : query.getQueryParameters()) {
    queryMethod.param(getModel().ref(param.getClassName()), param.getName());
  }
  addOptionalPaginationParameters(queryMethod, query);
  return queryMethod;
}

代码示例来源:origin: bonitasoft/bonita-engine

protected JMethod createMethodForQuery(final JDefinedClass entity, final JDefinedClass targetClass, final Query query) {
  final String methodName = query.getName();
  final JMethod queryMethod = createQueryMethod(entity, targetClass, methodName, query.getReturnType());
  for (final QueryParameter param : query.getQueryParameters()) {
    queryMethod.param(getModel().ref(param.getClassName()), param.getName());
  }
  addOptionalPaginationParameters(queryMethod, query);
  return queryMethod;
}

代码示例来源:origin: bonitasoft/bonita-engine

private void createDAOImpl(final BusinessObject bo, final JDefinedClass entity, final JDefinedClass daoInterface) throws JClassAlreadyExistsException {
  final String daoImplClassName = toDaoImplClassname(bo);
  final JDefinedClass implClass = addClass(daoImplClassName);
  implClass._implements(daoInterface);
  createConstructor(implClass);
  // Add method for provided queries
  for (final Query q : BDMQueryUtil.createProvidedQueriesForBusinessObject(bo)) {
    final JMethod method = createMethodForQuery(entity, implClass, q);
    addQueryMethodBody(entity.name(), method, q.getName(), entity.fullName(), q.getReturnType());
  }
  // Add method for queries
  for (final Query q : bo.getQueries()) {
    final JMethod method = createMethodForQuery(entity, implClass, q);
    addQueryMethodBody(entity.name(), method, q.getName(), entity.fullName(), q.getReturnType());
  }
  final JMethod method = createMethodForNewInstance(bo, entity, implClass);
  addNewInstanceMethodBody(method, entity);
}

代码示例来源:origin: bonitasoft/bonita-engine

private void createDAOImpl(final BusinessObject bo, final JDefinedClass entity, final JDefinedClass daoInterface) throws JClassAlreadyExistsException {
  final String daoImplClassName = toDaoImplClassname(bo);
  final JDefinedClass implClass = addClass(daoImplClassName);
  implClass._implements(daoInterface);
  createConstructor(implClass);
  // Add method for provided queries
  for (final Query q : BDMQueryUtil.createProvidedQueriesForBusinessObject(bo)) {
    final JMethod method = createMethodForQuery(entity, implClass, q);
    addQueryMethodBody(entity.name(), method, q.getName(), entity.fullName(), q.getReturnType());
  }
  // Add method for queries
  for (final Query q : bo.getQueries()) {
    final JMethod method = createMethodForQuery(entity, implClass, q);
    addQueryMethodBody(entity.name(), method, q.getName(), entity.fullName(), q.getReturnType());
  }
  final JMethod method = createMethodForNewInstance(bo, entity, implClass);
  addNewInstanceMethodBody(method, entity);
}

相关文章