本文整理了Java中org.bonitasoft.engine.bdm.model.Query.getContent
方法的一些代码示例,展示了Query.getContent
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getContent
方法的具体详情如下:
包路径:org.bonitasoft.engine.bdm.model.Query
类名称:Query
方法名:getContent
暂无
代码示例来源: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 content is equal to the given one.
* @param content the given content to compare the actual Query's content to.
* @return this assertion object.
* @throws AssertionError - if the actual Query's content is not equal to the given one.
*/
public QueryAssert hasContent(String content) {
// 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 content of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
// null safe check
String actualContent = actual.getContent();
if (!Objects.areEqual(actualContent, content)) {
failWithMessage(assertjErrorMessage, actual, content, actualContent);
}
// return the current assertion for method chaining
return this;
}
代码示例来源: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;
}
内容来源于网络,如有侵权,请联系作者删除!