mugwort

Artemisia vulgaris (mugwort) and Chaiturus marrubiastrum (false motherwort, horehound motherwort) [tentative ID]
mugwort provides some utitilities for enterprise software development using
spring, hibernate, servlets, xstream, java-bean-validation, …

Overview

¬†… for using Hibernate and Spring

  • BaseRepository¬† - A very mightfull basic repository to be used with spring and hibernate. (Can also be used with spring-data-jpa for custom repositories.)
  • IdentifiedEntity - A basic class for persisted entities.
  • BaseService - A spring base service, with support for manual transactions (and more to come)
  • SecureEnvironment – Supports encrypted property values.
  • ImmutableCheckInterceptor – To make entities really immutable (and log and suppress attempts to modifiy them)

¬†… for working with Servlets

  • ServletUtils - Gets headers/cookies/paramaters as string lists, gets dump, …
  • DumpFilter - Used to dump the servlet reuest.

… for extending XStream

  • MapToAttributesConverter
    Converts a map to a list of xml-attributes. The key of the Map becomes the name of the xml-attribute, and the value of the Map becomes the value of the xml-attribute.

… for validating beans

  • Occurence - The annotated list must not have more than one elements, where the specified field (getter) has the specified value
  • OneNotEmpty - At least one of the given fields must be non-empty (for strings, collections and arrays) or non-null (for anything else).
  • DependantNotEmpty – The value of the field ‘fieldname’ must not be empty, if the value of the file ‘dependantField’ is equal to the ‘dependantValue’.
  • Country – The annotated element must be a valid country code (ISO 3166-1 ALPHA-2 code)
  • Curreny - The annotated element must be a valid currency code (ISO 4217 ALPHA)
  • Locale - The annotated element must be a valid locale code

… more to come …

Documentation

Download

Maven

<dependency>
  <groupId>net.thk-systems.commons</groupId>
  <artifactId>mugwort</artifactId>
  <version>3.6.1</version>
</dependency>

You can browse maven-central to download the jar or other versions.
(A downloadable zip-file packed with all dependencies is currently not deployed.)

Note: mugwort comes with no maven dependencies to spring, hibernate, servlet-api, … .

Changelog

3.5.0 / 3.6.1

  • Removed ValidatedByValidator
  • Added LocaleValidator

3.4.0

  • Added ValidatedByValidator

3.3.0

  • Added CurrencyValidator

3.2.0

  • Added CountryValidator

3.1.0

  • Added BaseService.runInTransaction

3.0.0

  • Added ConditionalNotEmptyValidator
  • Move to Java 8 (first without changing anything

2.3.0

  • Added OneNotEmptyValidator

2.2.0

  • Added ImmutableCheckInterceptor and @Immutable and @Mutable annotations
  • Added OccurenceValidator
  • Renamed ExtendedEnvironment to SecureEnvironment and added a ‘merging’ with ‘default’ environment

2.1.0

  • Added ExtendedEnvironment and JasyptTool

2.0.0

  • Released as 2.0.0 under new maven group id