Skip to content

Commit 85a2db8

Browse files
committed
minor fixes (Issue #32)
1 parent 677753b commit 85a2db8

19 files changed

Lines changed: 541 additions & 440 deletions

src/main/java/org/imixs/application/model/ModelController.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ public List<String> getGroups(String version) {
137137
* Workflow groups of the system model will be skipped.
138138
*
139139
* A workflowGroup with a '~' in its name will be skipped. This indicates a
140-
* child process.
140+
* child process. The model 'marty-*' will be ignored as this is the system
141+
* model.
141142
*
142143
* The worflowGroup list is used to assign a workflow Group to a core process.
143144
*
@@ -149,7 +150,7 @@ public List<String> getWorkflowGroups() throws ModelException {
149150
for (BPMNModel model : modelService.getModelManager().getAllModels()) {
150151
String version = BPMNUtil.getVersion(model);
151152
// Skip system model..
152-
if (version.startsWith("system-")) {
153+
if (version.startsWith("system-") || version.startsWith("marty-")) {
153154
continue;
154155
}
155156
Set<String> groups = modelService.getModelManager().findAllGroupsByModel(model);

src/main/java/org/imixs/application/ui/view/ProfileViewController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class ProfileViewController extends ViewController {
2626
@PostConstruct
2727
public void init() {
2828
super.init();
29-
this.setQuery("(type:\"profile\") OR (type:\"profilearchive\")");
29+
this.setQuery("(type:profile*) ");
3030
this.setSortBy("txtname");
3131
this.setSortReverse(false);
3232
this.setPageSize(adminViewPageSize);

src/main/java/org/imixs/application/ui/view/TeamListController.java

Lines changed: 121 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
package org.imixs.application.ui.view;
22

3+
import java.util.List;
34
import java.util.logging.Logger;
5+
import java.util.regex.Matcher;
6+
import java.util.regex.Pattern;
7+
import java.util.stream.Collectors;
48

59
import org.imixs.application.config.PropertyController;
10+
import org.imixs.marty.team.TeamController;
11+
import org.imixs.workflow.ItemCollection;
612
import org.imixs.workflow.engine.WorkflowService;
713
import org.imixs.workflow.exceptions.ModelException;
814
import org.imixs.workflow.faces.data.ViewController;
@@ -35,11 +41,14 @@ public class TeamListController extends ViewController {
3541
@Inject
3642
protected PropertyController propertyController;
3743

44+
@Inject
45+
TeamController teamController;
46+
3847
@Override
3948
@PostConstruct
4049
public void init() {
4150
super.init();
42-
this.setQuery("(type:team*)");
51+
this.setQuery("(type:space*)");
4352
this.setSortBy("name");
4453
this.setSortReverse(false);
4554
this.setLoadStubs(false);
@@ -54,4 +63,115 @@ public void create() throws ModelException {
5463
workflowController.create(propertyController.getProperty("setup.system.model"), 100, null);
5564
}
5665

66+
/**
67+
* Returns the teams to part of the selection.
68+
*
69+
* Depending on the options the list can be either the complete list of spaces
70+
* or a subset.
71+
*
72+
* Possible Options are:
73+
*
74+
*
75+
*
76+
* @param workitem
77+
* @param options
78+
* @return
79+
*/
80+
public List<ItemCollection> getTeams(ItemCollection workitem, String options) {
81+
if (options == null) {
82+
options = "";
83+
}
84+
List<ItemCollection> result = null;
85+
if (options.toLowerCase().contains("byprocess=true")) {
86+
result = teamController.getSpacesByProcessId(workitem.getItemValueString("process.ref"));
87+
} else {
88+
result = teamController.getSpaces();
89+
}
90+
91+
// apply regex filter?
92+
if (options.contains("regex=")) {
93+
String _regex = extractRegexValue(options);
94+
Pattern pattern = Pattern.compile(_regex);
95+
return result.stream()
96+
.filter(space -> pattern.matcher(space.getItemValueString("name")).matches())
97+
.collect(Collectors.toList());
98+
}
99+
// default result
100+
return result;
101+
102+
}
103+
104+
/**
105+
* This method updates the space.ref item with the first space ID the current
106+
* user is member of.
107+
* The method is used as a default selector by form part 'spaceref.xhtml'
108+
*
109+
* The method updates the items space.ref and space.name and returns the
110+
* space.ref
111+
*
112+
* Possible Options are:
113+
*
114+
* <pre>
115+
* default-selection=member | The first section, the current user is member of will be pre-selected.
116+
* default-selection=team | The first section, the current user is team member of will be pre-selected.
117+
* default-selection=manager | The first section, the current user is manager of will be pre-selected.
118+
* default-selection=assist | The first section, the current user is assist of will be pre-selected.
119+
* </pre>
120+
*/
121+
public String setDefaultTeam(ItemCollection workitem, String options) {
122+
if (options == null) {
123+
options = "";
124+
}
125+
126+
// return if space.ref is already set!
127+
if (!workitem.getItemValueString("space.ref").isEmpty()) {
128+
return ""; // no op!
129+
}
130+
131+
ItemCollection defaultSpace = null;
132+
List<ItemCollection> _spaceList = getTeams(workitem, options);
133+
134+
// find a matching space in the spaces list.
135+
if (_spaceList != null) {
136+
for (ItemCollection space : _spaceList) {
137+
if (options.toLowerCase().contains("default-selection=assist")
138+
&& space.getItemValueBoolean("isAssist")) {
139+
defaultSpace = space;
140+
break;
141+
}
142+
if (options.toLowerCase().contains("default-selection=team") && space.getItemValueBoolean("isTeam")) {
143+
defaultSpace = space;
144+
break;
145+
}
146+
if (options.toLowerCase().contains("default-selection=manager")
147+
&& space.getItemValueBoolean("isManager")) {
148+
defaultSpace = space;
149+
break;
150+
}
151+
152+
if (options.toLowerCase().contains("default-selection=member")
153+
&& space.getItemValueBoolean("isMember")) {
154+
defaultSpace = space;
155+
break;
156+
}
157+
}
158+
}
159+
160+
// do we have a match?
161+
if (defaultSpace != null) {
162+
workitem.setItemValue("space.ref", defaultSpace.getUniqueID());
163+
workitem.setItemValue("space.parent.name", defaultSpace.getItemValueString("space.parent.name"));
164+
workitem.setItemValue("space.name", defaultSpace.getItemValueString("space.name"));
165+
return defaultSpace.getUniqueID();
166+
}
167+
168+
// no match !
169+
return "";
170+
}
171+
172+
private static String extractRegexValue(String input) {
173+
Pattern pattern = Pattern.compile("regex=([^;]+)");
174+
Matcher matcher = pattern.matcher(input);
175+
return matcher.find() ? matcher.group(1) : null;
176+
}
57177
}

src/main/resources/marty-1.0.0.bpmn

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ System Model: marty-1.0]]></bpmn2:text>
480480
<imixs:value><![CDATA[nammanager]]></imixs:value>
481481
</imixs:item>
482482
<imixs:item name="txttype" type="xs:string">
483-
<imixs:value><![CDATA[team]]></imixs:value>
483+
<imixs:value><![CDATA[space]]></imixs:value>
484484
</imixs:item>
485485
</bpmn2:extensionElements>
486486
<bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
@@ -560,7 +560,7 @@ System Model: marty-1.0]]></bpmn2:text>
560560
<imixs:value><![CDATA[org.imixs.ACCESSLEVEL.MANAGERACCESS]]></imixs:value>
561561
</imixs:item>
562562
<imixs:item name="txttype" type="xs:string">
563-
<imixs:value><![CDATA[teamdeleted]]></imixs:value>
563+
<imixs:value><![CDATA[spacedeleted]]></imixs:value>
564564
</imixs:item>
565565
</bpmn2:extensionElements>
566566
<bpmn2:incoming>SequenceFlow_15</bpmn2:incoming>
@@ -675,7 +675,7 @@ System Model: marty-1.0]]></bpmn2:text>
675675
<imixs:value><![CDATA[nammanager]]></imixs:value>
676676
</imixs:item>
677677
<imixs:item name="txttype" type="xs:string">
678-
<imixs:value><![CDATA[teamarchive]]></imixs:value>
678+
<imixs:value><![CDATA[spacearchive]]></imixs:value>
679679
</imixs:item>
680680
</bpmn2:extensionElements>
681681
<bpmn2:incoming>SequenceFlow_12</bpmn2:incoming>

0 commit comments

Comments
 (0)