#260: SkillEntryPagesRest.kt
plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt Класс Kotlin, plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt 188 строк · 142 кода · 34 комментария · 12 пустых
Назначение: Исходный файл: projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt. SkillEntryPagesRest.kt является частью приложения управления проектами с открытым исходным кодом ProjectForge.
Исходный код (первые 100 строк)
/////////////////////////////////////////////////////////////////////////////
//
// 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.plugins.skillmatrix
import jakarta.servlet.http.HttpServletRequest
import org.projectforge.business.PfCaches
import org.projectforge.business.fibu.EmployeeDO
import org.projectforge.framework.i18n.translate
import org.projectforge.framework.persistence.api.MagicFilter
import org.projectforge.framework.persistence.api.QueryFilter
import org.projectforge.framework.persistence.api.impl.CustomResultFilter
import org.projectforge.framework.persistence.user.api.ThreadLocalUserContext
import org.projectforge.menu.MenuItem
import org.projectforge.menu.MenuItemTargetType
import org.projectforge.rest.config.Rest
import org.projectforge.rest.core.AbstractDTOPagesRest
import org.projectforge.rest.dto.Employee
import org.projectforge.rest.dto.Kost1
import org.projectforge.rest.dto.SkillEntry
import org.projectforge.rest.dto.User
import org.projectforge.ui.*
import org.projectforge.ui.filter.UIFilterElement
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("${Rest.URL}/skillentry")
class SkillEntryPagesRest() : AbstractDTOPagesRest<SkillEntryDO, SkillEntry, SkillEntryDao>(
SkillEntryDao::class.java,
"plugins.skillmatrix.title",
cloneSupport = CloneSupport.CLONE
) {
@Autowired
private lateinit var caches: PfCaches
/**
* Initializes new memos for adding.
*/
override fun newBaseDO(request: HttpServletRequest?): SkillEntryDO {
val memo = super.newBaseDO(request)
memo.owner = ThreadLocalUserContext.loggedInUser
return memo
}
override fun transformFromDB(obj: SkillEntryDO, editMode: Boolean): SkillEntry {
val entry = SkillEntry()
entry.copyFrom(obj)
caches.getUser(obj.owner?.id)?.let { userDO ->
entry.owner = User(userDO)
}
return entry
}
override fun transformForDB(dto: SkillEntry): SkillEntryDO {
val entryDO = SkillEntryDO()
dto.copyTo(entryDO)
return entryDO
}
/**
* LAYOUT List page
*/
override fun createListLayout(
request: HttpServletRequest,
layout: UILayout,
magicFilter: MagicFilter,
userAccess: UILayout.UserAccess
) {
agGridSupport.prepareUIGrid4ListPage(
request,
layout,
magicFilter,
this,
userAccess = userAccess,
)
.add(lc, "lastUpdate", "skill", "owner")
.add(lc, "rating", formatter = UIAgGridColumnDef.Formatter.RATING)
.add(lc, "interest", formatter = UIAgGridColumnDef.Formatter.RATING)
История Git
868d6abb7 2025 -> 2026
b1742cefd SkillMatrix: field owner fixed in list an edit page.
63081666f Source file headers: 2024-> 2025.
67805f2fc ThreadLocalUserContext.user -> ThreadLocalUserContext.loggedInUser (renamed for avoiding mis-understandings in code).
77bade6df javax.* -> jakarta.*
868d6abb7
2025 -> 2026868d6abb75cd191a892911ac8e45058932cf9074
diff --git a/plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt b/plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt
index 0b6c1d285..f4de97b7d 100644
--- a/plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt
+++ b/plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.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.
//
b1742cefd
SkillMatrix: field owner fixed in list an edit page.b1742cefdb88b9fd401b51009387280af816a5a4
diff --git a/plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt b/plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt
index 1b33f262a..0b6c1d285 100644
--- a/plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt
+++ b/plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt
@@ -23,6 +23,9 @@
package org.projectforge.plugins.skillmatrix
+import jakarta.servlet.http.HttpServletRequest
+import org.projectforge.business.PfCaches
+import org.projectforge.business.fibu.EmployeeDO
import org.projectforge.framework.i18n.translate
import org.projectforge.framework.persistence.api.MagicFilter
import org.projectforge.framework.persistence.api.QueryFilter
@@ -31,123 +34,155 @@ import org.projectforge.framework.persistence.user.api.ThreadLocalUserContext
import org.projectforge.menu.MenuItem
import org.projectforge.menu.MenuItemTargetType
import org.projectforge.rest.config.Rest
-import org.projectforge.rest.core.AbstractDOPagesRest
+import org.projectforge.rest.core.AbstractDTOPagesRest
+import org.projectforge.rest.dto.Employee
+import org.projectforge.rest.dto.Kost1
+import org.projectforge.rest.dto.SkillEntry
+import org.projectforge.rest.dto.User
import org.projectforge.ui.*
import org.projectforge.ui.filter.UIFilterElement
+import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
-import jakarta.servlet.http.HttpServletRequest
@RestController
@RequestMapping("${Rest.URL}/skillentry")
-class SkillEntryPagesRest() : AbstractDOPagesRest<SkillEntryDO, SkillEntryDao>(
- SkillEntryDao::class.java,
- "plugins.skillmatrix.title",
- cloneSupport = CloneSupport.CLONE
+class SkillEntryPagesRest() : AbstractDTOPagesRest<SkillEntryDO, SkillEntry, SkillEntryDao>(
+ SkillEntryDao::class.java,
+ "plugins.skillmatrix.title",
+ cloneSupport = CloneSupport.CLONE
) {
- /**
- * Initializes new memos for adding.
- */
- override fun newBaseDO(request: HttpServletRequest?): SkillEntryDO {
- val memo = super.newBaseDO(request)
- memo.owner = ThreadLocalUserContext.loggedInUser
- return memo
- }
+ @Autowired
+ private lateinit var caches: PfCaches
+
+ /**
+ * Initializes new memos for adding.
+ */
+ override fun newBaseDO(request: HttpServletRequest?): SkillEntryDO {
+ val memo = super.newBaseDO(request)
+ memo.owner = ThreadLocalUserContext.loggedInUser 63081666f
Source file headers: 2024-> 2025.63081666f620fb87315f01b817e560e0b2f6a33a
diff --git a/plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt b/plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt
index ca41ffe0d..1b33f262a 100644
--- a/plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt
+++ b/plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.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.
//
67805f2fc
ThreadLocalUserContext.user -> ThreadLocalUserContext.loggedInUser (renamed for avoiding mis-understandings in code).67805f2fc1f3e6a6393accb4a757a8f4049b001c
diff --git a/plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt b/plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt
index c750001aa..ca41ffe0d 100644
--- a/plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt
+++ b/plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt
@@ -50,7 +50,7 @@ class SkillEntryPagesRest() : AbstractDOPagesRest<SkillEntryDO, SkillEntryDao>(
*/
override fun newBaseDO(request: HttpServletRequest?): SkillEntryDO {
val memo = super.newBaseDO(request)
- memo.owner = ThreadLocalUserContext.user
+ memo.owner = ThreadLocalUserContext.loggedInUser
return memo
}
@@ -100,7 +100,7 @@ class SkillEntryPagesRest() : AbstractDOPagesRest<SkillEntryDO, SkillEntryDao>(
if (ownerFilterEntry?.isTrueValue == true) {
ownerFilterEntry.synthetic = true
target.createJoin("owner")
- target.add(QueryFilter.eq("owner", ThreadLocalUserContext.user!!)) // Show only own skills, not from others.
+ target.add(QueryFilter.eq("owner", ThreadLocalUserContext.loggedInUser!!)) // Show only own skills, not from others.
}
return null
}
@@ -110,7 +110,7 @@ class SkillEntryPagesRest() : AbstractDOPagesRest<SkillEntryDO, SkillEntryDao>(
*/
override fun prepareClone(dto: SkillEntryDO): SkillEntryDO {
val clone = super.prepareClone(dto)
- clone.owner = ThreadLocalUserContext.user
+ clone.owner = ThreadLocalUserContext.loggedInUser
return clone
}
77bade6df
javax.* -> jakarta.*77bade6dfb148c87638c71951accb03942157fcf
diff --git a/plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt b/plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt
index 36e60182c..c750001aa 100644
--- a/plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt
+++ b/plugins/org.projectforge.plugins.skillmatrix/src/main/kotlin/org/projectforge/plugins/skillmatrix/SkillEntryPagesRest.kt
@@ -36,7 +36,7 @@ import org.projectforge.ui.*
import org.projectforge.ui.filter.UIFilterElement
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
-import javax.servlet.http.HttpServletRequest
+import jakarta.servlet.http.HttpServletRequest
@RestController
@RequestMapping("${Rest.URL}/skillentry")