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
61b91e63
Commit
61b91e63
authored
Nov 29, 2016
by
Raimbek Egemberdiev
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.lan.arta.kz:raimbek/synergy-api-util
parents
b031bab4
eaad53aa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
115 additions
and
0 deletions
+115
-0
src/main/java/kz/arta/synergy/api/pojo/NotificationSend.java
src/main/java/kz/arta/synergy/api/pojo/NotificationSend.java
+69
-0
src/main/java/kz/arta/synergy/api/services/NotificationService.java
...ava/kz/arta/synergy/api/services/NotificationService.java
+46
-0
No files found.
src/main/java/kz/arta/synergy/api/pojo/NotificationSend.java
0 → 100644
View file @
61b91e63
package
kz.arta.synergy.api.pojo
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Created by: Abzal Kultayev
* Date: 25.11.16
* Time: 16:00
*/
public
class
NotificationSend
implements
Serializable
{
private
String
header
;
private
String
message
;
private
List
<
String
>
users
=
new
ArrayList
<>();
private
List
<
String
>
groups
=
new
ArrayList
<>();
private
List
<
String
>
emails
=
new
ArrayList
<>();
private
List
<
String
>
logins
=
new
ArrayList
<>();
public
NotificationSend
()
{}
public
String
getHeader
()
{
return
header
;
}
public
void
setHeader
(
String
header
)
{
this
.
header
=
header
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
List
<
String
>
getUsers
()
{
return
users
;
}
public
void
setUsers
(
List
<
String
>
users
)
{
this
.
users
=
users
;
}
public
List
<
String
>
getGroups
()
{
return
groups
;
}
public
void
setGroups
(
List
<
String
>
groups
)
{
this
.
groups
=
groups
;
}
public
List
<
String
>
getEmails
()
{
return
emails
;
}
public
void
setEmails
(
List
<
String
>
emails
)
{
this
.
emails
=
emails
;
}
public
List
<
String
>
getLogins
()
{
return
logins
;
}
public
void
setLogins
(
List
<
String
>
logins
)
{
this
.
logins
=
logins
;
}
}
src/main/java/kz/arta/synergy/api/services/NotificationService.java
0 → 100644
View file @
61b91e63
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.NotificationSend
;
import
java.io.IOException
;
import
java.util.Arrays
;
/**
* Created by: Abzal Kultayev
* Date: 25.11.16
* Time: 15:55
*
* Сервис для отправления нотификации
*/
public
class
NotificationService
{
private
final
RestHttpQuery
restHttpQuery
;
private
NotificationService
(
QueryContext
context
)
{
this
.
restHttpQuery
=
new
RestHttpQuery
(
context
);
}
public
static
NotificationService
newInstance
(
QueryContext
queryContext
)
{
return
new
NotificationService
(
queryContext
);
}
public
String
sendNotification
(
String
header
,
String
body
,
String
...
userIDs
)
throws
IOException
{
NotificationSend
notification
=
new
NotificationSend
();
notification
.
setHeader
(
header
);
notification
.
setMessage
(
body
);
notification
.
setUsers
(
Arrays
.
asList
(
userIDs
));
return
sendNotification
(
notification
);
}
public
String
sendNotification
(
NotificationSend
notification
)
throws
IOException
{
Query
query
=
Query
.
newInstance
()
.
methodPost
()
.
header
(
"Content-Type"
,
"application/json; charset=utf-8"
)
.
url
(
"/rest/api/notifications/send"
)
.
body
(
JsonUtils
.
toJson
(
notification
));
return
restHttpQuery
.
doQuery
(
query
);
}
}
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