Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
uphrh-smf-form
Commits
24a36abb
Commit
24a36abb
authored
2 years ago
by
Saroj Singh
Browse files
Options
Download
Patches
Plain Diff
delete form
parent
eafda528
master
delete-form
1 merge request
!10
Delete form
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/main/java/com/tarento/formservice/controllers/FormsController.java
+14
-0
.../com/tarento/formservice/controllers/FormsController.java
src/main/java/com/tarento/formservice/model/Status.java
+2
-1
src/main/java/com/tarento/formservice/model/Status.java
src/main/java/com/tarento/formservice/service/impl/FormsServiceImpl.java
+2
-1
...om/tarento/formservice/service/impl/FormsServiceImpl.java
with
18 additions
and
2 deletions
+18
-2
src/main/java/com/tarento/formservice/controllers/FormsController.java
+
14
−
0
View file @
24a36abb
...
...
@@ -78,6 +78,20 @@ public class FormsController {
}
return
ResponseGenerator
.
successResponse
(
formsService
.
getFormById
(
formId
));
}
@PostMapping
(
value
=
PathRoutes
.
FormServiceApi
.
GET_FORM_BY_ID
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
String
deleteFormById
(
@RequestHeader
(
value
=
Constants
.
Parameters
.
X_USER_INFO
,
required
=
false
)
String
xUserInfo
,
@RequestParam
(
value
=
Constants
.
ID
,
required
=
true
)
String
id
)
throws
JsonProcessingException
{
Long
formId
=
null
;
if
(
id
.
length
()
<=
13
)
{
formId
=
Long
.
parseLong
(
id
);
}
else
if
(
id
instanceof
String
)
{
FormData
fData
=
decodeValue
(
String
.
valueOf
(
id
));
formId
=
fData
.
getId
();
}
return
ResponseGenerator
.
successResponse
(
formsService
.
getFormById
(
formId
));
}
@PostMapping
(
value
=
PathRoutes
.
FormServiceApi
.
CREATE_FORM
)
public
String
createForm
(
@RequestBody
FormDetail
form
,
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/tarento/formservice/model/Status.java
+
2
−
1
View file @
24a36abb
...
...
@@ -4,7 +4,8 @@ import com.fasterxml.jackson.annotation.JsonValue;
public
enum
Status
{
DRAFT
(
"Draft"
),
NEW
(
"New"
),
REVIEW
(
"Review"
),
PUBLISH
(
"Publish"
),
UNPUBLISH
(
"Unpublish"
),
INSCOMPLETED
(
"INSCOMPLETED"
),
LEADINSCOMPLETED
(
"LEADINSCOMPLETED"
),
SENTFORINS
(
"SENTFORINS"
);
"INSCOMPLETED"
),
LEADINSCOMPLETED
(
"LEADINSCOMPLETED"
),
SENTFORINS
(
"SENTFORINS"
),
DELETED
(
"Deleted"
),
DUPLICATE
(
"Duplicate"
);
private
String
value
;
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/tarento/formservice/service/impl/FormsServiceImpl.java
+
2
−
1
View file @
24a36abb
...
...
@@ -286,13 +286,14 @@ public class FormsServiceImpl implements FormsService {
}
else
{
boolQuery
.
must
(
QueryBuilders
.
matchPhraseQuery
(
Constants
.
STATUS
,
Status
.
PUBLISH
.
name
()));
}
boolQuery
.
mustNot
(
QueryBuilders
.
matchPhraseQuery
(
Constants
.
STATUS
,
Status
.
DELETED
.
name
()));
return
boolQuery
;
}
private
SearchRequest
buildQueryForGetQueryById
(
Long
id
)
{
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
().
size
(
0
)
.
query
(
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
matchQuery
(
"id"
,
id
)))
.
query
(
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
matchQuery
(
"id"
,
id
))
.
mustNot
(
QueryBuilders
.
matchPhraseQuery
(
Constants
.
STATUS
,
Status
.
DELETED
.
name
()))
)
.
aggregation
(
AggregationBuilders
.
terms
(
"UniqueFormId"
).
field
(
"id"
).
size
(
100
)
.
subAggregation
(
AggregationBuilders
.
topHits
(
"LatestVersion"
).
from
(
0
).
size
(
1
)
.
version
(
Boolean
.
FALSE
).
explain
(
Boolean
.
FALSE
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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
Menu
Explore
Projects
Groups
Topics
Snippets