Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
b6573d5b
Commit
b6573d5b
authored
4 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
OO-4662: sync launching new tab with dispatching requests
parent
f8367471
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/olat/NewControllerFactory.java
+75
-71
75 additions, 71 deletions
src/main/java/org/olat/NewControllerFactory.java
with
75 additions
and
71 deletions
src/main/java/org/olat/NewControllerFactory.java
+
75
−
71
View file @
b6573d5b
...
@@ -70,7 +70,7 @@ import org.olat.repository.RepositoryManager;
...
@@ -70,7 +70,7 @@ import org.olat.repository.RepositoryManager;
*/
*/
public
class
NewControllerFactory
{
public
class
NewControllerFactory
{
private
static
final
Logger
log
=
Tracing
.
createLoggerFor
(
NewControllerFactory
.
class
);
private
static
final
Logger
log
=
Tracing
.
createLoggerFor
(
NewControllerFactory
.
class
);
private
static
NewControllerFactory
INSTANCE
=
new
NewControllerFactory
();
private
static
final
NewControllerFactory
INSTANCE
=
new
NewControllerFactory
();
// map of controller creators, setted by Spring configuration
// map of controller creators, setted by Spring configuration
private
Map
<
String
,
ContextEntryControllerCreator
>
contextEntryControllerCreators
=
new
HashMap
<>();
private
Map
<
String
,
ContextEntryControllerCreator
>
contextEntryControllerCreators
=
new
HashMap
<>();
...
@@ -171,89 +171,93 @@ public class NewControllerFactory {
...
@@ -171,89 +171,93 @@ public class NewControllerFactory {
return
false
;
//nothing to launch
return
false
;
//nothing to launch
}
}
OLATResourceable
ores
=
mainCe
.
getOLATResourceable
();
OLATResourceable
ores
=
mainCe
.
getOLATResourceable
();
// Check for RepositoryEntry resource
RepositoryEntry
re
=
null
;
if
(
ores
.
getResourceableTypeName
().
equals
(
OresHelper
.
calculateTypeName
(
RepositoryEntry
.
class
)))
{
if
(
ores
instanceof
RepositoryEntry
)
{
re
=
(
RepositoryEntry
)
ores
;
ores
=
re
.
getOlatResource
();
}
else
{
// It is a repository-entry => get OLATResourceable from RepositoryEntry
RepositoryManager
repom
=
RepositoryManager
.
getInstance
();
re
=
repom
.
lookupRepositoryEntry
(
ores
.
getResourceableId
());
if
(
re
!=
null
){
ores
=
re
.
getOlatResource
();
mainCe
.
upgradeOLATResourceable
(
re
);
}
}
}
UserSession
usess
=
ureq
.
getUserSession
();
UserSession
usess
=
ureq
.
getUserSession
();
Window
window
=
Windows
.
getWindows
(
usess
).
getWindow
(
ureq
);
Window
window
=
Windows
.
getWindows
(
usess
).
getWindow
(
ureq
);
if
(
window
==
null
)
{
if
(
window
==
null
)
{
log
.
debug
(
"Found no window for jumpin => take WindowBackOffice"
);
log
.
debug
(
"Found no window for jumpin => take WindowBackOffice"
);
window
=
wControl
.
getWindowBackOffice
().
getWindow
();
window
=
wControl
.
getWindowBackOffice
().
getWindow
();
}
}
DTabs
dts
=
window
.
getDTabs
();
String
firstType
=
mainCe
.
getOLATResourceable
().
getResourceableTypeName
();
// String firstTypeId = ClassToId.getInstance().lookup() BusinessGroup
ContextEntryControllerCreator
typeHandler
=
getContextEntryControllerCreator
(
firstType
);
if
(
typeHandler
==
null
)
{
log
.
warn
(
"Cannot found an handler for context entry: "
+
mainCe
);
return
false
;
//simply return and don't throw a red screen
}
if
(!
typeHandler
.
validateContextEntryAndShowError
(
mainCe
,
ureq
,
wControl
)){
//simply return and don't throw a red screen
return
false
;
}
List
<
ContextEntry
>
entries
=
new
ArrayList
<>(
5
);
while
(
bc
.
hasContextEntry
())
{
entries
.
add
(
bc
.
popLauncherContextEntry
());
}
List
<
ContextEntry
>
ces
=
new
ArrayList
<>(
entries
.
size
()
+
1
);
ces
.
add
(
mainCe
);
if
(
entries
.
size
()
>
0
)
{
ces
.
addAll
(
entries
);
}
TabContext
context
=
typeHandler
.
getTabContext
(
ureq
,
ores
,
mainCe
,
entries
);
String
siteClassName
=
typeHandler
.
getSiteClassName
(
ces
,
ureq
);
// open in existing site
boolean
launched
=
false
;
boolean
launched
=
false
;
boolean
assessmentMode
=
usess
.
isInAssessmentModeProcess
();
synchronized
(
window
)
{
if
(
siteClassName
!=
null
)
{
if
(!
assessmentMode
)
{
// Check for RepositoryEntry resource
dts
.
activateStatic
(
ureq
,
siteClassName
,
context
.
getContext
());
RepositoryEntry
re
=
null
;
launched
=
true
;
if
(
ores
.
getResourceableTypeName
().
equals
(
OresHelper
.
calculateTypeName
(
RepositoryEntry
.
class
)))
{
if
(
ores
instanceof
RepositoryEntry
)
{
re
=
(
RepositoryEntry
)
ores
;
ores
=
re
.
getOlatResource
();
}
else
{
// It is a repository-entry => get OLATResourceable from RepositoryEntry
RepositoryManager
repom
=
RepositoryManager
.
getInstance
();
re
=
repom
.
lookupRepositoryEntry
(
ores
.
getResourceableId
());
if
(
re
!=
null
){
ores
=
re
.
getOlatResource
();
mainCe
.
upgradeOLATResourceable
(
re
);
}
}
}
}
}
else
if
(!
assessmentMode
||
usess
.
matchLockResource
(
ores
))
{
// get current tab or create new tab
DTab
dt
=
dts
.
getDTab
(
ores
);
DTabs
dts
=
window
.
getDTabs
();
if
(
dt
==
null
)
{
WindowControl
bwControl
=
BusinessControlFactory
.
getInstance
().
createBusinessWindowControl
(
bc
,
dts
.
getWindowControl
());
String
firstType
=
mainCe
.
getOLATResourceable
().
getResourceableTypeName
();
usess
.
addToHistory
(
ureq
,
bc
);
// String firstTypeId = ClassToId.getInstance().lookup() BusinessGroup
ContextEntryControllerCreator
typeHandler
=
getContextEntryControllerCreator
(
firstType
);
Controller
launchC
=
typeHandler
.
createController
(
ces
,
ureq
,
bwControl
);
if
(
typeHandler
==
null
)
{
if
(
launchC
!=
null
)
{
log
.
warn
(
"Cannot found an handler for context entry: {}"
,
mainCe
);
dt
=
dts
.
createDTab
(
context
.
getTabResource
(),
re
,
launchC
,
context
.
getName
());
return
false
;
//simply return and don't throw a red screen
if
(
dt
==
null
)
{
}
launched
=
false
;
if
(!
typeHandler
.
validateContextEntryAndShowError
(
mainCe
,
ureq
,
wControl
)){
}
else
if
(
dts
.
addDTab
(
ureq
,
dt
))
{
//simply return and don't throw a red screen
dts
.
activate
(
ureq
,
dt
,
context
.
getContext
());
return
false
;
launched
=
true
;
}
List
<
ContextEntry
>
entries
=
new
ArrayList
<>(
5
);
while
(
bc
.
hasContextEntry
())
{
entries
.
add
(
bc
.
popLauncherContextEntry
());
}
List
<
ContextEntry
>
ces
=
new
ArrayList
<>(
entries
.
size
()
+
1
);
ces
.
add
(
mainCe
);
if
(!
entries
.
isEmpty
())
{
ces
.
addAll
(
entries
);
}
TabContext
context
=
typeHandler
.
getTabContext
(
ureq
,
ores
,
mainCe
,
entries
);
String
siteClassName
=
typeHandler
.
getSiteClassName
(
ces
,
ureq
);
// open in existing site
boolean
assessmentMode
=
usess
.
isInAssessmentModeProcess
();
if
(
siteClassName
!=
null
)
{
if
(!
assessmentMode
)
{
dts
.
activateStatic
(
ureq
,
siteClassName
,
context
.
getContext
());
launched
=
true
;
}
}
else
if
(!
assessmentMode
||
usess
.
matchLockResource
(
ores
))
{
// get current tab or create new tab
DTab
dt
=
dts
.
getDTab
(
ores
);
if
(
dt
==
null
)
{
WindowControl
bwControl
=
BusinessControlFactory
.
getInstance
().
createBusinessWindowControl
(
bc
,
dts
.
getWindowControl
());
usess
.
addToHistory
(
ureq
,
bc
);
Controller
launchC
=
typeHandler
.
createController
(
ces
,
ureq
,
bwControl
);
if
(
launchC
!=
null
)
{
dt
=
dts
.
createDTab
(
context
.
getTabResource
(),
re
,
launchC
,
context
.
getName
());
if
(
dt
==
null
)
{
launched
=
false
;
}
else
if
(
dts
.
addDTab
(
ureq
,
dt
))
{
dts
.
activate
(
ureq
,
dt
,
context
.
getContext
());
launched
=
true
;
}
}
}
}
else
{
dts
.
activate
(
ureq
,
dt
,
context
.
getContext
());
launched
=
true
;
}
}
}
else
{
dts
.
activate
(
ureq
,
dt
,
context
.
getContext
());
launched
=
true
;
}
}
DBFactory
.
getInstance
().
commit
();
}
}
DBFactory
.
getInstance
().
commit
();
return
launched
;
return
launched
;
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment