Skip to content

guide migration oasp3 to devon3.1

devonfw-core edited this page Dec 13, 2022 · 5 revisions

Migration Guide from oasp 3.0.0 to devon4j 3.1.0 migration

  • Automatic migration with devcon doesn’t work with parent pom’s; you need to migrate every single subproject on it’s own.

  • If your subproject’s don’t contain the old oasp4j or devon4j version number you have to copy your parent pom file into your child pom files and then use the migrate command.

  • use the devon4j migation command

  • after migration you need to update the version tag in the pom file manually. If you’re working with a parent pom you also need to update the version tag of the parent reference in the child pom file.

  • In case you are using eclipse, now you have to update and rebuild all your maven projects (alt + F5)

JsonDeserializer:

  1. Change the super class from AbstractJsonDeserializer to JsonDeserializer

  2. Implement unimplemented methods or change the methode signatur from Pageable deserializeNode(JsonNode node) to Pageable deserialize(JsonParser p, DeserializationContext context)

  3. To get the JsonNode you need to use the following methods with the JsonParser p: JsonNode node = p.getCodec().readTree(p);

  4. To get values of properties, you need to change from getRequiredValue(node, "property", String.class) to JacksonUtil.readValue(node, "property", String.class, false);

QueryUtil update

whereString() (StringSearchConfigTo) method or similar:

  1. Check the parameter type with attetion on the source of the used class (the classes may have the same name but the one from oasp4j is obsolete)

  2. Delete the old import of oasp4j (for example import io.oasp.module.beanmapping.common.api.BeanMapper) and import the new class of devon4j (for example import com.devonfw.module.beanmapping.common.api.BeanMapper)

logback.xml file

  1. There maximum three chnages that needed to be done in the logback.xml file

  2. Change the logging properties tag from <property resource="io/oasp/logging/logback/application-logging.properties" /> to <property resource="com/devonfw/logging/logback/application-logging.properties" />

  3. Change the appenders file all tag from <include resource="io/oasp/logging/logback/appenders-file-all.xml" /> to <include resource="com/devonfw/logging/logback/appenders-file-all.xml" />

  4. Change the appender console tag from <include resource="io/oasp/logging/logback/appender-console.xml" /> to <include resource="com/devonfw/logging/logback/appender-console.xml" />

OaspPackage:

If you use the OaspPackage class you can replace it with the Devon4jPackage class

AbstractLogic

  1. You can replace all net.sf.mmm.util imports with the appropriate com.devonfw.module imports. For example "import net.sf.mmm.util.entity.api.GenericEntity" to "import com.devonfw.module.basic.common.api.entity.GenericEntity"

  2. Except the TransferObject and the AbstractTransferObject. These are replaced with the denvonfw AbstractTo. Example: "import net.sf.mmm.util.transferobject.api.AbstractTransferObject" or "import net.sf.mmm.util.transferobject.api.TransferObject" to "import com.devonfw.module.basic.common.api.to.AbstractTo".

BeanDozerConfig

  1. Change the @ComponentScan annotation from @ComponentScan(basePackages = { "io.oasp.module.beanmapping" }) to @ComponentScan(basePackages = { "com.devonfw.module.beanmapping" }).

  2. Now you have to create a variable DOZER_MAPPING_XML with following content: static final String DOZER_MAPPING_XML = "config/app/common/dozer-mapping.xml".

  3. Then you create an list beanMappings where you add the variable created in step 2.

  4. To get an Mapper instance you now have to use a builder like Mapper mapper = DozerBeanMapperBuilder.create().withMappingFiles(beanMappings).build().

  5. Change occurrences of io.oasp.module.beanmapping.common.impl.dozer.IdentityConverter in dozer-mappings.xml to com.devonfw.module.beanmapping.common.impl.dozer.IdentityConverter

  6. Migration of dozer 5 to 6.4: https://github.com/DozerMapper/dozer/blob/master/docs/asciidoc/migration/v6-to-v61.adoc https://github.com/DozerMapper/dozer/blob/master/docs/asciidoc/migration/v61-to-v62.adoc https://github.com/DozerMapper/dozer/blob/master/docs/asciidoc/migration/v62-to-v63.adoc https://github.com/DozerMapper/dozer/blob/master/docs/asciidoc/migration/v63-to-v64.adoc

  7. In addition, the semantics of <mapping type="one-way"> seems to be changed. If you for example just needed to exclude files on mapping from a to b one-way, you now have to declare an empty mapping as well from b to a one-way without any field(-extension) declarations to enable mapping from b to a at all. See also https://github.com/DozerMapper/dozer/issues/605 and https://github.com/DozerMapper/dozer/issues/451

pom.xml

In the pom.xml file you have to do some manuall changes. You need to change all oasp dependencies to denvonfw dependencies. Here are some examples:

  1. from

      <dependency>
        <groupId>io.oasp.java.modules</groupId>
        <artifactId>oasp4j-beanmapping</artifactId>
    </dependency>
    to
    <dependency>
        <groupId>com.devonfw.java.modules</groupId>
        <artifactId>devon4j-beanmapping</artifactId>
      </dependency>
  2. from

      <dependency>
        <groupId>io.oasp.java.modules</groupId>
        <artifactId>oasp4j-security</artifactId>
    </dependency>
    to
    <dependency>
        <groupId>com.devonfw.java.modules</groupId>
        <artifactId>devon4j-security</artifactId>
      </dependency>
  3. from

      <dependency>
        <groupId>io.oasp.java.modules</groupId>
        <artifactId>oasp4j-web</artifactId>
    </dependency>
    to
    <dependency>
        <groupId>com.devonfw.java.modules</groupId>
        <artifactId>devon4j-web</artifactId>
      </dependency>
  4. from

      <dependency>
        <groupId>io.oasp.java.starters</groupId>
        <artifactId>oasp4j-starter-cxf-client-rest</artifactId>
    </dependency>
    to
    <dependency>
        <groupId>com.devonfw.java.starters</groupId>
        <artifactId>devon4j-starter-cxf-client-rest</artifactId>
      </dependency>
  5. from

      <dependency>
        <groupId>io.oasp.java.starters</groupId>
        <artifactId>oasp4j-starter-cxf-client-ws</artifactId>
    </dependency>
    to
    <dependency>
        <groupId>com.devonfw.java.starters</groupId>
        <artifactId>devon4j-starter-cxf-client-ws</artifactId>
      </dependency>
  6. from

      <dependency>
        <groupId>io.oasp.java.starters</groupId>
        <artifactId>oasp4j-starter-cxf-server-rest</artifactId>
    </dependency>
    to
    <dependency>
        <groupId>com.devonfw.java.starters</groupId>
        <artifactId>devon4j-starter-cxf-server-rest</artifactId>
      </dependency>
  7. from

      <dependency>
        <groupId>io.oasp.java.starters</groupId>
        <artifactId>oasp4j-starter-spring-data-jpa</artifactId>
    </dependency>
    to
    <dependency>
        <groupId>com.devonfw.java.starters</groupId>
        <artifactId>devon4j-starter-spring-data-jpa</artifactId>
      </dependency>
  8. from

      <dependency>
        <groupId>io.oasp.java.modules</groupId>
        <artifactId>oasp4j-batch</artifactId>
    </dependency>
    to
    <dependency>
        <groupId>com.devonfw.java.modules</groupId>
        <artifactId>devon4j-batch</artifactId>
      </dependency>
  9. from

      <dependency>
        <groupId>io.oasp.java.modules</groupId>
        <artifactId>oasp4j-test</artifactId>
    </dependency>
    to
    <dependency>
        <groupId>com.devonfw.java.modules</groupId>
        <artifactId>devon4j-test</artifactId>
      </dependency>
  10. from

      <dependency>
        <groupId>io.oasp.java.modules</groupId>
        <artifactId>oasp4j-logging</artifactId>
    </dependency>
    to
    <dependency>
        <groupId>com.devonfw.java.modules</groupId>
        <artifactId>devon4j-logging</artifactId>
      </dependency>
  11. from

      <dependency>
        <groupId>io.oasp.java.modules</groupId>
        <artifactId>oasp4j-jpa-spring-data</artifactId>
    </dependency>
    to
    <dependency>
        <groupId>com.devonfw.java.modules</groupId>
        <artifactId>devon4j-jpa-spring-data</artifactId>
      </dependency>
  12. from

      <dependency>
        <groupId>io.oasp.java.modules</groupId>
        <artifactId>oasp4j-rest</artifactId>
    </dependency>
    to
    <dependency>
        <groupId>com.devonfw.java.modules</groupId>
        <artifactId>devon4j-rest</artifactId>
      </dependency>

MutableGenericEntity

If you use the MutableGenericEntity<> class you have to change it to the PersistenceEntity<> class. Change the import "net.sf.mmm.util.entity.api.MutableGenericEntity" to "import com.devonfw.module.basic.common.api.entity.PersistenceEntity".

CompositeTo

If you use the CompositeTo class you should now use the AbstractTo class. Just change the import from "import net.sf.mmm.util.transferobject.api.CompositeTo" to "import com.devonfw.module.basic.common.api.to.AbstractTo".

Clone this wiki locally