if (field.getFieldName().toString().compareTo(rawProperty) == 0) { tempField = field; break; if (rawProperty.startsWith(field.getFieldName().toString())) { if (tempField == null || tempField.getFieldName().toString().length() < field.getFieldName().toString() .length()) tempField = field; return Pair.of( related.getLeft() == null ? path : related.getLeft(), StringUtils.capitalize(tempField.getFieldName().toString()).concat( StringUtils.capitalize(related.getRight()))); return Pair.of(path, StringUtils.capitalize(tempField.getFieldName().toString()));
/** * Gets the property of a related entity, using raw property information. * * @param rawProperty string that contains the definition of a property, which can be a property accessed by a relation. * @param referenceProperty property that represents a relation with other entity. * @return Pair that contains a property metadata and its name. */ private Pair<Stack<FieldMetadata>, String> extractRelatedEntityValidProperty( String extractProperty, FieldMetadata referenceProperty, Stack<FieldMetadata> path) { if (StringUtils.isBlank(extractProperty) || referenceProperty == null) { return null; } // Extract the property of a related entity String property = StringUtils.substringAfter(extractProperty, referenceProperty.getFieldName().toString()); if (StringUtils.isBlank(property)) { return null; } return extractValidProperty(property, getValidProperties(referenceProperty.getFieldType()), path); }
options.add(query.concat(StringUtils.capitalize(field.getFieldName().toString()))); String name = StringUtils.capitalize(field.getFieldName().toString()); if (name.startsWith(DISTINCT)) { options.add(query.concat(StringUtils.substringAfter(name, DISTINCT))); String name = StringUtils.capitalize(field.getFieldName().toString()); if (name.startsWith(limit)) { options.add(query.concat(StringUtils.substringAfter(name, limit))); for (FieldMetadata relatedEntityfield : fields) { options.add(query.concat(StringUtils.capitalize(relatedEntityfield.getFieldName() .toString())));
String name = parameter.getName().toString(); Matcher matcher = lastIntPattern.matcher(name); if (matcher.find()) {
String name = property.getLeft().peek().getFieldName().toString();
if (methodName.toString().startsWith("findBy")) { methodName = new JavaSymbolName("find"); } else if (methodName.toString().startsWith("countBy")) { methodName = new JavaSymbolName("count"); methodName = new JavaSymbolName(methodName.toString().concat("By").concat(paramList)); webParamAnnotation.addStringAttribute("name", paramName.toString()); webParamAnnotation.addStringAttribute("targetNamespace", ""); annotations.add(webParamAnnotation.build());
/** * Gets method body expression for property-getter method * * @param prefix * @param propAccessorName * @param fieldName * @return */ private String getPropertyAccesorExpression(String prefix, JavaSymbolName propAccessorName, JavaSymbolName fieldName) { if (StringUtils.isBlank(prefix)) { return fieldName.toString(); } else { return String.format("%s.%s()", prefix, propAccessorName); } }
if (field.getFieldName().toString().compareTo(rawProperty) == 0) { tempField = field; break; if (rawProperty.startsWith(field.getFieldName().toString())) { if (tempField == null || tempField.getFieldName().toString().length() < field.getFieldName().toString() .length()) tempField = field; return Pair.of( related.getLeft() == null ? path : related.getLeft(), StringUtils.capitalize(tempField.getFieldName().toString()).concat( StringUtils.capitalize(related.getRight()))); return Pair.of(path, StringUtils.capitalize(tempField.getFieldName().toString()));
/** * Gets the property of a related entity, using raw property information. * * @param rawProperty string that contains the definition of a property, which can be a property accessed by a relation. * @param referenceProperty property that represents a relation with other entity. * @return Pair that contains a property metadata and its name. */ private Pair<Stack<FieldMetadata>, String> extractRelatedEntityValidProperty( String extractProperty, FieldMetadata referenceProperty, Stack<FieldMetadata> path) { if (StringUtils.isBlank(extractProperty) || referenceProperty == null) { return null; } // Extract the property of a related entity String property = StringUtils.substringAfter(extractProperty, referenceProperty.getFieldName().toString()); if (StringUtils.isBlank(property)) { return null; } return extractValidProperty(property, getValidProperties(referenceProperty.getFieldType()), path); }
String name = parameter.getName().toString(); Matcher matcher = lastIntPattern.matcher(name); if (matcher.find()) {
.getAttribute(VALUE).getValue().toString(); String finalPath = String.format("/%s", path.toString()); if (finalPath.equals(requestMappingPath)) { throw new RuntimeException(
&& !intoEntryId .getJavaSymbolName() .toString() .startsWith( MenuEntryOperations.CATEGORY_MENU_ITEM_PREFIX)) {
String name = property.getLeft().peek().getFieldName().toString();
/** * This method obtains current entity PK * * @param controller * @param typeLocationService * @return */ private String generatePKFromEntity(JavaType controller, TypeLocationService typeLocationService) { ClassOrInterfaceTypeDetails controllerDetails = typeLocationService .getTypeDetails(controller); AnnotationMetadata scaffoldAnnotation = controllerDetails .getAnnotation(RooJavaType.ROO_WEB_SCAFFOLD); JavaType entity = (JavaType) scaffoldAnnotation.getAttribute( "formBackingObject").getValue(); // Getting entity details ClassOrInterfaceTypeDetails entityDetails = typeLocationService .getTypeDetails(entity); List<FieldMetadata> idField = entityDetails .getFieldsWithAnnotation(new JavaType("javax.persistence.Id")); // If main entity not have ID field, check if exists on extended class if (!idField.isEmpty()) { return idField.get(0).getFieldName().toString(); } else { // TODO: CHECK IF IS CORRECT return "id"; } }
new String[] { PROPERTY_KEY, GET_ID_KEY }, new String[] { propAccessExpression, idAccesor.getMethodName().toString() });