@Override public void decorateAnnotationsList(final List<AnnotationMetadataBuilder> annotations) { super.decorateAnnotationsList(annotations); if (decimalMin != null) { final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>(); attrs.add(new StringAttributeValue(new JavaSymbolName("value"), decimalMin)); annotations.add(new AnnotationMetadataBuilder(DECIMAL_MIN, attrs)); } if (decimalMax != null) { final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>(); attrs.add(new StringAttributeValue(new JavaSymbolName("value"), decimalMax)); annotations.add(new AnnotationMetadataBuilder(DECIMAL_MAX, attrs)); } }
/** * This method provides @RooWsClient annotation with all the necessary attributes * * @param endpoint * @param targetNamespace * @param bindingType * @return */ private AnnotationMetadataBuilder getWsClientAnnotation(final String endpoint, final String targetNamespace, final EnumDetails bindingType) { final List<AnnotationAttributeValue<?>> wsClientAttributes = new ArrayList<AnnotationAttributeValue<?>>(); wsClientAttributes.add(new StringAttributeValue(new JavaSymbolName("endpoint"), endpoint)); wsClientAttributes.add(new StringAttributeValue(new JavaSymbolName("targetNamespace"), targetNamespace)); wsClientAttributes.add(new EnumAttributeValue(new JavaSymbolName("binding"), bindingType)); return new AnnotationMetadataBuilder(RooJavaType.ROO_WS_CLIENT, wsClientAttributes); }
/** * Method that returns @RooDetail annotation * * @param relationField * Field that set the relationship * @param viewsList * Separated comma list that defines the parent views where the * new detail will be displayed. * @return */ private AnnotationMetadataBuilder getRooDetailAnnotation(final String relationField, final String viewsList) { AnnotationMetadataBuilder annotationDetail = new AnnotationMetadataBuilder(RooJavaType.ROO_DETAIL); annotationDetail.addStringAttribute(RELATION_FIELD_KEY, relationField); // Including views attribute if needed if (StringUtils.isNotEmpty(viewsList)) { String[] views = viewsList.split(","); List<StringAttributeValue> viewsValues = new ArrayList<StringAttributeValue>(); for (String view : views) { viewsValues.add(new StringAttributeValue(VALUE_SYM, view)); } ArrayAttributeValue<StringAttributeValue> viewsAttr = new ArrayAttributeValue<StringAttributeValue>(VIEWS_SYM, viewsValues); annotationDetail.addAttribute(viewsAttr); } return annotationDetail; }
@Override public void decorateAnnotationsList(final List<AnnotationMetadataBuilder> annotations) { super.decorateAnnotationsList(annotations); final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>(); attrs.add(new StringAttributeValue(new JavaSymbolName("contentType"), contentType .getContentType())); if (autoUpload) { attrs.add(new BooleanAttributeValue(new JavaSymbolName("autoUpload"), autoUpload)); } annotations.add(new AnnotationMetadataBuilder(ROO_UPLOADED_FILE, attrs)); annotations.add(new AnnotationMetadataBuilder(LOB)); }
public void addStringAttribute(final String key, final String value) { addAttribute(new StringAttributeValue(new JavaSymbolName(key), value)); }
/** * This method provides {@link RooSecurityFilter} annotation with all the necessary * attributes * * @param method Method to add the annotation * @param lstParamTypes Parameter types of the method to add the annotation * @param roles Roles to apply by the filter * @param usernames Usernames apply by the filter * @param when Indicate the type of filter 'PRE' (@PreFilter) or 'POST' (@PostFilter) * @return the annotation created */ private AnnotationMetadataBuilder getRooSecurityFilterAnnotation(final String method, final List<AnnotationAttributeValue<?>> lstParamTypes, final String roles, final String usernames, final String when) { final List<AnnotationAttributeValue<?>> attributes = new ArrayList<AnnotationAttributeValue<?>>(); attributes.add(new StringAttributeValue(new JavaSymbolName("method"), method)); ArrayAttributeValue<AnnotationAttributeValue<?>> newParameters = new ArrayAttributeValue<AnnotationAttributeValue<?>>(new JavaSymbolName("parameters"), lstParamTypes); attributes.add(newParameters); if (roles != null) { attributes.add(new StringAttributeValue(new JavaSymbolName("roles"), roles)); } if (usernames != null) { attributes.add(new StringAttributeValue(new JavaSymbolName("usernames"), usernames)); } attributes.add(new StringAttributeValue(new JavaSymbolName("when"), when)); return new AnnotationMetadataBuilder(RooJavaType.ROO_SECURITY_FILTER, attributes); }
/** * This method provides {@link RooSecurityAuthorization} annotation with all the necessary * attributes * * @param method Method to add the annotation * @param lstParamTypes Parameter types of the method to add the annotation * @param roles Roles to apply by the filter * @param usernames Usernames apply by the filter * @return the annotation created */ private AnnotationMetadataBuilder getRooSecurityAuthorizationsAnnotation(final String method, final List<AnnotationAttributeValue<?>> lstParamTypes, final String roles, final String usernames) { final List<AnnotationAttributeValue<?>> attributes = new ArrayList<AnnotationAttributeValue<?>>(); attributes.add(new StringAttributeValue(new JavaSymbolName("method"), method)); ArrayAttributeValue<AnnotationAttributeValue<?>> newParameters = new ArrayAttributeValue<AnnotationAttributeValue<?>>(new JavaSymbolName("parameters"), lstParamTypes); attributes.add(newParameters); if (roles != null) { attributes.add(new StringAttributeValue(new JavaSymbolName("roles"), roles)); } if (usernames != null) { attributes.add(new StringAttributeValue(new JavaSymbolName("usernames"), usernames)); } return new AnnotationMetadataBuilder(RooJavaType.ROO_SECURITY_AUTHORIZATION, attributes); }
requestMappingAttributes.add(new StringAttributeValue(new JavaSymbolName("value"), path)); requestMappingAttributes.add(new StringAttributeValue(new JavaSymbolName("consumes"), consumes)); requestMappingAttributes.add(new StringAttributeValue(new JavaSymbolName("produces"), produces)); .add(new StringAttributeValue(new JavaSymbolName("headers"), headers));
@Override public void decorateAnnotationsList(final List<AnnotationMetadataBuilder> annotations) { super.decorateAnnotationsList(annotations); if (sizeMin != null || sizeMax != null) { final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>(); if (sizeMin != null) { attrs.add(new IntegerAttributeValue(new JavaSymbolName("min"), sizeMin)); } if (sizeMax != null) { attrs.add(new IntegerAttributeValue(new JavaSymbolName("max"), sizeMax)); } annotations.add(new AnnotationMetadataBuilder(SIZE, attrs)); } if (regexp != null) { final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>(); attrs.add(new StringAttributeValue(new JavaSymbolName("regexp"), regexp)); annotations.add(new AnnotationMetadataBuilder(PATTERN, attrs)); } }
if (column != null) { final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>(); attrs.add(new StringAttributeValue(new JavaSymbolName("name"), column)); columnBuilder = new AnnotationMetadataBuilder(COLUMN, attrs); attrs.add(new StringAttributeValue(new JavaSymbolName("value"), value)); annotations.add(new AnnotationMetadataBuilder(VALUE, attrs));
/** * This method provides @RooWsClient annotation with all the necessary attributes * * @param endpoint * @param targetNamespace * @param bindingType * @return */ private AnnotationMetadataBuilder getWsClientAnnotation(final String endpoint, final String targetNamespace, final SoapBindingType bindingType) { final List<AnnotationAttributeValue<?>> wsClientAttributes = new ArrayList<AnnotationAttributeValue<?>>(); wsClientAttributes.add(new StringAttributeValue(new JavaSymbolName("endpoint"), endpoint)); wsClientAttributes.add(new StringAttributeValue(new JavaSymbolName("targetNamespace"), targetNamespace)); wsClientAttributes.add(new EnumAttributeValue(new JavaSymbolName("binding"), new EnumDetails( RooJavaType.ROO_ENUM_SOAP_BINDING_TYPE, new JavaSymbolName(bindingType.name())))); return new AnnotationMetadataBuilder(RooJavaType.ROO_WS_CLIENT, wsClientAttributes); }
new ArrayList<AnnotationAttributeValue<?>>(); if (pattern != null) { attributes.add(new StringAttributeValue(new JavaSymbolName("pattern"), pattern)); } else { final String dateStyle = null != dateFormat ? String.valueOf(dateFormat.getShortKey()) : "M"; final String timeStyle = null != timeFormat ? String.valueOf(timeFormat.getShortKey()) : "-"; attributes.add(new StringAttributeValue(new JavaSymbolName("style"), dateStyle + timeStyle));
requestMappingAttributes.add(new StringAttributeValue(new JavaSymbolName("value"), path)); .add(new StringAttributeValue(new JavaSymbolName("headers"), headers));
findersToAdd.add(new StringAttributeValue(new JavaSymbolName("value"), finder)); findersAdded = true;
/** * Method that returns @RooController annotation * * @param entity * Entity over which create the controller * @param pathPrefix * Prefix to use in RequestMapping * @param controllerType * Indicates the controller type * @return */ private AnnotationMetadataBuilder getRooControllerAnnotation(final JavaType entity, final String pathPrefix, final ControllerType controllerType) { final List<AnnotationAttributeValue<?>> rooControllerAttributes = new ArrayList<AnnotationAttributeValue<?>>(); rooControllerAttributes.add(new ClassAttributeValue(new JavaSymbolName(ENTITY_KEY), entity)); if (StringUtils.isNotEmpty(pathPrefix)) { rooControllerAttributes.add(new StringAttributeValue(new JavaSymbolName("pathPrefix"), pathPrefix)); } rooControllerAttributes.add(new EnumAttributeValue(new JavaSymbolName("type"), new EnumDetails( RooJavaType.ROO_ENUM_CONTROLLER_TYPE, new JavaSymbolName(controllerType.name())))); return new AnnotationMetadataBuilder(RooJavaType.ROO_CONTROLLER, rooControllerAttributes); }
operationsToAdd.add(new StringAttributeValue(VALUE_SYM, operation)); operationsToAdd.add(new StringAttributeValue(VALUE_SYM, operation)); operationsAdded = true;
attributes.add(new StringAttributeValue(new JavaSymbolName("mappedBy"), mappedBy .getSymbolName()));
attributes.add(new StringAttributeValue(new JavaSymbolName("mappedBy"), mappedBy .getSymbolName()));
public void addEqualsAndHashCodeMethods(final JavaType javaType, final boolean appendSuper, final Set<String> excludeFields) { // Add @RooEquals annotation to class if not yet present final ClassOrInterfaceTypeDetails cid = typeLocationService.getTypeDetails(javaType); if (cid == null || cid.getTypeAnnotation(ROO_EQUALS) != null) { return; } final AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(ROO_EQUALS); if (appendSuper) { annotationBuilder.addBooleanAttribute("appendSuper", appendSuper); } if (!CollectionUtils.isEmpty(excludeFields)) { final List<StringAttributeValue> attributes = new ArrayList<StringAttributeValue>(); for (final String excludeField : excludeFields) { attributes.add(new StringAttributeValue(new JavaSymbolName("value"), excludeField)); } annotationBuilder.addAttribute(new ArrayAttributeValue<StringAttributeValue>( new JavaSymbolName("excludeFields"), attributes)); } final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(cid); cidBuilder.addAnnotation(annotationBuilder.build()); typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build()); } }
List<AnnotationAttributeValue<?>> findersToAdd = new ArrayList<AnnotationAttributeValue<?>>(); for (String finder : queryMethods) { findersToAdd.add(new StringAttributeValue(new JavaSymbolName("value"), finder));