<commit_before>package com.x.program.center.jaxrs.collect;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang3.BooleanUtils;

import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.config.Collect;
import com.x.base.core.project.config.Config;
import com.x.base.core.project.connection.ActionResponse;
import com.x.base.core.project.connection.ConnectionAction;
import com.x.base.core.project.gson.GsonPropertyObject;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.http.HttpToken;
import com.x.base.core.project.http.TokenType;

class ActionLogin extends BaseAction {

	public static final String C_Token = "<PASSWORD>";

	ActionResult<Wo> execute(HttpServletRequest request, HttpServletResponse response, EffectivePerson effectivePerson) throws Exception {
		ActionResult<Wo> result = new ActionResult<>();
		Wo wo = new Wo();
		if(BooleanUtils.isFalse(Config.collect().getEnable())){
			throw new ExceptionDisable();
		}
		if (BooleanUtils.isNotTrue(this.connect())) {
			throw new ExceptionUnableConnect();
		}

		String url = Config.collect().url(Collect.ADDRESS_COLLECT_LOGIN);
		Map<String, String> map = new HashMap<>();
		map.put("credential", Config.collect().getName());
		map.put("password", Config.collect().getPassword());
		ActionResponse resp = ConnectionAction.post(url, null, map);
		LoginWo loginWo = resp.getData(LoginWo.class);

		HttpToken httpToken = new HttpToken();
		httpToken.setResponseToken(request, response, C_Token, loginWo.getToken());

		wo.setCollectToken(loginWo.getToken());
		wo.setCollectTokenType(loginWo.getTokenType());
		wo.setCollectUrl(Config.collect().url());
		result.setData(wo);
		return result;
	}

	public static class Wo extends GsonPropertyObject {
		@FieldDescribe("collect服务地址")
		private String collectUrl;
		@FieldDescribe("collect令牌")
		private String collectToken;
		@FieldDescribe("collect令牌类型")
		private TokenType collectTokenType;

		public String getCollectUrl() {
			return collectUrl;
		}

		public void setCollectUrl(String collectUrl) {
			this.collectUrl = collectUrl;
		}

		public String getCollectToken() {
			return collectToken;
		}

		public void setCollectToken(String collectToken) {
			this.collectToken = collectToken;
		}

		public TokenType getCollectTokenType() {
			return collectTokenType;
		}

		public void setCollectTokenType(TokenType collectTokenType) {
			this.collectTokenType = collectTokenType;
		}
	}

	public static class LoginWo extends GsonPropertyObject {

		@FieldDescribe("令牌")
		private String token;
		@FieldDescribe("名称")
		private String name;
		@FieldDescribe("令牌类型")
		private TokenType tokenType;

		public String getToken() {
			return token;
		}

		public void setToken(String token) {
			this.token = token;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public TokenType getTokenType() {
			return tokenType;
		}

		public void setTokenType(TokenType tokenType) {
			this.tokenType = tokenType;
		}

	}

}<commit_msg>新版应用市场开发4<commit_after>package com.x.program.center.jaxrs.collect;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang3.BooleanUtils;

import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.config.Collect;
import com.x.base.core.project.config.Config;
import com.x.base.core.project.connection.ActionResponse;
import com.x.base.core.project.connection.ConnectionAction;
import com.x.base.core.project.gson.GsonPropertyObject;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.http.HttpToken;
import com.x.base.core.project.http.TokenType;

class ActionLogin extends BaseAction {

	public static final String C_Token = "<PASSWORD>";

	ActionResult<Wo> execute(HttpServletRequest request, HttpServletResponse response, EffectivePerson effectivePerson) throws Exception {
		ActionResult<Wo> result = new ActionResult<>();
		Wo wo = new Wo();
		if(BooleanUtils.isFalse(Config.collect().getEnable())){
			throw new ExceptionDisable();
		}
		if (BooleanUtils.isNotTrue(this.connect())) {
			throw new ExceptionUnableConnect();
		}

		String url = Config.collect().url(Collect.ADDRESS_COLLECT_LOGIN);
		Map<String, String> map = new HashMap<>();
		map.put("credential", Config.collect().getName());
		map.put("password", Config.collect().getPassword());
		ActionResponse resp = ConnectionAction.post(url, null, map);
		LoginWo loginWo = resp.getData(LoginWo.class);

		HttpToken httpToken = new HttpToken();
		httpToken.setResponseToken(request, response, C_Token, loginWo.getToken());

		wo.setCollectToken(loginWo.getToken());
		wo.setCollectTokenType(loginWo.getTokenType());
		wo.setCollectUrl(Config.collect().url());
		if(BooleanUtils.isTrue(loginWo.getVipUnit())){
			wo.setVipUnit(true);
		}
		result.setData(wo);
		return result;
	}

	public static class Wo extends GsonPropertyObject {
		@FieldDescribe("collect服务地址")
		private String collectUrl;
		@FieldDescribe("collect令牌")
		private String collectToken;
		@FieldDescribe("collect令牌类型")
		private TokenType collectTokenType;
		@FieldDescribe("是否是VIP组织")
		private Boolean vipUnit = false;

		public String getCollectUrl() {
			return collectUrl;
		}

		public void setCollectUrl(String collectUrl) {
			this.collectUrl = collectUrl;
		}

		public String getCollectToken() {
			return collectToken;
		}

		public void setCollectToken(String collectToken) {
			this.collectToken = collectToken;
		}

		public TokenType getCollectTokenType() {
			return collectTokenType;
		}

		public void setCollectTokenType(TokenType collectTokenType) {
			this.collectTokenType = collectTokenType;
		}

		public Boolean getVipUnit() {
			return vipUnit;
		}

		public void setVipUnit(Boolean vipUnit) {
			this.vipUnit = vipUnit;
		}
	}

	public static class LoginWo extends GsonPropertyObject {

		@FieldDescribe("令牌")
		private String token;
		@FieldDescribe("名称")
		private String name;
		@FieldDescribe("令牌类型")
		private TokenType tokenType;
		@FieldDescribe("是否是VIP组织")
		private Boolean vipUnit;

		public String getToken() {
			return token;
		}

		public void setToken(String token) {
			this.token = token;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public TokenType getTokenType() {
			return tokenType;
		}

		public void setTokenType(TokenType tokenType) {
			this.tokenType = tokenType;
		}

		public Boolean getVipUnit() {
			return vipUnit;
		}

		public void setVipUnit(Boolean vipUnit) {
			this.vipUnit = vipUnit;
		}
	}

}
{'fraction_non_alphanumeric': 0.11311239193083573, 'fraction_numerical': 0.0004322766570605187, 'mean_word_length': 4.798663324979114, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4158820', 'n_tokens_mistral': 2384, 'n_tokens_neox': 2197, 'n_words': 441}