Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
synergy-api-util
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Raimbek Egemberdiev
synergy-api-util
Commits
fbbacc33
Commit
fbbacc33
authored
Nov 10, 2016
by
Raimbek Egemberdiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save
parent
81f08031
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
29 additions
and
13 deletions
+29
-13
build.gradle
build.gradle
+1
-0
src/main/java/kz/arta/synergy/api/RestHttpQuery.java
src/main/java/kz/arta/synergy/api/RestHttpQuery.java
+2
-1
src/main/java/kz/arta/synergy/api/asforms/AsFormProvider.java
...main/java/kz/arta/synergy/api/asforms/AsFormProvider.java
+8
-6
src/main/java/kz/arta/synergy/api/asforms/annotations/TextBox.java
...java/kz/arta/synergy/api/asforms/annotations/TextBox.java
+1
-1
src/main/java/kz/arta/synergy/api/asforms/pojo/AdvancedSearchParams.java
...z/arta/synergy/api/asforms/pojo/AdvancedSearchParams.java
+2
-0
src/main/java/kz/arta/synergy/api/asforms/pojo/AdvancedSearchResult.java
...z/arta/synergy/api/asforms/pojo/AdvancedSearchResult.java
+2
-0
src/main/java/kz/arta/synergy/api/asforms/pojo/AsForm.java
src/main/java/kz/arta/synergy/api/asforms/pojo/AsForm.java
+2
-0
src/main/java/kz/arta/synergy/api/asforms/pojo/AsFormData.java
...ain/java/kz/arta/synergy/api/asforms/pojo/AsFormData.java
+2
-0
src/main/java/kz/arta/synergy/api/asforms/pojo/AsFormDataContainer.java
...kz/arta/synergy/api/asforms/pojo/AsFormDataContainer.java
+2
-0
src/main/java/kz/arta/synergy/api/asforms/pojo/AsFormWrapper.java
.../java/kz/arta/synergy/api/asforms/pojo/AsFormWrapper.java
+2
-0
src/test/java/kz/arta/synergy/pojo/TableCmp.java
src/test/java/kz/arta/synergy/pojo/TableCmp.java
+2
-2
src/test/java/kz/arta/synergy/pojo/TestForm.java
src/test/java/kz/arta/synergy/pojo/TestForm.java
+3
-3
No files found.
build.gradle
View file @
fbbacc33
...
...
@@ -17,4 +17,5 @@ dependencies {
compile
group:
'com.google.guava'
,
name:
'guava'
,
version:
'19.0'
compile
(
group:
'org.codehaus.jackson'
,
name:
'jackson-core-asl'
,
version:
jacksonVersion
,
transitive:
false
)
compile
(
group:
'org.codehaus.jackson'
,
name:
'jackson-mapper-asl'
,
version:
jacksonVersion
,
transitive:
false
)
compile
group:
'com.fasterxml.jackson.core'
,
name:
'jackson-databind'
,
version:
'2.8.4'
}
src/main/java/kz/arta/synergy/api/RestHttpQuery.java
View file @
fbbacc33
...
...
@@ -47,7 +47,8 @@ public class RestHttpQuery {
DataOutputStream
request
=
new
DataOutputStream
(
conn
.
getOutputStream
());
if
(!
query
.
getFormParams
().
isEmpty
())
{
request
.
write
(
joinParamsForQuery
(
query
.
getFormParams
()).
getBytes
(
"UTF-8"
));
String
params
=
joinParamsForQuery
(
query
.
getFormParams
());
request
.
write
(
params
.
getBytes
(
"UTF-8"
));
}
else
if
(!
Strings
.
isNullOrEmpty
(
query
.
getBody
()))
{
request
.
write
(
query
.
getBody
().
getBytes
(
"UTF-8"
));
}
...
...
src/main/java/kz/arta/synergy/api/asforms/AsFormProvider.java
View file @
fbbacc33
...
...
@@ -66,7 +66,7 @@ public class AsFormProvider {
.
url
(
"/rest/api/asforms/data/save"
)
.
formParam
(
"formUUID"
,
asForm
.
getForm
())
.
formParam
(
"uuid"
,
asForm
.
getUuid
())
.
formParam
(
"data
=\"data\":"
,
JsonUtils
.
toJson
(
asFormWrapper
));
.
formParam
(
"data
"
,
"\"data\":"
+
JsonUtils
.
toJson
(
asFormWrapper
.
getData
()
));
return
restHttpQuery
.
doQuery
(
query
);
}
...
...
@@ -88,8 +88,8 @@ public class AsFormProvider {
for
(
Field
field
:
allFields
)
{
Annotation
[]
declaredAnnotations
=
field
.
getDeclaredAnnotations
();
for
(
Annotation
annotation
:
declaredAnnotations
)
{
if
(
annotation
instanceof
Text
Input
)
{
String
cmpId
=
((
Text
Input
)
annotation
).
value
();
if
(
annotation
instanceof
Text
Box
)
{
String
cmpId
=
((
Text
Box
)
annotation
).
value
();
dataContainer
.
addData
(
toAsfData
(
asForm
,
field
,
cmpId
,
index
,
ComponentTypes
.
TEXT_BOX
));
break
;
}
...
...
@@ -135,6 +135,8 @@ public class AsFormProvider {
}
private
<
T
>
AsFormData
toAsfData
(
T
asForm
,
Field
field
,
String
cmpId
,
String
index
,
String
type
)
throws
IllegalAccessException
{
field
.
setAccessible
(
true
);
if
(
index
!=
null
)
{
cmpId
=
cmpId
+
"-b"
+
index
;
}
...
...
@@ -146,7 +148,7 @@ public class AsFormProvider {
asFormData
.
setData
(
tableData
.
getData
());
}
}
field
.
setAccessible
(
true
);
Object
valueObject
=
field
.
get
(
asForm
);
if
(
valueObject
instanceof
AsFormData
)
{
AsFormData
asFormDataObject
=
(
AsFormData
)
valueObject
;
...
...
@@ -186,8 +188,8 @@ public class AsFormProvider {
for
(
Field
field
:
allFields
)
{
Annotation
[]
declaredAnnotations
=
field
.
getDeclaredAnnotations
();
for
(
Annotation
annotation
:
declaredAnnotations
)
{
if
(
annotation
instanceof
Text
Input
)
{
String
cmpId
=
((
Text
Input
)
annotation
).
value
();
if
(
annotation
instanceof
Text
Box
)
{
String
cmpId
=
((
Text
Box
)
annotation
).
value
();
setFieldValue
(
asfData
,
asFormObject
,
field
,
cmpId
,
index
,
ComponentTypes
.
TEXT_BOX
);
break
;
}
...
...
src/main/java/kz/arta/synergy/api/asforms/annotations/Text
Input
.java
→
src/main/java/kz/arta/synergy/api/asforms/annotations/Text
Box
.java
View file @
fbbacc33
...
...
@@ -11,7 +11,7 @@ import java.lang.annotation.Target;
*/
@Target
(
ElementType
.
FIELD
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
Text
Input
{
public
@interface
Text
Box
{
String
value
();
...
...
src/main/java/kz/arta/synergy/api/asforms/pojo/AdvancedSearchParams.java
View file @
fbbacc33
package
kz.arta.synergy.api.asforms.pojo
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
org.codehaus.jackson.annotate.JsonIgnoreProperties
;
import
java.util.ArrayList
;
...
...
@@ -11,6 +12,7 @@ import java.util.List;
* @since 02.11.2016
*/
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
AdvancedSearchParams
{
private
String
query
;
private
List
<
String
>
parameters
=
new
ArrayList
<
String
>();
...
...
src/main/java/kz/arta/synergy/api/asforms/pojo/AdvancedSearchResult.java
View file @
fbbacc33
package
kz.arta.synergy.api.asforms.pojo
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
org.codehaus.jackson.annotate.JsonIgnoreProperties
;
/**
...
...
@@ -7,6 +8,7 @@ import org.codehaus.jackson.annotate.JsonIgnoreProperties;
* @since 02.11.2016
*/
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
AdvancedSearchResult
{
private
String
dataUUID
;
private
String
documentID
;
...
...
src/main/java/kz/arta/synergy/api/asforms/pojo/AsForm.java
View file @
fbbacc33
package
kz.arta.synergy.api.asforms.pojo
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
org.codehaus.jackson.annotate.JsonIgnoreProperties
;
/**
...
...
@@ -7,6 +8,7 @@ import org.codehaus.jackson.annotate.JsonIgnoreProperties;
* @since 09.11.2016
*/
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
AsForm
{
private
String
nodeUUID
;
...
...
src/main/java/kz/arta/synergy/api/asforms/pojo/AsFormData.java
View file @
fbbacc33
package
kz.arta.synergy.api.asforms.pojo
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
org.codehaus.jackson.annotate.JsonIgnoreProperties
;
import
java.util.List
;
...
...
@@ -9,6 +10,7 @@ import java.util.List;
* @since 09.11.2016
*/
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
AsFormData
extends
AsFormDataContainer
{
private
String
id
;
private
String
type
;
...
...
src/main/java/kz/arta/synergy/api/asforms/pojo/AsFormDataContainer.java
View file @
fbbacc33
package
kz.arta.synergy.api.asforms.pojo
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
org.codehaus.jackson.annotate.JsonIgnoreProperties
;
import
java.util.ArrayList
;
...
...
@@ -10,6 +11,7 @@ import java.util.List;
* @since 10.11.2016
*/
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
AsFormDataContainer
{
private
List
<
AsFormData
>
data
;
...
...
src/main/java/kz/arta/synergy/api/asforms/pojo/AsFormWrapper.java
View file @
fbbacc33
package
kz.arta.synergy.api.asforms.pojo
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
org.codehaus.jackson.annotate.JsonIgnoreProperties
;
/**
...
...
@@ -7,6 +8,7 @@ import org.codehaus.jackson.annotate.JsonIgnoreProperties;
* @since 09.11.2016
*/
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
AsFormWrapper
extends
AsFormDataContainer
{
private
String
nodeUUID
;
private
String
uuid
;
...
...
src/test/java/kz/arta/synergy/pojo/TableCmp.java
View file @
fbbacc33
...
...
@@ -2,7 +2,7 @@ package kz.arta.synergy.pojo;
import
kz.arta.synergy.api.asforms.annotations.KeyValue
;
import
kz.arta.synergy.api.asforms.annotations.NumericInput
;
import
kz.arta.synergy.api.asforms.annotations.Text
Input
;
import
kz.arta.synergy.api.asforms.annotations.Text
Box
;
/**
* @author raimbek
...
...
@@ -10,7 +10,7 @@ import kz.arta.synergy.api.asforms.annotations.TextInput;
*/
public
class
TableCmp
{
@Text
Input
(
"table_input"
)
@Text
Box
(
"table_input"
)
private
String
tableInput
;
@KeyValue
...
...
src/test/java/kz/arta/synergy/pojo/TestForm.java
View file @
fbbacc33
...
...
@@ -13,7 +13,7 @@ import java.util.List;
*/
public
class
TestForm
extends
AsForm
{
@Text
Input
(
"text_input"
)
@Text
Box
(
"text_input"
)
private
String
textInput
;
@KeyValue
...
...
@@ -26,10 +26,10 @@ public class TestForm extends AsForm {
@Cmp
(
id
=
"file"
,
type
=
ComponentTypes
.
FILE
)
private
AsFormData
file
;
@Text
Input
(
"double_input"
)
@Text
Box
(
"double_input"
)
private
Double
doubleValue
;
@Text
Input
(
"integer_input"
)
@Text
Box
(
"integer_input"
)
private
Integer
integerValue
;
public
String
getTextInput
()
{
...
...
Write
Preview
Markdown
is supported
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