本文整理了Java中org.bonitasoft.engine.bdm.model.Query.getReturnType
方法的一些代码示例,展示了Query.getReturnType
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getReturnType
方法的具体详情如下:
包路径:org.bonitasoft.engine.bdm.model.Query
类名称:Query
方法名:getReturnType
暂无
代码示例来源:origin: bonitasoft/bonita-engine
private Class<? extends Serializable> getQueryReturnType(final Query queryDefinition, final String entityClassName)
throws SBusinessDataRepositoryException {
if (queryDefinition.hasMultipleResults()) {
return loadClass(entityClassName);
}
try {
return (Class<? extends Serializable>) Thread.currentThread().getContextClassLoader().loadClass(queryDefinition.getReturnType());
} catch (final ClassNotFoundException e) {
throw new SBusinessDataRepositoryException("unable to load class " + queryDefinition.getReturnType());
}
}
代码示例来源:origin: bonitasoft/bonita-engine
private Class<? extends Serializable> getQueryReturnType(final Query queryDefinition, final String entityClassName)
throws SBusinessDataRepositoryException {
if (queryDefinition.hasMultipleResults()) {
return loadClass(entityClassName);
}
try {
return (Class<? extends Serializable>) Thread.currentThread().getContextClassLoader().loadClass(queryDefinition.getReturnType());
} catch (final ClassNotFoundException e) {
throw new SBusinessDataRepositoryException("unable to load class " + queryDefinition.getReturnType());
}
}
代码示例来源: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
@Override
public ValidationStatus validate(final Query query) {
final ValidationStatus status = new ValidationStatus();
final String name = query.getName();
if (name == null || name.isEmpty()) {
status.addError(StatusCode.QUERY_WITHOUT_NAME, "A query must have name");
return status;
}
if (!SourceVersion.isIdentifier(name)) {
status.addError(StatusCode.INVALID_JAVA_IDENTIFIER_NAME,
String.format("%s is not a valid Java identifier.", name),
Collections.singletonMap(StatusContext.BDM_ARTIFACT_NAME_KEY, name));
}
if (name.length() > MAX_QUERY_NAME_LENGTH) {
status.addError(StatusCode.QUERY_NAME_LENGTH_TO_HIGH,
String.format("%s length must be lower than 150 characters.", name),
Collections.singletonMap(StatusContext.BDM_ARTIFACT_NAME_KEY, name));
}
if (query.getContent() == null || query.getContent().isEmpty()) {
status.addError(StatusCode.QUERY_WITHOUT_CONTENT,
String.format("%s query must have a content defined", name),
Collections.singletonMap(StatusContext.BDM_ARTIFACT_NAME_KEY, name));
}
if (query.getReturnType() == null || query.getReturnType().isEmpty()) {
status.addError(StatusCode.QUERY_WITHOUT_RETURN_TYPE,
String.format("%s query must have a return type defined", name),
Collections.singletonMap(StatusContext.BDM_ARTIFACT_NAME_KEY, name));
}
return status;
}
代码示例来源:origin: bonitasoft/bonita-engine
@Override
public ValidationStatus validate(final Query query) {
final ValidationStatus status = new ValidationStatus();
final String name = query.getName();
if (name == null || name.isEmpty()) {
status.addError(StatusCode.QUERY_WITHOUT_NAME, "A query must have name");
return status;
}
if (!SourceVersion.isIdentifier(name)) {
status.addError(StatusCode.INVALID_JAVA_IDENTIFIER_NAME,
String.format("%s is not a valid Java identifier.", name),
Collections.singletonMap(StatusContext.BDM_ARTIFACT_NAME_KEY, name));
}
if (name.length() > MAX_QUERY_NAME_LENGTH) {
status.addError(StatusCode.QUERY_NAME_LENGTH_TO_HIGH,
String.format("%s length must be lower than 150 characters.", name),
Collections.singletonMap(StatusContext.BDM_ARTIFACT_NAME_KEY, name));
}
if (query.getContent() == null || query.getContent().isEmpty()) {
status.addError(StatusCode.QUERY_WITHOUT_CONTENT,
String.format("%s query must have a content defined", name),
Collections.singletonMap(StatusContext.BDM_ARTIFACT_NAME_KEY, name));
}
if (query.getReturnType() == null || query.getReturnType().isEmpty()) {
status.addError(StatusCode.QUERY_WITHOUT_RETURN_TYPE,
String.format("%s query must have a return type defined", name),
Collections.singletonMap(StatusContext.BDM_ARTIFACT_NAME_KEY, name));
}
return status;
}
代码示例来源:origin: bonitasoft/bonita-engine
/**
* Verifies that the actual Query's returnType is equal to the given one.
* @param returnType the given returnType to compare the actual Query's returnType to.
* @return this assertion object.
* @throws AssertionError - if the actual Query's returnType is not equal to the given one.
*/
public QueryAssert hasReturnType(String returnType) {
// check that actual Query we want to make assertions on is not null.
isNotNull();
// overrides the default error message with a more explicit one
String assertjErrorMessage = "\nExpected returnType of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
// null safe check
String actualReturnType = actual.getReturnType();
if (!Objects.areEqual(actualReturnType, returnType)) {
failWithMessage(assertjErrorMessage, actual, returnType, actualReturnType);
}
// return the current assertion for method chaining
return this;
}
代码示例来源: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
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);
}
内容来源于网络,如有侵权,请联系作者删除!