Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bonita
bonita-studio
Commits
e58b2a20
Commit
e58b2a20
authored
Mar 03, 2015
by
Romain Bioteau
Browse files
update mapping form
parent
90da1a18
Changes
3
Hide whitespace changes
Inline
Side-by-side
bundles/plugins/org.bonitasoft.studio.pagedesigner/messages.properties
View file @
e58b2a20
...
...
@@ -7,4 +7,4 @@ pageDesigner=Page designer
externalURL
=
External URL
targetForm
=
Target form
url
=
URL
pageDoesntExists
=
Page '{0}' doesn't exists.
\ No newline at end of file
pageDoesntExists
=
Page
\'
{0}
\'
doesn't exists.
\ No newline at end of file
bundles/plugins/org.bonitasoft.studio.pagedesigner/src-test/java/org/bonitasoft/studio/pagedesigner/core/bar/FormMappingBarResourceProviderTest.java
View file @
e58b2a20
...
...
@@ -64,9 +64,12 @@ public class FormMappingBarResourceProviderTest {
@Test
public
void
should_add_formMapping_resource_in_bar
()
throws
Exception
{
final
Pool
pool
=
aPool
().
havingOverviewFormMapping
(
aFormMapping
().
external
().
withURL
(
"http://www.bonitasoft.com"
))
.
havingFormMapping
(
aFormMapping
().
internal
().
havingTargetForm
(
anExpression
().
withContent
(
"process-form-id"
)))
.
havingElements
(
aTask
().
withName
(
"Step1"
).
havingFormMapping
(
aFormMapping
().
havingTargetForm
(
anExpression
().
withContent
(
"step-form-id"
))))
final
Pool
pool
=
aPool
()
.
havingOverviewFormMapping
(
aFormMapping
().
external
().
withURL
(
"http://www.bonitasoft.com"
))
.
havingFormMapping
(
aFormMapping
().
internal
().
havingTargetForm
(
anExpression
().
withName
(
"processForm"
).
withContent
(
"process-form-id"
)))
.
havingElements
(
aTask
().
withName
(
"Step1"
).
havingFormMapping
(
aFormMapping
().
havingTargetForm
(
anExpression
().
withName
(
"StepForm"
).
withContent
(
"step-form-id"
))))
.
build
();
final
FormMappingModel
formMappingModel
=
formMappingBarResourceProvider
.
buildFormMappingModel
(
pool
);
...
...
@@ -79,15 +82,18 @@ public class FormMappingBarResourceProviderTest {
assertThat
(
formMappingModel
.
getFormMappings
()).
hasSize
(
3
);
assertThat
(
formMappingModel
.
getFormMappings
()).
extracting
(
"external"
,
"form"
,
"type"
,
"taskname"
)
.
contains
(
tuple
(
true
,
"http://www.bonitasoft.com"
,
FormMappingType
.
PROCESS_OVERVIEW
,
null
),
tuple
(
false
,
"process
-f
orm
-id
"
,
FormMappingType
.
PROCESS_START
,
null
),
tuple
(
false
,
"
step-form-id
"
,
FormMappingType
.
TASK
,
"Step1"
));
tuple
(
false
,
"
custompage_
process
F
orm"
,
FormMappingType
.
PROCESS_START
,
null
),
tuple
(
false
,
"
custompage_StepForm
"
,
FormMappingType
.
TASK
,
"Step1"
));
}
@Test
public
void
should_not_add_formMapping_resource_in_bar_if_mapping_is_invalid
()
throws
Exception
{
final
Pool
pool
=
aPool
().
havingOverviewFormMapping
(
aFormMapping
().
external
().
withURL
(
""
))
final
Pool
pool
=
aPool
()
.
havingOverviewFormMapping
(
aFormMapping
().
external
().
withURL
(
""
))
.
havingFormMapping
(
aFormMapping
().
internal
().
havingTargetForm
(
anExpression
().
withContent
(
null
)))
.
havingElements
(
aTask
().
withName
(
"Step1"
).
havingFormMapping
(
aFormMapping
().
havingTargetForm
(
anExpression
().
withContent
(
"step-form-id"
))))
.
havingElements
(
aTask
().
withName
(
"Step1"
).
havingFormMapping
(
aFormMapping
().
havingTargetForm
(
anExpression
().
withName
(
"Step1"
).
withContent
(
"step-form-id"
))))
.
build
();
final
FormMappingModel
formMappingModel
=
formMappingBarResourceProvider
.
buildFormMappingModel
(
pool
);
...
...
@@ -100,6 +106,6 @@ public class FormMappingBarResourceProviderTest {
assertThat
(
formMappingModel
.
getFormMappings
()).
hasSize
(
1
);
assertThat
(
formMappingModel
.
getFormMappings
()).
extracting
(
"external"
,
"form"
,
"type"
,
"taskname"
)
.
contains
(
tuple
(
false
,
"
step-form-id
"
,
FormMappingType
.
TASK
,
"Step1"
));
tuple
(
false
,
"
custompage_Step1
"
,
FormMappingType
.
TASK
,
"Step1"
));
}
}
bundles/plugins/org.bonitasoft.studio.pagedesigner/src/org/bonitasoft/studio/pagedesigner/core/bar/FormMappingBarResourceProvider.java
View file @
e58b2a20
...
...
@@ -80,7 +80,7 @@ public class FormMappingBarResourceProvider implements BARResourcesProvider {
}
private
String
formValue
(
final
FormMapping
formMapping
)
{
return
formMapping
.
isExternal
()
?
formMapping
.
getUrl
()
:
formMapping
.
getTargetForm
().
get
Content
(
);
return
formMapping
.
isExternal
()
?
formMapping
.
getUrl
()
:
String
.
format
(
"custompage_%s"
,
formMapping
.
getTargetForm
().
get
Name
()
);
}
private
String
taskName
(
final
FormMapping
formMapping
)
{
...
...
@@ -93,6 +93,6 @@ public class FormMappingBarResourceProvider implements BARResourcesProvider {
}
private
boolean
isValid
(
final
FormMapping
formMapping
)
{
return
formMapping
.
isExternal
()
?
!
isNullOrEmpty
(
formMapping
.
getUrl
())
:
formMapping
.
getTargetForm
().
has
Content
();
return
formMapping
.
isExternal
()
?
!
isNullOrEmpty
(
formMapping
.
getUrl
())
:
formMapping
.
getTargetForm
().
has
Name
();
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment