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

страница администратора npp защищена

parent 7766d560
package kz.arta.synergy.api.pojo;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
/**
* @author raimbek
* @since 08.08.2016
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class SynergyPosition {
private String positionID;
private String departmentID;
public SynergyPosition() {
}
public String getPositionID() {
return positionID;
}
public void setPositionID(String positionID) {
this.positionID = positionID;
}
public String getDepartmentID() {
return departmentID;
}
public void setDepartmentID(String departmentID) {
this.departmentID = departmentID;
}
}
package kz.arta.synergy.api.pojo;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import java.util.ArrayList;
import java.util.List;
/**
* @author raimbek
* @since 08.08.2016
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class SynergyUser {
private String userid;
private String lastname;
private String firstname;
private String patronymic;
private String mail;
private String jid;
private String code;
private String access;
private String admin;
private String configurator;
private String modified;
private List<SynergyPosition> positions = new ArrayList<>();
@JsonIgnore
private String login;
@JsonIgnore
private String password;
public SynergyUser() {
}
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public String getLastname() {
return lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getPatronymic() {
return patronymic;
}
public void setPatronymic(String patronymic) {
this.patronymic = patronymic;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
public String getJid() {
return jid;
}
public void setJid(String jid) {
this.jid = jid;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getAccess() {
return access;
}
public void setAccess(String access) {
this.access = access;
}
public String getAdmin() {
return admin;
}
public void setAdmin(String admin) {
this.admin = admin;
}
public String getConfigurator() {
return configurator;
}
public void setConfigurator(String configurator) {
this.configurator = configurator;
}
public String getModified() {
return modified;
}
public void setModified(String modified) {
this.modified = modified;
}
public List<SynergyPosition> getPositions() {
return positions;
}
public void setPositions(List<SynergyPosition> positions) {
this.positions = positions;
}
public String getFIO() {
String result = lastname;
if (firstname != null) {
result += " " + firstname;
}
return result;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
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 java.io.IOException;
/**
* @author raimbek
* @since 14.11.2016
*/
public class PersonService {
private final RestHttpQuery restHttpQuery;
private PersonService(QueryContext context) {
this.restHttpQuery = new RestHttpQuery(context);
}
public static PersonService newInstance(QueryContext queryContext) {
return new PersonService(queryContext);
}
public SynergyUser getUser() throws IOException {
String user = restHttpQuery.doQuery(Query.newInstance().url("/rest/api/person/auth"));
return JsonUtils.read(user, SynergyUser.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