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
f5ebfd9a
Commit
f5ebfd9a
authored
Nov 10, 2016
by
Raimbek Egemberdiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
as form utils
parent
ca814402
Changes
29
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
858 additions
and
115 deletions
+858
-115
build.gradle
build.gradle
+4
-3
src/main/java/kz/arta/synergy/api/ConfigProvider.java
src/main/java/kz/arta/synergy/api/ConfigProvider.java
+8
-0
src/main/java/kz/arta/synergy/api/SynergyApiProvider.java
src/main/java/kz/arta/synergy/api/SynergyApiProvider.java
+18
-0
src/main/java/kz/arta/synergy/api/asforms/AsFormProvider.java
...main/java/kz/arta/synergy/api/asforms/AsFormProvider.java
+310
-0
src/main/java/kz/arta/synergy/api/asforms/AsfTableUtil.java
src/main/java/kz/arta/synergy/api/asforms/AsfTableUtil.java
+81
-0
src/main/java/kz/arta/synergy/api/asforms/annotations/Cmp.java
...ain/java/kz/arta/synergy/api/asforms/annotations/Cmp.java
+20
-0
src/main/java/kz/arta/synergy/api/asforms/annotations/Entity.java
.../java/kz/arta/synergy/api/asforms/annotations/Entity.java
+2
-2
src/main/java/kz/arta/synergy/api/asforms/annotations/Form.java
...in/java/kz/arta/synergy/api/asforms/annotations/Form.java
+21
-0
src/main/java/kz/arta/synergy/api/asforms/annotations/KeyValue.java
...ava/kz/arta/synergy/api/asforms/annotations/KeyValue.java
+2
-2
src/main/java/kz/arta/synergy/api/asforms/annotations/ListBox.java
...java/kz/arta/synergy/api/asforms/annotations/ListBox.java
+2
-2
src/main/java/kz/arta/synergy/api/asforms/annotations/NumericInput.java
...kz/arta/synergy/api/asforms/annotations/NumericInput.java
+2
-2
src/main/java/kz/arta/synergy/api/asforms/annotations/Table.java
...n/java/kz/arta/synergy/api/asforms/annotations/Table.java
+8
-3
src/main/java/kz/arta/synergy/api/asforms/annotations/TextInput.java
...va/kz/arta/synergy/api/asforms/annotations/TextInput.java
+2
-2
src/main/java/kz/arta/synergy/api/asforms/exceptions/CreateAsFormException.java
...synergy/api/asforms/exceptions/CreateAsFormException.java
+2
-2
src/main/java/kz/arta/synergy/api/asforms/exceptions/SynergyApiCallException.java
...nergy/api/asforms/exceptions/SynergyApiCallException.java
+2
-2
src/main/java/kz/arta/synergy/api/asforms/exceptions/UnsupportedFieldTypeException.java
...api/asforms/exceptions/UnsupportedFieldTypeException.java
+2
-2
src/main/java/kz/arta/synergy/api/asforms/pojo/AdvancedSearchParams.java
...z/arta/synergy/api/asforms/pojo/AdvancedSearchParams.java
+1
-1
src/main/java/kz/arta/synergy/api/asforms/pojo/AdvancedSearchResult.java
...z/arta/synergy/api/asforms/pojo/AdvancedSearchResult.java
+2
-2
src/main/java/kz/arta/synergy/api/asforms/pojo/AsForm.java
src/main/java/kz/arta/synergy/api/asforms/pojo/AsForm.java
+48
-0
src/main/java/kz/arta/synergy/api/asforms/pojo/AsFormData.java
...ain/java/kz/arta/synergy/api/asforms/pojo/AsFormData.java
+18
-7
src/main/java/kz/arta/synergy/api/asforms/pojo/AsFormDataContainer.java
...kz/arta/synergy/api/asforms/pojo/AsFormDataContainer.java
+12
-40
src/main/java/kz/arta/synergy/api/asforms/pojo/AsFormWrapper.java
.../java/kz/arta/synergy/api/asforms/pojo/AsFormWrapper.java
+47
-0
src/main/java/kz/arta/synergy/api/asforms/pojo/ComponentTypes.java
...java/kz/arta/synergy/api/asforms/pojo/ComponentTypes.java
+24
-0
src/main/java/kz/arta/synergy/asforms/SynergyApiProvider.java
...main/java/kz/arta/synergy/asforms/SynergyApiProvider.java
+0
-14
src/test/java/kz/arta/synergy/api/asforms/AsFormProviderTest.java
.../java/kz/arta/synergy/api/asforms/AsFormProviderTest.java
+114
-0
src/test/java/kz/arta/synergy/api/asforms/AsFormTest.java
src/test/java/kz/arta/synergy/api/asforms/AsFormTest.java
+2
-1
src/test/java/kz/arta/synergy/asforms/AsFormProviderTest.java
...test/java/kz/arta/synergy/asforms/AsFormProviderTest.java
+0
-18
src/test/java/kz/arta/synergy/pojo/TableCmp.java
src/test/java/kz/arta/synergy/pojo/TableCmp.java
+35
-0
src/test/java/kz/arta/synergy/pojo/TestForm.java
src/test/java/kz/arta/synergy/pojo/TestForm.java
+69
-10
No files found.
build.gradle
View file @
f5ebfd9a
group
'kz.arta.synergy.a
sforms
'
group
'kz.arta.synergy.a
pi
'
version
'1.0'
apply
plugin:
'java'
...
...
@@ -10,6 +10,7 @@ repositories {
}
dependencies
{
compile
group:
'cglib'
,
name:
'cglib'
,
version:
'3.2.4'
testCompile
group:
'org.testng'
,
name:
'testng'
,
version:
'6.9.13.6'
// compile group: 'cglib', name: 'cglib', version: '3.2.4'
testCompile
group:
'org.testng'
,
name:
'testng'
,
version:
'6.8'
testCompile
group:
'org.mockito'
,
name:
'mockito-all'
,
version:
'1.9.5'
}
src/main/java/kz/arta/synergy/api/ConfigProvider.java
0 → 100644
View file @
f5ebfd9a
package
kz.arta.synergy.api
;
/**
* @author raimbek
* @since 10.11.2016
*/
public
class
ConfigProvider
{
}
src/main/java/kz/arta/synergy/api/SynergyApiProvider.java
0 → 100644
View file @
f5ebfd9a
package
kz.arta.synergy.api
;
import
kz.arta.synergy.api.asforms.exceptions.SynergyApiCallException
;
import
kz.arta.synergy.api.asforms.pojo.AsFormWrapper
;
/**
* @author raimbek
* @since 09.11.2016
*/
public
class
SynergyApiProvider
{
public
AsFormWrapper
getAsfData
(
String
dataUUID
)
throws
SynergyApiCallException
{
return
new
AsFormWrapper
();
}
public
String
saveData
(
AsFormWrapper
asfData
)
{
return
null
;
}
}
src/main/java/kz/arta/synergy/asforms/AsFormProvider.java
→
src/main/java/kz/arta/synergy/a
pi/a
sforms/AsFormProvider.java
View file @
f5ebfd9a
This diff is collapsed.
Click to expand it.
src/main/java/kz/arta/synergy/api/asforms/AsfTableUtil.java
0 → 100644
View file @
f5ebfd9a
package
kz.arta.synergy.api.asforms
;
import
kz.arta.synergy.api.asforms.pojo.AsFormData
;
import
kz.arta.synergy.api.asforms.pojo.AsFormDataContainer
;
import
java.util.Set
;
import
java.util.TreeSet
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* User: vsl
* Date: 3/18/15
* Time: 9:48 AM
*
* Утилиты для работы с данными форм
*/
public
class
AsfTableUtil
{
private
static
final
Pattern
BLOCK_ID_PATTERN
=
Pattern
.
compile
(
"(.*)-b([0-9]{1,})$"
);
/**
* Есть ли табличный индекс в id
*/
public
static
boolean
hasBIndex
(
String
id
)
{
return
BLOCK_ID_PATTERN
.
matcher
(
id
).
matches
();
}
/**
* Возвращает табличный индекс из id, если его нет - null
*/
public
static
String
getBindex
(
String
id
)
{
Matcher
matcher
=
BLOCK_ID_PATTERN
.
matcher
(
id
);
if
(!
matcher
.
matches
())
{
return
null
;
}
else
{
return
matcher
.
group
(
2
);
}
}
/**
* Возвращает часть id без табличного индекса если он есть,
* если нет - просто возвращает id
*/
public
static
String
getBlockComponentId
(
String
id
)
{
Matcher
matcher
=
BLOCK_ID_PATTERN
.
matcher
(
id
);
if
(!
matcher
.
matches
())
{
return
id
;
}
else
{
return
matcher
.
group
(
1
);
}
}
/**
* Возвращает табличный индекс из id, если его нет -1
*/
public
static
int
getIntBindex
(
String
id
)
{
String
bIndex
=
getBindex
(
id
);
if
(
bIndex
==
null
||
bIndex
.
isEmpty
())
{
return
-
1
;
}
try
{
return
Integer
.
parseInt
(
bIndex
);
}
catch
(
NumberFormatException
e
)
{
return
-
1
;
}
}
public
static
Set
<
String
>
tableBIndexes
(
AsFormDataContainer
asFormDataContainer
)
{
Set
<
String
>
indexes
=
new
TreeSet
<>();
for
(
AsFormData
data
:
asFormDataContainer
.
getData
())
{
if
(
data
==
null
||
data
.
getId
()
==
null
||
data
.
getId
().
isEmpty
())
{
continue
;
}
if
(
hasBIndex
(
data
.
getId
()))
{
indexes
.
add
(
getBindex
(
data
.
getId
()));
}
}
return
indexes
;
}
}
src/main/java/kz/arta/synergy/api/asforms/annotations/Cmp.java
0 → 100644
View file @
f5ebfd9a
package
kz.arta.synergy.api.asforms.annotations
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* @author raimbek
* @since 09.11.2016
*/
@Target
(
ElementType
.
FIELD
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
Cmp
{
String
id
();
String
type
();
}
src/main/java/kz/arta/synergy/asforms/annotations/Entity.java
→
src/main/java/kz/arta/synergy/a
pi/a
sforms/annotations/Entity.java
View file @
f5ebfd9a
package
kz.arta.synergy.asforms.annotations
;
package
kz.arta.synergy.a
pi.a
sforms.annotations
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
...
...
@@ -9,7 +9,7 @@ import java.lang.annotation.Target;
* @author raimbek
* @since 09.11.2016
*/
@Target
(
{
ElementType
.
METHOD
,
ElementType
.
FIELD
}
)
@Target
(
ElementType
.
FIELD
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
Entity
{
...
...
src/main/java/kz/arta/synergy/api/asforms/annotations/Form.java
0 → 100644
View file @
f5ebfd9a
package
kz.arta.synergy.api.asforms.annotations
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* @author raimbek
* @since 10.11.2016
*/
@Target
(
ElementType
.
TYPE
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
Form
{
String
id
()
default
""
;
String
code
()
default
""
;
String
config
()
default
""
;
}
src/main/java/kz/arta/synergy/asforms/annotations/KeyValue.java
→
src/main/java/kz/arta/synergy/a
pi/a
sforms/annotations/KeyValue.java
View file @
f5ebfd9a
package
kz.arta.synergy.asforms.annotations
;
package
kz.arta.synergy.a
pi.a
sforms.annotations
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
...
...
@@ -9,7 +9,7 @@ import java.lang.annotation.Target;
* @author raimbek
* @since 09.11.2016
*/
@Target
(
{
ElementType
.
METHOD
,
ElementType
.
FIELD
}
)
@Target
(
ElementType
.
FIELD
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
KeyValue
{
...
...
src/main/java/kz/arta/synergy/asforms/annotations/ListBox.java
→
src/main/java/kz/arta/synergy/a
pi/a
sforms/annotations/ListBox.java
View file @
f5ebfd9a
package
kz.arta.synergy.asforms.annotations
;
package
kz.arta.synergy.a
pi.a
sforms.annotations
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
...
...
@@ -9,7 +9,7 @@ import java.lang.annotation.Target;
* @author raimbek
* @since 09.11.2016
*/
@Target
(
{
ElementType
.
METHOD
,
ElementType
.
FIELD
}
)
@Target
(
ElementType
.
FIELD
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
ListBox
{
...
...
src/main/java/kz/arta/synergy/asforms/annotations/NumericInput.java
→
src/main/java/kz/arta/synergy/a
pi/a
sforms/annotations/NumericInput.java
View file @
f5ebfd9a
package
kz.arta.synergy.asforms.annotations
;
package
kz.arta.synergy.a
pi.a
sforms.annotations
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
...
...
@@ -9,7 +9,7 @@ import java.lang.annotation.Target;
* @author raimbek
* @since 09.11.2016
*/
@Target
(
{
ElementType
.
METHOD
,
ElementType
.
FIELD
}
)
@Target
(
ElementType
.
FIELD
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
NumericInput
{
...
...
src/main/java/kz/arta/synergy/asforms/annotations/Table.java
→
src/main/java/kz/arta/synergy/a
pi/a
sforms/annotations/Table.java
View file @
f5ebfd9a
package
kz.arta.synergy.asforms.annotations
;
package
kz.arta.synergy.api.asforms.annotations
;
import
kz.arta.synergy.api.asforms.pojo.AsFormData
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
...
...
@@ -9,10 +11,13 @@ import java.lang.annotation.Target;
* @author raimbek
* @since 09.11.2016
*/
@Target
({
ElementType
.
METHOD
,
ElementType
.
FIELD
,
ElementType
.
TYPE
})
@Target
({
ElementType
.
FIELD
,
ElementType
.
TYPE
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
Table
{
String
value
();
String
value
()
default
""
;
String
id
()
default
""
;
Class
type
()
default
AsFormData
.
class
;
}
src/main/java/kz/arta/synergy/asforms/annotations/TextInput.java
→
src/main/java/kz/arta/synergy/a
pi/a
sforms/annotations/TextInput.java
View file @
f5ebfd9a
package
kz.arta.synergy.asforms.annotations
;
package
kz.arta.synergy.a
pi.a
sforms.annotations
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
...
...
@@ -9,7 +9,7 @@ import java.lang.annotation.Target;
* @author raimbek
* @since 09.11.2016
*/
@Target
(
{
ElementType
.
METHOD
,
ElementType
.
FIELD
}
)
@Target
(
ElementType
.
FIELD
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
TextInput
{
...
...
src/main/java/kz/arta/synergy/asforms/exceptions/CreateAsFormException.java
→
src/main/java/kz/arta/synergy/a
pi/a
sforms/exceptions/CreateAsFormException.java
View file @
f5ebfd9a
package
kz.arta.synergy.asforms.exceptions
;
package
kz.arta.synergy.a
pi.a
sforms.exceptions
;
/**
* @author raimbek
* @since 09.11.2016
*/
public
class
CreateAsFormException
extends
Exception
{
public
class
CreateAsFormException
extends
Runtime
Exception
{
public
CreateAsFormException
(
String
message
)
{
super
(
message
);
...
...
src/main/java/kz/arta/synergy/asforms/exceptions/SynergyApiCallException.java
→
src/main/java/kz/arta/synergy/a
pi/a
sforms/exceptions/SynergyApiCallException.java
View file @
f5ebfd9a
package
kz.arta.synergy.asforms.exceptions
;
package
kz.arta.synergy.a
pi.a
sforms.exceptions
;
/**
* @author raimbek
* @since 09.11.2016
*/
public
class
SynergyApiCallException
extends
Exception
{
public
class
SynergyApiCallException
extends
Runtime
Exception
{
public
SynergyApiCallException
()
{
}
...
...
src/main/java/kz/arta/synergy/asforms/exceptions/UnsupportedFieldTypeException.java
→
src/main/java/kz/arta/synergy/a
pi/a
sforms/exceptions/UnsupportedFieldTypeException.java
View file @
f5ebfd9a
package
kz.arta.synergy.asforms.exceptions
;
package
kz.arta.synergy.a
pi.a
sforms.exceptions
;
/**
* @author raimbek
* @since 09.11.2016
*/
public
class
UnsupportedFieldTypeException
extends
Exception
{
public
class
UnsupportedFieldTypeException
extends
Runtime
Exception
{
public
UnsupportedFieldTypeException
()
{
}
...
...
src/main/java/kz/arta/synergy/a
sforms
/AdvancedSearchParams.java
→
src/main/java/kz/arta/synergy/a
pi/asforms/pojo
/AdvancedSearchParams.java
View file @
f5ebfd9a
package
kz.arta.synergy.a
sforms
;
package
kz.arta.synergy.a
pi.asforms.pojo
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
...
...
src/main/java/kz/arta/synergy/a
sforms
/AdvancedSearchResult.java
→
src/main/java/kz/arta/synergy/a
pi/asforms/pojo
/AdvancedSearchResult.java
View file @
f5ebfd9a
package
kz.arta.synergy.a
sforms
;
package
kz.arta.synergy.a
pi.asforms.pojo
;
/**
* @author raimbek
* @since 02.11.2016
*/
public
class
AdvancedSearchResult
<
T
>
{
public
class
AdvancedSearchResult
{
private
String
dataUUID
;
private
String
documentID
;
private
String
registryRecordStatus
;
...
...
src/main/java/kz/arta/synergy/api/asforms/pojo/AsForm.java
0 → 100644
View file @
f5ebfd9a
package
kz.arta.synergy.api.asforms.pojo
;
/**
* @author raimbek
* @since 09.11.2016
*/
public
class
AsForm
{
private
String
nodeUUID
;
private
String
uuid
;
private
String
form
;
private
String
modified
;
public
AsForm
()
{
}
public
String
getNodeUUID
()
{
return
nodeUUID
;
}
public
void
setNodeUUID
(
String
nodeUUID
)
{
this
.
nodeUUID
=
nodeUUID
;
}
public
String
getUuid
()
{
return
uuid
;
}
public
void
setUuid
(
String
uuid
)
{
this
.
uuid
=
uuid
;
}
public
String
getForm
()
{
return
form
;
}
public
void
setForm
(
String
form
)
{
this
.
form
=
form
;
}
public
String
getModified
()
{
return
modified
;
}
public
void
setModified
(
String
modified
)
{
this
.
modified
=
modified
;
}
}
src/main/java/kz/arta/synergy/asforms/pojo/AsFormData.java
→
src/main/java/kz/arta/synergy/a
pi/a
sforms/pojo/AsFormData.java
View file @
f5ebfd9a
package
kz.arta.synergy.asforms.pojo
;
package
kz.arta.synergy.a
pi.a
sforms.pojo
;
import
java.util.List
;
...
...
@@ -6,7 +6,7 @@ import java.util.List;
* @author raimbek
* @since 09.11.2016
*/
public
class
AsFormData
{
public
class
AsFormData
extends
AsFormDataContainer
{
private
String
id
;
private
String
type
;
private
String
label
;
...
...
@@ -17,7 +17,6 @@ public class AsFormData {
private
String
userID
;
private
List
<
String
>
values
;
private
List
<
String
>
keys
;
private
List
<
AsFormData
>
data
;
public
String
getId
()
{
return
id
;
...
...
@@ -99,11 +98,23 @@ public class AsFormData {
this
.
keys
=
keys
;
}
public
List
<
AsFormData
>
getData
()
{
return
data
;
public
static
AsFormData
textbox
(
String
cmpId
,
String
value
)
{
AsFormData
asFormData
=
create
(
cmpId
,
ComponentTypes
.
TEXT_BOX
);
asFormData
.
setValue
(
value
);
return
asFormData
;
}
public
void
setData
(
List
<
AsFormData
>
data
)
{
this
.
data
=
data
;
public
static
AsFormData
numericinput
(
String
cmpId
,
String
value
,
String
key
)
{
AsFormData
asFormData
=
create
(
cmpId
,
ComponentTypes
.
NUMERIC_INPUT
);
asFormData
.
setValue
(
value
);
asFormData
.
setKey
(
key
);
return
asFormData
;
}
public
static
AsFormData
create
(
String
id
,
String
type
)
{
AsFormData
asFormData
=
new
AsFormData
();
asFormData
.
setId
(
id
);
asFormData
.
setType
(
type
);
return
asFormData
;
}
}
src/main/java/kz/arta/synergy/a
sforms/pojo/AsForm
.java
→
src/main/java/kz/arta/synergy/a
pi/asforms/pojo/AsFormDataContainer
.java
View file @
f5ebfd9a
package
kz.arta.synergy.asforms.pojo
;
package
kz.arta.synergy.a
pi.a
sforms.pojo
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author raimbek
* @since
09
.11.2016
* @since
10
.11.2016
*/
public
class
AsForm
{
public
class
AsForm
DataContainer
{
private
String
nodeUUID
;
private
String
uuid
;
private
String
form
;
private
String
modified
;
private
List
<
AsFormData
>
data
;
public
AsForm
()
{
public
AsForm
DataContainer
()
{
}
public
AsFormData
getData
(
String
cmpId
)
{
...
...
@@ -45,38 +42,6 @@ public class AsForm {
return
null
;
}
public
String
getNodeUUID
()
{
return
nodeUUID
;
}
public
void
setNodeUUID
(
String
nodeUUID
)
{
this
.
nodeUUID
=
nodeUUID
;
}
public
String
getUuid
()
{
return
uuid
;
}
public
void
setUuid
(
String
uuid
)
{
this
.
uuid
=
uuid
;
}
public
String
getForm
()
{
return
form
;
}
public
void
setForm
(
String
form
)
{
this
.
form
=
form
;
}
public
String
getModified
()
{
return
modified
;
}
public
void
setModified
(
String
modified
)
{
this
.
modified
=
modified
;
}
public
List
<
AsFormData
>
getData
()
{
return
data
;
}
...
...
@@ -84,4 +49,11 @@ public class AsForm {
public
void
setData
(
List
<
AsFormData
>
data
)
{
this
.
data
=
data
;
}
public
void
addData
(
AsFormData
data
)
{
if
(
this
.
data
==
null
)
{
this
.
data
=
new
ArrayList
<>();
}
this
.
data
.
add
(
data
);
}
}
src/main/java/kz/arta/synergy/api/asforms/pojo/AsFormWrapper.java
0 → 100644
View file @
f5ebfd9a
package
kz.arta.synergy.api.asforms.pojo
;
/**
* @author raimbek
* @since 09.11.2016
*/
public
class
AsFormWrapper
extends
AsFormDataContainer
{
private
String
nodeUUID
;
private
String
uuid
;
private
String
form
;
private
String
modified
;
public
AsFormWrapper
()
{
}
public
String
getNodeUUID
()
{
return
nodeUUID
;
}
public
void
setNodeUUID
(
String
nodeUUID
)
{
this
.
nodeUUID
=
nodeUUID
;
}
public
String
getUuid
()
{
return
uuid
;
}
public
void
setUuid
(
String
uuid
)
{
this
.
uuid
=
uuid
;
}
public
String
getForm
()
{
return
form
;
}
public
void
setForm
(
String
form
)
{
this
.
form
=
form
;
}
public
String
getModified
()
{
return
modified
;
}
public
void
setModified
(
String
modified
)
{
this
.
modified
=
modified
;
}
}
src/main/java/kz/arta/synergy/asforms/pojo/ComponentTypes.java
→
src/main/java/kz/arta/synergy/a
pi/a
sforms/pojo/ComponentTypes.java
View file @
f5ebfd9a
package
kz.arta.synergy.asforms.pojo
;
package
kz.arta.synergy.a
pi.a
sforms.pojo
;
/**
* @author raimbek
* @since 09.11.2016
*/
public
class
ComponentTypes
{
public
static
final
String
TEXT_
INPUT
=
"textinput
"
;
public
static
final
String
TEXT_
BOX
=
"textbox
"
;
public
static
final
String
NUMERIC_INPUT
=
"numericinput"
;
public
static
final
String
LISTBOX
=
"listbox"
;
public
static
final
String
ENTITY
=
"entity"
;
public
static
final
String
TABLE
=
"appendable_table"
;
public
static
final
String
FILE
=
"file"
;
public
static
final
String
TEXTAREA
=
"textarea"
;
public
static
final
String
HTD
=
"htd"
;
public
static
final
String
DATE
=
"date"
;
public
static
final
String
CHECK
=
"check"
;
public
static
final
String
RADIO
=
"radio"
;
public
static
final
String
IMAGE
=
"image"
;
public
static
final
String
LINK
=
"link"
;
public
static
final
String
PROJECT_LINK
=
"projectlink"
;
public
static
final
String
FILE_LINK
=
"filelink"
;
public
static
final
String
REG_LINK
=
"reglink"
;
}
src/main/java/kz/arta/synergy/asforms/SynergyApiProvider.java
deleted
100644 → 0
View file @
ca814402
package
kz.arta.synergy.asforms
;
import
kz.arta.synergy.asforms.exceptions.SynergyApiCallException
;
import
kz.arta.synergy.asforms.pojo.AsForm
;
/**
* @author raimbek
* @since 09.11.2016
*/
public
class
SynergyApiProvider
{
public
AsForm
getAsfData
(
String
dataUUID
)
throws
SynergyApiCallException
{
return
new
AsForm
();
}
}
src/test/java/kz/arta/synergy/api/asforms/AsFormProviderTest.java
0 → 100644
View file @
f5ebfd9a
package
kz.arta.synergy.api.asforms
;
import
kz.arta.synergy.api.SynergyApiProvider
;
import
kz.arta.synergy.api.asforms.pojo.AsFormData
;
import
kz.arta.synergy.api.asforms.pojo.AsFormWrapper
;
import
kz.arta.synergy.api.asforms.pojo.ComponentTypes
;
import
kz.arta.synergy.pojo.TableCmp
;
import
kz.arta.synergy.pojo.TestForm
;
import
org.mockito.Mockito
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
java.util.List
;
/**
* @author raimbek
* @since 09.11.2016
*/
public
class
AsFormProviderTest
{
String
expectedTextInputValue
=
"value_1"
;
String
expectedNumericInputValue
=
"value_2"
;
String
expectedNumericInputKey
=
"key_1"
;
String
expectedFileValue
=
"file_value"
;
String
expectedFileKey
=
"file_key"
;
String
expectedDoubleValue
=
"45.2"
;
String
expectedIntegerValue
=
"456"
;
String
expectedTableInputValueB1
=
"table_input_b1"
;
String
expectedTableInputValueB2
=
"table_input_b2"
;
TestForm
testForm
;
AsFormProvider
asFormProvider
;
@BeforeClass
public
void
createAsfWrapper
()
{
AsFormWrapper
asFormWrapper
=
new
AsFormWrapper
();
asFormWrapper
.
addData
(
AsFormData
.
textbox
(
"text_input"
,
expectedTextInputValue
));
asFormWrapper
.
addData
(
AsFormData
.
textbox
(
"double_input"
,
expectedDoubleValue
));
asFormWrapper
.
addData
(
AsFormData
.
textbox
(
"integer_input"
,
expectedIntegerValue
));
asFormWrapper
.
addData
(
AsFormData
.
numericinput
(
"numeric_input_key"
,
expectedNumericInputValue
,
expectedNumericInputKey
));
asFormWrapper
.
addData
(
AsFormData
.
numericinput
(
"numeric_input_value"
,
expectedNumericInputValue
,
expectedNumericInputKey
));
asFormWrapper
.
addData
(
AsFormData
.
numericinput
(
"file"
,
expectedFileValue
,
expectedFileKey
));
AsFormData
tableData
=
new
AsFormData
();
tableData
.
setType
(
ComponentTypes
.
TABLE
);
tableData
.
setId
(
"table_cmp"
);
tableData
.
addData
(
AsFormData
.
textbox
(
"table_input-b1"
,
expectedTableInputValueB1
));
tableData
.
addData
(
AsFormData
.
numericinput
(
"table_input_2-b1"
,
expectedTableInputValueB1
,
expectedTableInputValueB1
));
tableData
.
addData
(
AsFormData
.
textbox
(
"table_input-b2"
,
expectedTableInputValueB2
));
tableData
.
addData
(
AsFormData
.
numericinput
(
"table_input_2-b2"
,
expectedTableInputValueB2
,
expectedTableInputValueB2
));
asFormWrapper
.
getData
().
add
(
tableData
);
SynergyApiProvider
synergyApiProviderMock
=
Mockito
.
mock
(
SynergyApiProvider
.
class
);
Mockito
.
when
(
synergyApiProviderMock
.
getAsfData
(
Mockito
.
anyString
())).
thenReturn
(
asFormWrapper
);
asFormProvider
=
AsFormProvider
.
newInstance
(
synergyApiProviderMock
);
testForm
=
asFormProvider
.
fetch
(
TestForm
.
class
,
"123456"
);
}
@Test
public
void
testTextInputValue
()
{
Assert
.
assertEquals
(
testForm
.
getTextInput
(),
expectedTextInputValue
);
}
@Test
public
void
testNumericInputValue
()
{
Assert
.
assertEquals
(
testForm
.
getNumericInputValue
(),
expectedNumericInputValue
);
}
@Test
public
void
testNumericInputKey
()
{
Assert
.
assertEquals
(
testForm
.
getNumericInputKey
(),
expectedNumericInputKey
);
}
@Test
public
void
testFile
()
{
AsFormData
fileData
=
testForm
.
getFile
();
Assert
.
assertEquals
(
fileData
.
getValue
(),
expectedFileValue
);
Assert
.
assertEquals
(
fileData
.
getKey
(),
expectedFileKey
);
}
@Test
public
void
testDoubleValue
()
{
Assert
.
assertEquals
(
testForm
.
getDoubleValue
(),
Double
.
parseDouble
(
expectedDoubleValue
));
}
@Test
public
void
testIntegerValue
()
{
Assert
.
assertEquals
(
testForm
.
getIntegerValue
(),
Integer
.
parseInt
(
expectedIntegerValue
));
}
@Test
public
void
testTableData
()
{
List
<
TableCmp
>
tableData
=
testForm
.
getTableData
();
Assert
.
assertEquals
(
tableData
.
get
(
0
).
getTableInput
(),
expectedTableInputValueB1
);
Assert
.
assertEquals
(
tableData
.
get
(
1
).
getTableInput
(),
expectedTableInputValueB2
);
}
@Test
public
void
toAsfData
()
{
AsFormWrapper
asFormWrapper
=
asFormProvider
.
toAsfData
(
testForm
);
AsFormData
textInput
=
asFormWrapper
.
getData
(
"text_input"
);
Assert
.
assertEquals
(
textInput
.
getType
(),
ComponentTypes
.
TEXT_BOX
);
Assert
.
assertEquals
(
textInput
.
getValue
(),
expectedTextInputValue
);
AsFormData
tableCmp
=
asFormWrapper
.
getData
(
"table_cmp"
);
Assert
.
assertEquals
(
tableCmp
.
getData
().
size
(),
2
);
}
}
src/test/java/kz/arta/synergy/asforms/AsFormTest.java
→
src/test/java/kz/arta/synergy/a
pi/a
sforms/AsFormTest.java
View file @
f5ebfd9a
package
kz.arta.synergy.asforms
;
package
kz.arta.synergy.a
pi.a
sforms
;
import
kz.arta.synergy.api.SynergyApiProvider
;
import
org.testng.annotations.Test
;
/**
...
...
src/test/java/kz/arta/synergy/asforms/AsFormProviderTest.java
deleted
100644 → 0
View file @
ca814402
package
kz.arta.synergy.asforms
;
import
kz.arta.synergy.asforms.exceptions.CreateAsFormException
;
import
kz.arta.synergy.asforms.exceptions.SynergyApiCallException
;
import
kz.arta.synergy.pojo.TestForm
;
/**
* @author raimbek
* @since 09.11.2016
*/
public
class
AsFormProviderTest
{
public
static
void
main
(
String
[]
args
)
throws
SynergyApiCallException
,
CreateAsFormException
{
SynergyApiProvider
synergyApiProvider
=
new
SynergyApiProvider
();
AsFormProvider
asFormProvider
=
new
AsFormProvider
(
synergyApiProvider
);
TestForm
testForm
=
asFormProvider
.
fetchData
(
TestForm
.
class
,
"123456"
);
}
}
src/test/java/kz/arta/synergy/pojo/TableCmp.java
0 → 100644
View file @
f5ebfd9a
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.TextInput
;
/**
* @author raimbek
* @since 10.11.2016
*/
public
class
TableCmp
{
@TextInput
(
"table_input"
)
private
String
tableInput
;
@KeyValue
@NumericInput
(
"table_input_2"
)
private
String
textInputKeyValue
;
public
String
getTableInput
()
{
return
tableInput
;
}
public
void
setTableInput
(
String
tableInput
)
{
this
.
tableInput
=
tableInput
;
}
public
String
getTextInputKeyValue
()
{
return
textInputKeyValue
;
}
public
void
setTextInputKeyValue
(
String
textInputKeyValue
)
{
this
.
textInputKeyValue
=
textInputKeyValue
;
}
}
src/test/java/kz/arta/synergy/pojo/TestForm.java
View file @
f5ebfd9a
package
kz.arta.synergy.pojo
;
import
kz.arta.synergy.asforms.annotations.KeyValue
;
import
kz.arta.synergy.asforms.annotations.NumericInput
;
import
kz.arta.synergy.asforms.annotations.Table
;
import
kz.arta.synergy.asforms.annotations.TextInput
;
import
kz.arta.synergy.asforms.pojo.AsForm
;
import
kz.arta.synergy.asforms.pojo.AsFormData
;
import
kz.arta.synergy.api.asforms.annotations.*
;
import
kz.arta.synergy.api.asforms.pojo.AsForm
;
import
kz.arta.synergy.api.asforms.pojo.AsFormData
;
import
kz.arta.synergy.api.asforms.pojo.ComponentTypes
;
import
java.util.List
;
...
...
@@ -13,17 +11,27 @@ import java.util.List;
* @author raimbek
* @since 09.11.2016
*/
@Form
(
config
=
"application_form"
)
public
class
TestForm
extends
AsForm
{
@TextInput
(
"text_input"
)
private
String
textInput
;
@KeyValue
@NumericInput
(
"
text_input_2
"
)
private
String
textInputKeyValue
;
@NumericInput
(
"
numeric_input_key
"
)
private
String
numericInputKey
;
@Table
(
"table_cmp"
)
private
List
<
List
<
AsFormData
>>
tableData
;
@NumericInput
(
"numeric_input_value"
)
private
String
numericInputValue
;
@Cmp
(
id
=
"file"
,
type
=
ComponentTypes
.
FILE
)
private
AsFormData
file
;
@TextInput
(
"double_input"
)
private
Double
doubleValue
;
@TextInput
(
"integer_input"
)
private
Integer
integerValue
;
public
String
getTextInput
()
{
return
textInput
;
...
...
@@ -32,4 +40,55 @@ public class TestForm extends AsForm {
public
void
setTextInput
(
String
textInput
)
{
this
.
textInput
=
textInput
;
}
public
String
getNumericInputKey
()
{
return
numericInputKey
;
}
public
void
setNumericInputKey
(
String
numericInputKey
)
{
this
.
numericInputKey
=
numericInputKey
;
}
public
String
getNumericInputValue
()
{
return
numericInputValue
;
}
public
void
setNumericInputValue
(
String
numericInputValue
)
{
this
.
numericInputValue
=
numericInputValue
;
}
public
AsFormData
getFile
()
{
return
file
;
}
public
void
setFile
(
AsFormData
file
)
{
this
.
file
=
file
;
}
public
Double
getDoubleValue
()
{
return
doubleValue
;
}
public
void
setDoubleValue
(
Double
doubleValue
)
{
this
.
doubleValue
=
doubleValue
;
}
public
int
getIntegerValue
()
{
return
integerValue
;
}
public
void
setIntegerValue
(
Integer
integerValue
)
{
this
.
integerValue
=
integerValue
;
}
@Table
(
id
=
"table_cmp"
,
type
=
TableCmp
.
class
)
private
List
<
TableCmp
>
tableData
;
public
List
<
TableCmp
>
getTableData
()
{
return
tableData
;
}
public
void
setTableData
(
List
<
TableCmp
>
tableData
)
{
this
.
tableData
=
tableData
;
}
}
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