EN · DE · RU · FR · ES

#1360: MyImportedElement.kt

projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt Kotlin class, projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt 56 lines · 19 code · 33 comments · 4 blank
Purpose: Source file: framework/persistence/utils/MyImportedElement.kt. MyImportedElement.kt is part of the ProjectForge open-source project management application.

Source (first 100 lines)

/////////////////////////////////////////////////////////////////////////////
//
// Project ProjectForge Community Edition
//         www.projectforge.org
//
// Copyright (C) 2001-2026 Micromata GmbH, Germany (www.micromata.com)
//
// ProjectForge is dual-licensed.
//
// This community edition is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as published
// by the Free Software Foundation; version 3 of the License.
//
// This community edition is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
// Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, see http://www.gnu.org/licenses/.
//
/////////////////////////////////////////////////////////////////////////////

package org.projectforge.framework.persistence.utils

import de.micromata.merlin.excel.importer.ImportedElement
import de.micromata.merlin.excel.importer.ImportedSheet
import org.projectforge.framework.DisplayNameCapable

/**
 * Custom imported element class that formats values as strings, particularly for display names.
 * This class extends the generic ImportedElement class to provide specific functionality
 * for handling imported data with display names.
 * @param T The type of the imported data.
 * @param importedSheet The sheet from which the data is imported.
 * @param row The row number in the sheet.
 * @param clazz The class type of the imported data.
 * @param diffProperties Optional properties to track differences in the imported data.
 *                       List of property names which will be used for display property changes.
 */
open class MyImportedElement<T>(
    importedSheet: ImportedSheet<T>,
    row: Int,
    clazz: Class<T>,
    vararg diffProperties: String
) : ImportedElement<T>(importedSheet, row, clazz, *diffProperties) {

    override fun valueAsString(value: Any?): String? {
        if (value == null)
            return null
        return when (value) {
            is DisplayNameCapable -> value.displayName
            else -> value.toString()
        }
    }
}

Git History

868d6abb7 2025 -> 2026
312d5e61c Clean-up
63081666f Source file headers: 2024-> 2025.
e33c8b9c2 Migration stuff in progress...
b6092df09 Copyright 2023 -> 2024

868d6abb7

2025 -> 2026
868d6abb75cd191a892911ac8e45058932cf9074
diff --git a/projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt b/projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt
index 1ca2a62ae..d44a6d33c 100644
--- a/projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt
+++ b/projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt
@@ -3,7 +3,7 @@
 // Project ProjectForge Community Edition
 //         www.projectforge.org
 //
-// Copyright (C) 2001-2025 Micromata GmbH, Germany (www.micromata.com)
+// Copyright (C) 2001-2026 Micromata GmbH, Germany (www.micromata.com)
 //
 // ProjectForge is dual-licensed.
 //

312d5e61c

Clean-up
312d5e61ce552ed70295007e2f9eefe345f6dc03
diff --git a/projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt b/projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt
index cfa23f31e..1ca2a62ae 100644
--- a/projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt
+++ b/projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt
@@ -27,11 +27,23 @@ import de.micromata.merlin.excel.importer.ImportedElement
 import de.micromata.merlin.excel.importer.ImportedSheet
 import org.projectforge.framework.DisplayNameCapable
 
-open class MyImportedElement<T>(importedSheet: ImportedSheet<T>,
-                                row: Int,
-                                clazz: Class<T>,
-                                vararg diffProperties: String)
-    : ImportedElement<T>(importedSheet, row, clazz, *diffProperties) {
+/**
+ * Custom imported element class that formats values as strings, particularly for display names.
+ * This class extends the generic ImportedElement class to provide specific functionality
+ * for handling imported data with display names.
+ * @param T The type of the imported data.
+ * @param importedSheet The sheet from which the data is imported.
+ * @param row The row number in the sheet.
+ * @param clazz The class type of the imported data.
+ * @param diffProperties Optional properties to track differences in the imported data.
+ *                       List of property names which will be used for display property changes.
+ */
+open class MyImportedElement<T>(
+    importedSheet: ImportedSheet<T>,
+    row: Int,
+    clazz: Class<T>,
+    vararg diffProperties: String
+) : ImportedElement<T>(importedSheet, row, clazz, *diffProperties) {
 
     override fun valueAsString(value: Any?): String? {
         if (value == null)

63081666f

Source file headers: 2024-> 2025.
63081666f620fb87315f01b817e560e0b2f6a33a
diff --git a/projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt b/projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt
index 77f864661..cfa23f31e 100644
--- a/projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt
+++ b/projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt
@@ -3,7 +3,7 @@
 // Project ProjectForge Community Edition
 //         www.projectforge.org
 //
-// Copyright (C) 2001-2024 Micromata GmbH, Germany (www.micromata.com)
+// Copyright (C) 2001-2025 Micromata GmbH, Germany (www.micromata.com)
 //
 // ProjectForge is dual-licensed.
 //

e33c8b9c2

Migration stuff in progress...
e33c8b9c2038eb279e10b807ac6e52e41466b680
diff --git a/projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt b/projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt
index c71df7ddd..77f864661 100644
--- a/projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt
+++ b/projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt
@@ -23,7 +23,6 @@
 
 package org.projectforge.framework.persistence.utils
 
-import de.micromata.genome.util.strings.ShortDisplayable
 import de.micromata.merlin.excel.importer.ImportedElement
 import de.micromata.merlin.excel.importer.ImportedSheet
 import org.projectforge.framework.DisplayNameCapable
@@ -38,7 +37,6 @@ open class MyImportedElement<T>(importedSheet: ImportedSheet<T>,
         if (value == null)
             return null
         return when (value) {
-            is ShortDisplayable -> value.toShortString()
             is DisplayNameCapable -> value.displayName
             else -> value.toString()
         }

b6092df09

Copyright 2023 -> 2024
b6092df0927c4a3b161e888445f31dcab57493f2
diff --git a/projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt b/projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt
index b047e0049..c71df7ddd 100644
--- a/projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt
+++ b/projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/utils/MyImportedElement.kt
@@ -3,7 +3,7 @@
 // Project ProjectForge Community Edition
 //         www.projectforge.org
 //
-// Copyright (C) 2001-2023 Micromata GmbH, Germany (www.micromata.com)
+// Copyright (C) 2001-2024 Micromata GmbH, Germany (www.micromata.com)
 //
 // ProjectForge is dual-licensed.
 //