Commit 9a7aad78 authored by Raimbek Egemberdiev's avatar Raimbek Egemberdiev

Department and position service

parent f6759d30
...@@ -33,9 +33,9 @@ public class Query { ...@@ -33,9 +33,9 @@ public class Query {
return this; return this;
} }
public Query queryParam(String key, String value) { public Query queryParam(String key, Object value) {
if (value != null) { if (value != null) {
queryParams.put(key, value); queryParams.put(key, value.toString());
} }
return this; return this;
} }
......
...@@ -11,6 +11,12 @@ public class SynergyDepartment { ...@@ -11,6 +11,12 @@ public class SynergyDepartment {
private String departmentID; private String departmentID;
private String parentDepartmentID; private String parentDepartmentID;
private String nameRu;
private String nameKz;
private String nameEn;
private String pointersCode;
private String number;
private SynergyManager manager;
public SynergyDepartment() { public SynergyDepartment() {
} }
...@@ -30,4 +36,52 @@ public class SynergyDepartment { ...@@ -30,4 +36,52 @@ public class SynergyDepartment {
public void setParentDepartmentID(String parentDepartmentID) { public void setParentDepartmentID(String parentDepartmentID) {
this.parentDepartmentID = parentDepartmentID; this.parentDepartmentID = parentDepartmentID;
} }
public SynergyManager getManager() {
return manager;
}
public void setManager(SynergyManager manager) {
this.manager = manager;
}
public String getNameRu() {
return nameRu;
}
public void setNameRu(String nameRu) {
this.nameRu = nameRu;
}
public String getNameKz() {
return nameKz;
}
public void setNameKz(String nameKz) {
this.nameKz = nameKz;
}
public String getNameEn() {
return nameEn;
}
public void setNameEn(String nameEn) {
this.nameEn = nameEn;
}
public String getPointersCode() {
return pointersCode;
}
public void setPointersCode(String pointersCode) {
this.pointersCode = pointersCode;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
} }
package kz.arta.synergy.api.pojo;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import java.util.ArrayList;
import java.util.List;
/**
* @author raimbek
* @since 23.01.2017
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class SynergyDepartmentContent {
private List<Department> departments = new ArrayList<Department>();
private List<Position> positions = new ArrayList<Position>();
public static class Department {
public String departmentId;
public String departmentName;
public Boolean hasChildDepartments;
public DepartmentHead departmentHead;
}
public static class DepartmentHead {
public String headId;
public String headName;
public List<Position> positions;
}
public static class Position {
public String positionID;
public String positionName;
public List<Employee> employees;
}
public static class Employee {
public String employeeID;
public String employeeName;
}
public List<Department> getDepartments() {
return departments;
}
public void setDepartments(List<Department> departments) {
this.departments = departments;
}
public List<Position> getPositions() {
return positions;
}
public void setPositions(List<Position> positions) {
this.positions = positions;
}
}
package kz.arta.synergy.api.pojo;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
/**
* @author raimbek
* @since 23.01.2017
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class SynergyManager {
private String positionId;
private String nameRu;
private String nameKz;
private String nameEn;
private String pointersCode;
public String getPositionId() {
return positionId;
}
public void setPositionId(String positionId) {
this.positionId = positionId;
}
public String getNameRu() {
return nameRu;
}
public void setNameRu(String nameRu) {
this.nameRu = nameRu;
}
public String getNameKz() {
return nameKz;
}
public void setNameKz(String nameKz) {
this.nameKz = nameKz;
}
public String getNameEn() {
return nameEn;
}
public void setNameEn(String nameEn) {
this.nameEn = nameEn;
}
public String getPointersCode() {
return pointersCode;
}
public void setPointersCode(String pointersCode) {
this.pointersCode = pointersCode;
}
}
...@@ -10,6 +10,14 @@ import org.codehaus.jackson.annotate.JsonIgnoreProperties; ...@@ -10,6 +10,14 @@ import org.codehaus.jackson.annotate.JsonIgnoreProperties;
public class SynergyPosition { public class SynergyPosition {
private String positionID; private String positionID;
private String departmentID; private String departmentID;
private String nameRu;
private String nameKz;
private String nameEn;
private String parentDepartmentID;
private String pointersCode;
private String number;
private String salary;
private String vacancies;
public SynergyPosition() { public SynergyPosition() {
} }
...@@ -29,4 +37,68 @@ public class SynergyPosition { ...@@ -29,4 +37,68 @@ public class SynergyPosition {
public void setDepartmentID(String departmentID) { public void setDepartmentID(String departmentID) {
this.departmentID = departmentID; this.departmentID = departmentID;
} }
public String getNameRu() {
return nameRu;
}
public void setNameRu(String nameRu) {
this.nameRu = nameRu;
}
public String getNameKz() {
return nameKz;
}
public void setNameKz(String nameKz) {
this.nameKz = nameKz;
}
public String getNameEn() {
return nameEn;
}
public void setNameEn(String nameEn) {
this.nameEn = nameEn;
}
public String getParentDepartmentID() {
return parentDepartmentID;
}
public void setParentDepartmentID(String parentDepartmentID) {
this.parentDepartmentID = parentDepartmentID;
}
public String getPointersCode() {
return pointersCode;
}
public void setPointersCode(String pointersCode) {
this.pointersCode = pointersCode;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public String getSalary() {
return salary;
}
public void setSalary(String salary) {
this.salary = salary;
}
public String getVacancies() {
return vacancies;
}
public void setVacancies(String vacancies) {
this.vacancies = vacancies;
}
} }
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.DocSend;
import kz.arta.synergy.api.pojo.DocumentInfo;
import kz.arta.synergy.api.pojo.SynergyDepartment;
import kz.arta.synergy.api.pojo.SynergyDepartmentContent;
import java.io.IOException;
/**
* @author raimbek
* @since 14.11.2016
*/
public class DepartmentsService {
private final RestHttpQuery restHttpQuery;
private DepartmentsService(QueryContext context) {
this.restHttpQuery = new RestHttpQuery(context);
}
public static DepartmentsService newInstance(QueryContext queryContext) {
return new DepartmentsService(queryContext);
}
public SynergyDepartment getDepartment(String departmentId) throws IOException {
Query query = Query.newInstance()
.url("/rest/api/departments/get")
.queryParam("departmentID", departmentId);
return JsonUtils.read(restHttpQuery.doQuery(query), SynergyDepartment.class);
}
public SynergyDepartmentContent getDepartmentsContent(String departmentId, Boolean onlyPosition, Boolean onlyDepartments) throws IOException {
Query query = Query.newInstance()
.url("/rest/api/departments/content")
.queryParam("onlyPosition", onlyPosition)
.queryParam("onlyDepartments", onlyDepartments)
.queryParam("departmentID", departmentId);
return JsonUtils.read(restHttpQuery.doQuery(query), SynergyDepartmentContent.class);
}
}
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.SynergyDepartment;
import kz.arta.synergy.api.pojo.SynergyDepartmentContent;
import kz.arta.synergy.api.pojo.SynergyPosition;
import java.io.IOException;
/**
* @author raimbek
* @since 14.11.2016
*/
public class PositionsService {
private final RestHttpQuery restHttpQuery;
private PositionsService(QueryContext context) {
this.restHttpQuery = new RestHttpQuery(context);
}
public static PositionsService newInstance(QueryContext queryContext) {
return new PositionsService(queryContext);
}
public SynergyPosition getPosition(String positionId) throws IOException {
Query query = Query.newInstance()
.url("/rest/api/positions/get")
.queryParam("positionID", positionId);
return JsonUtils.read(restHttpQuery.doQuery(query), SynergyPosition.class);
}
}
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