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
f202a598
Commit
f202a598
authored
Jan 26, 2017
by
Raimbek Egemberdiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added new client classes
parent
9a7aad78
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
158 additions
and
2 deletions
+158
-2
src/main/java/kz/arta/synergy/api/pojo/SynergyDepartmentContent.java
...va/kz/arta/synergy/api/pojo/SynergyDepartmentContent.java
+2
-2
src/main/java/kz/arta/synergy/api/pojo/SynergyPosition.java
src/main/java/kz/arta/synergy/api/pojo/SynergyPosition.java
+9
-0
src/main/java/kz/arta/synergy/api/services/DepartmentsService.java
...java/kz/arta/synergy/api/services/DepartmentsService.java
+34
-0
src/main/java/kz/arta/synergy/api/services/PositionsService.java
...n/java/kz/arta/synergy/api/services/PositionsService.java
+32
-0
src/main/java/kz/arta/synergy/api/services/UserChooserService.java
...java/kz/arta/synergy/api/services/UserChooserService.java
+81
-0
No files found.
src/main/java/kz/arta/synergy/api/pojo/SynergyDepartmentContent.java
View file @
f202a598
...
@@ -16,14 +16,14 @@ public class SynergyDepartmentContent {
...
@@ -16,14 +16,14 @@ public class SynergyDepartmentContent {
private
List
<
Position
>
positions
=
new
ArrayList
<
Position
>();
private
List
<
Position
>
positions
=
new
ArrayList
<
Position
>();
public
static
class
Department
{
public
static
class
Department
{
public
String
departmentI
d
;
public
String
departmentI
D
;
public
String
departmentName
;
public
String
departmentName
;
public
Boolean
hasChildDepartments
;
public
Boolean
hasChildDepartments
;
public
DepartmentHead
departmentHead
;
public
DepartmentHead
departmentHead
;
}
}
public
static
class
DepartmentHead
{
public
static
class
DepartmentHead
{
public
String
headI
d
;
public
String
headI
D
;
public
String
headName
;
public
String
headName
;
public
List
<
Position
>
positions
;
public
List
<
Position
>
positions
;
}
}
...
...
src/main/java/kz/arta/synergy/api/pojo/SynergyPosition.java
View file @
f202a598
...
@@ -18,6 +18,7 @@ public class SynergyPosition {
...
@@ -18,6 +18,7 @@ public class SynergyPosition {
private
String
number
;
private
String
number
;
private
String
salary
;
private
String
salary
;
private
String
vacancies
;
private
String
vacancies
;
private
String
positionType
;
public
SynergyPosition
()
{
public
SynergyPosition
()
{
}
}
...
@@ -101,4 +102,12 @@ public class SynergyPosition {
...
@@ -101,4 +102,12 @@ public class SynergyPosition {
public
void
setVacancies
(
String
vacancies
)
{
public
void
setVacancies
(
String
vacancies
)
{
this
.
vacancies
=
vacancies
;
this
.
vacancies
=
vacancies
;
}
}
public
String
getPositionType
()
{
return
positionType
;
}
public
void
setPositionType
(
String
positionType
)
{
this
.
positionType
=
positionType
;
}
}
}
src/main/java/kz/arta/synergy/api/services/DepartmentsService.java
View file @
f202a598
...
@@ -8,8 +8,10 @@ import kz.arta.synergy.api.pojo.DocSend;
...
@@ -8,8 +8,10 @@ import kz.arta.synergy.api.pojo.DocSend;
import
kz.arta.synergy.api.pojo.DocumentInfo
;
import
kz.arta.synergy.api.pojo.DocumentInfo
;
import
kz.arta.synergy.api.pojo.SynergyDepartment
;
import
kz.arta.synergy.api.pojo.SynergyDepartment
;
import
kz.arta.synergy.api.pojo.SynergyDepartmentContent
;
import
kz.arta.synergy.api.pojo.SynergyDepartmentContent
;
import
org.codehaus.jackson.type.TypeReference
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.List
;
/**
/**
* @author raimbek
* @author raimbek
...
@@ -42,4 +44,36 @@ public class DepartmentsService {
...
@@ -42,4 +44,36 @@ public class DepartmentsService {
.
queryParam
(
"departmentID"
,
departmentId
);
.
queryParam
(
"departmentID"
,
departmentId
);
return
JsonUtils
.
read
(
restHttpQuery
.
doQuery
(
query
),
SynergyDepartmentContent
.
class
);
return
JsonUtils
.
read
(
restHttpQuery
.
doQuery
(
query
),
SynergyDepartmentContent
.
class
);
}
}
public
String
saveDepartment
(
SynergyDepartment
synergyDepartment
)
throws
IOException
{
Query
query
=
Query
.
newInstance
()
.
url
(
"/rest/api/departments/save"
)
.
methodPost
()
.
formParam
(
"nameRu"
,
synergyDepartment
.
getNameRu
())
.
formParam
(
"nameKz"
,
synergyDepartment
.
getNameKz
())
.
formParam
(
"nameEn"
,
synergyDepartment
.
getNameEn
())
.
formParam
(
"positionNameRu"
,
synergyDepartment
.
getManager
().
getNameRu
())
.
formParam
(
"positionNameKz"
,
synergyDepartment
.
getManager
().
getNameKz
())
.
formParam
(
"positionNameEn"
,
synergyDepartment
.
getManager
().
getNameEn
())
.
formParam
(
"pointersCode"
,
synergyDepartment
.
getPointersCode
())
.
formParam
(
"number"
,
synergyDepartment
.
getNumber
())
.
formParam
(
"departmentID"
,
synergyDepartment
.
getDepartmentID
())
.
formParam
(
"parentDepartmentID"
,
synergyDepartment
.
getParentDepartmentID
());
return
restHttpQuery
.
doQuery
(
query
);
}
public
String
deleteDepartment
(
String
departmentId
)
throws
IOException
{
Query
query
=
Query
.
newInstance
()
.
url
(
"/rest/api/departments/delete"
)
.
queryParam
(
"departmentID"
,
departmentId
);
return
restHttpQuery
.
doQuery
(
query
);
}
public
List
<
String
>
searchDepartmentsByPointerCode
(
String
pointerCode
)
throws
IOException
{
Query
query
=
Query
.
newInstance
()
.
url
(
"/rest/api/departments/search"
)
.
queryParam
(
"pointer_code"
,
pointerCode
)
.
queryParam
(
"deleted"
,
false
);
return
JsonUtils
.
read
(
restHttpQuery
.
doQuery
(
query
),
new
TypeReference
<
List
<
String
>>()
{});
}
}
}
src/main/java/kz/arta/synergy/api/services/PositionsService.java
View file @
f202a598
...
@@ -7,8 +7,10 @@ import kz.arta.synergy.api.RestHttpQuery;
...
@@ -7,8 +7,10 @@ import kz.arta.synergy.api.RestHttpQuery;
import
kz.arta.synergy.api.pojo.SynergyDepartment
;
import
kz.arta.synergy.api.pojo.SynergyDepartment
;
import
kz.arta.synergy.api.pojo.SynergyDepartmentContent
;
import
kz.arta.synergy.api.pojo.SynergyDepartmentContent
;
import
kz.arta.synergy.api.pojo.SynergyPosition
;
import
kz.arta.synergy.api.pojo.SynergyPosition
;
import
org.codehaus.jackson.type.TypeReference
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.List
;
/**
/**
* @author raimbek
* @author raimbek
...
@@ -33,4 +35,34 @@ public class PositionsService {
...
@@ -33,4 +35,34 @@ public class PositionsService {
return
JsonUtils
.
read
(
restHttpQuery
.
doQuery
(
query
),
SynergyPosition
.
class
);
return
JsonUtils
.
read
(
restHttpQuery
.
doQuery
(
query
),
SynergyPosition
.
class
);
}
}
public
String
savePosition
(
SynergyPosition
position
)
throws
IOException
{
Query
query
=
Query
.
newInstance
()
.
url
(
"/rest/api/positions/save"
)
.
methodPost
()
.
formParam
(
"nameRu"
,
position
.
getNameRu
())
.
formParam
(
"nameKz"
,
position
.
getNameKz
())
.
formParam
(
"nameEn"
,
position
.
getNameEn
())
.
formParam
(
"pointersCode"
,
position
.
getPointersCode
())
.
formParam
(
"positionID"
,
position
.
getPositionID
())
.
formParam
(
"departmentID"
,
position
.
getDepartmentID
())
.
formParam
(
"positionType"
,
position
.
getPositionType
())
.
formParam
(
"number"
,
position
.
getNumber
());
return
restHttpQuery
.
doQuery
(
query
);
}
public
List
<
String
>
searchPositionsByPointerCode
(
String
code
)
throws
IOException
{
Query
query
=
Query
.
newInstance
()
.
url
(
"/rest/api/positions/search"
)
.
queryParam
(
"pointer_code"
,
code
)
.
queryParam
(
"deleted"
,
false
);
return
JsonUtils
.
read
(
restHttpQuery
.
doQuery
(
query
),
new
TypeReference
<
List
<
String
>>()
{});
}
public
String
appointToPosition
(
String
positionId
,
String
userId
)
throws
IOException
{
Query
query
=
Query
.
newInstance
()
.
url
(
"/rest/api/positions/appoint"
)
.
queryParam
(
"positionID"
,
positionId
)
.
queryParam
(
"userID"
,
userId
);
return
restHttpQuery
.
doQuery
(
query
);
}
}
}
src/main/java/kz/arta/synergy/api/services/UserChooserService.java
0 → 100644
View file @
f202a598
package
kz.arta.synergy.api.services
;
import
kz.arta.synergy.api.JsonUtils
;
import
kz.arta.synergy.api.Query
;
import
kz.arta.synergy.api.QueryContext
;
import
kz.arta.synergy.api.RestHttpQuery
;
import
kz.arta.synergy.api.pojo.SynergyUser
;
import
org.codehaus.jackson.type.TypeReference
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author raimbek
* @since 14.11.2016
*/
public
class
UserChooserService
{
public
static
class
User
{
public
String
userID
;
public
String
name
;
public
String
position
;
}
public
static
class
SearchExtUser
{
public
String
personName
;
public
String
personID
;
public
String
departmentName
;
public
String
positionName
;
public
Object
customFields
;
public
String
lastname
;
public
String
firstname
;
public
String
patronymic
;
}
private
final
RestHttpQuery
restHttpQuery
;
private
UserService
userService
;
private
UserChooserService
(
QueryContext
context
)
{
this
.
restHttpQuery
=
new
RestHttpQuery
(
context
);
userService
=
UserService
.
newInstance
(
context
);
}
public
static
UserChooserService
newInstance
(
QueryContext
queryContext
)
{
return
new
UserChooserService
(
queryContext
);
}
public
List
<
User
>
getUsers
(
String
search
)
throws
IOException
{
Query
query
=
Query
.
newInstance
()
.
url
(
"/rest/api/userchooser/search"
)
.
queryParam
(
"search"
,
search
)
.
queryParam
(
"showAll"
,
true
)
.
queryParam
(
"recordsCount"
,
100
);
String
result
=
restHttpQuery
.
doQuery
(
query
);
return
JsonUtils
.
read
(
result
,
new
TypeReference
<
List
<
User
>>()
{});
}
public
List
<
SearchExtUser
>
getUsersExt
(
String
search
)
throws
IOException
{
Query
query
=
Query
.
newInstance
()
.
url
(
"/rest/api/userchooser/search_ext"
)
.
queryParam
(
"search"
,
search
)
.
queryParam
(
"showAll"
,
true
)
.
queryParam
(
"showNoPosition"
,
true
)
.
queryParam
(
"recordsCount"
,
100
);
String
result
=
restHttpQuery
.
doQuery
(
query
);
return
JsonUtils
.
read
(
result
,
new
TypeReference
<
List
<
SearchExtUser
>>()
{});
}
public
SynergyUser
findUserByCode
(
String
searchString
,
String
code
)
throws
IOException
{
List
<
SearchExtUser
>
users
=
getUsersExt
(
searchString
);
for
(
SearchExtUser
user
:
users
)
{
SynergyUser
userInfo
=
userService
.
getUserInfo
(
user
.
personID
);
if
(
code
.
equals
(
userInfo
.
getCode
()))
{
return
userInfo
;
}
}
return
null
;
}
}
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