Commit ce8307b2 authored by Raimbek Egemberdiev's avatar Raimbek Egemberdiev

перенесены вызовы api synergy работ

parent 0a0e4cba
...@@ -64,6 +64,10 @@ public class RestHttpQuery { ...@@ -64,6 +64,10 @@ public class RestHttpQuery {
return readStringReturn(conn); return readStringReturn(conn);
} }
public String doQuery(String url) throws IOException {
return doQuery(Query.newInstance().url(url));
}
public byte[] doQueryAndReturnBytes(Query query) throws IOException { public byte[] doQueryAndReturnBytes(Query query) throws IOException {
HttpURLConnection conn = doQueryAndReturnConnection(query); HttpURLConnection conn = doQueryAndReturnConnection(query);
InputStream is = conn.getInputStream(); InputStream is = conn.getInputStream();
......
package kz.arta.synergy.api.pojo;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
/**
* @author raimbek
* @since 08.08.2016
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class SynergyDepartment {
private String departmentID;
private String parentDepartmentID;
public SynergyDepartment() {
}
public String getDepartmentID() {
return departmentID;
}
public void setDepartmentID(String departmentID) {
this.departmentID = departmentID;
}
public String getParentDepartmentID() {
return parentDepartmentID;
}
public void setParentDepartmentID(String parentDepartmentID) {
this.parentDepartmentID = parentDepartmentID;
}
}
package kz.arta.synergy.api.pojo;
import java.util.ArrayList;
import java.util.List;
/**
* @author raimbek
* @since 10.08.2016
*/
public class SynergyNotification {
private String header;
private String message;
private List<String> users = new ArrayList<String>();
private List<String> groups = new ArrayList<String>();
private List<String> emails = new ArrayList<String>();
private List<String> logins = new ArrayList<String>();
public SynergyNotification() {
}
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 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> getLogins() {
return logins;
}
public void setLogins(List<String> logins) {
this.logins = logins;
}
}
package kz.arta.synergy.api.pojo;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import java.util.ArrayList;
import java.util.List;
/**
* @author raimbek
* @since 10.08.2016
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class SynergyWork {
private String name;
private String startDate;
private String finishDate;
private String priority;
private String authorID;
private String resUserID;
private String typeID;
private String actionID;
private String finished;
private String itemID;
private List<SynergyWork> subProcesses = new ArrayList<SynergyWork>();
public SynergyWork() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getFinishDate() {
return finishDate;
}
public void setFinishDate(String finishDate) {
this.finishDate = finishDate;
}
public String getPriority() {
return priority;
}
public void setPriority(String priority) {
this.priority = priority;
}
public String getAuthorID() {
return authorID;
}
public void setAuthorID(String authorID) {
this.authorID = authorID;
}
public String getResUserID() {
return resUserID;
}
public void setResUserID(String resUserID) {
this.resUserID = resUserID;
}
public String getTypeID() {
return typeID;
}
public void setTypeID(String typeID) {
this.typeID = typeID;
}
public String getActionID() {
return actionID;
}
public void setActionID(String actionID) {
this.actionID = actionID;
}
public String getFinished() {
return finished;
}
public void setFinished(String finished) {
this.finished = finished;
}
public List<SynergyWork> getSubProcesses() {
return subProcesses;
}
public void setSubProcesses(List<SynergyWork> subProcesses) {
this.subProcesses = subProcesses;
}
public String getItemID() {
return itemID;
}
public void setItemID(String itemID) {
this.itemID = itemID;
}
}
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.SynergyWork;
import java.io.IOException;
/**
* @author raimbek
* @since 14.11.2016
*/
public class WorkflowService {
private final RestHttpQuery restHttpQuery;
private WorkflowService(QueryContext context) {
this.restHttpQuery = new RestHttpQuery(context);
}
public static WorkflowService newInstance(QueryContext queryContext) {
return new WorkflowService(queryContext);
}
public String createWork(SynergyWork work) throws IOException {
Query query = Query.newInstance()
.methodPost()
.url("/rest/api/workflow/work/create")
.formParam("name", work.getName())
.formParam("startDate", work.getStartDate())
.formParam("finishDate", work.getFinishDate())
.formParam("priority", work.getPriority())
.formParam("authorID", work.getAuthorID())
.formParam("resUserID", work.getResUserID());
return restHttpQuery.doQuery(query);
}
public String getWorkDocumentId(String workId) throws IOException {
return JsonUtils.getValueByKey(restHttpQuery.doQuery("/rest/api/workflow/work/" + workId + "/document"), "documentID");
}
public String deleteWork(String workId) throws IOException {
return restHttpQuery.doQuery("/rest/api/workflow/work/delete?workID=" + workId);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment