<commit_before>package com.x.processplatform.core.entity.content;

import java.util.Date;
import java.util.Objects;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Lob;
import javax.persistence.PostLoad;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;

import com.x.base.core.entity.JpaObject;
import com.x.base.core.entity.SliceJpaObject;
import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.entity.annotation.Flag;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.DateTools;
import com.x.base.core.project.tools.StringTools;
import com.x.processplatform.core.entity.PersistenceProperties;
import com.x.processplatform.core.entity.content.TaskCompletedProperties.PrevTask;
import com.x.processplatform.core.entity.element.ActivityType;
import com.x.processplatform.core.entity.element.Route;

import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.openjpa.persistence.Persistent;
import org.apache.openjpa.persistence.jdbc.Index;
import org.apache.openjpa.persistence.jdbc.Strategy;

/**
 * 没有多值字段
 * 
 * @author zhour
 *
 */
@Entity
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Content.TaskCompleted.table, uniqueConstraints = {
		@UniqueConstraint(name = PersistenceProperties.Content.TaskCompleted.table + JpaObject.IndexNameMiddle
				+ JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN,
						JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) })
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class TaskCompleted extends SliceJpaObject implements ProjectionInterface {

	private static final long serialVersionUID = 3290580054829723177L;
	private static final String TABLE = PersistenceProperties.Content.TaskCompleted.table;

	/* 继续流转 */
	public static final String PROCESSINGTYPE_TASK = "task";
	/* 开始 */
	public static final String PROCESSINGTYPE_START = "start";
	/* 调度 */
	public static final String PROCESSINGTYPE_REROUTE = "reroute";
	/* 召回 */
	public static final String PROCESSINGTYPE_RETRACT = "retract";
	/* 回滚 */
	public static final String PROCESSINGTYPE_ROLLBACK = "rollback";
	/* 重置处理人 */
	public static final String PROCESSINGTYPE_RESET = "reset";
	/* 智能流转 */
	public static final String PROCESSINGTYPE_SAMETARGET = "sameTarget";
	/* 超时流转 */
	public static final String PROCESSINGTYPE_PASSEXPIRED = "passExpired";
	/* 管理员流转 */
	public static final String PROCESSINGTYPE_CONTROL = "control";
	/* 添加处理人 */
	public static final String PROCESSINGTYPE_APPENDTASK = "appendTask";
	/* 被添加处理人 */
	public static final String PROCESSINGTYPE_BEAPPENDEDTASK = "beAppendedTask";
	/* 授权,授权给他人处理 */
	public static final String PROCESSINGTYPE_EMPOWER = "empower";

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@FieldDescribe("数据库主键,自动生成.")
	@Id
	@Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME)
	private String id = createId();

	/* 以上为 JpaObject 默认字段 */

	public void onPersist() throws Exception {
		if (StringUtils.isEmpty(this.startTimeMonth) && (null != this.startTime)) {
			this.startTimeMonth = DateTools.format(this.startTime, DateTools.format_yyyyMM);
		}
		if (StringUtils.isEmpty(this.completedTimeMonth) && (null != this.completedTime)) {
			this.completedTimeMonth = DateTools.format(this.completedTime, DateTools.format_yyyyMM);
		}
		/* 将null值赋值为空保证Gson输出 */
		if (null == this.routeName) {
			this.routeName = "";
		}
		if (Objects.isNull(this.processingType)) {
			this.processingType = PROCESSINGTYPE_TASK;
		}
		switch (this.processingType) {
			case PROCESSINGTYPE_APPENDTASK:
			case PROCESSINGTYPE_BEAPPENDEDTASK:
			case PROCESSINGTYPE_REROUTE:
			case PROCESSINGTYPE_RETRACT:
			case PROCESSINGTYPE_ROLLBACK:
			case PROCESSINGTYPE_EMPOWER:
			case PROCESSINGTYPE_RESET:
				this.joinInquire = false;
				break;
			default:
				this.joinInquire = true;
				break;
		}

		if (StringTools.utf8Length(this.getProperties().getTitle()) > length_255B) {
			this.title = StringTools.utf8SubString(this.getProperties().getTitle(), length_255B - 3) + "...";
		}
		if (StringTools.utf8Length(this.getProperties().getOpinion()) > length_255B) {
			this.opinion = StringTools.utf8SubString(this.getProperties().getOpinion(), length_255B - 3) + "...";
		}
	}

	@PostLoad
	public void postLoad() {
		if (null != this.properties) {
			if (StringUtils.isNotEmpty(this.getProperties().getTitle())) {
				this.title = this.getProperties().getTitle();
			}
			if (StringUtils.isNotEmpty(this.getProperties().getOpinion())) {
				this.opinion = this.getProperties().getOpinion();
			}
		}
	}

	public Boolean getJoinInquire() {
		return BooleanUtils.isNotFalse(this.joinInquire);
	}

	public Boolean getLatest() {
		return BooleanUtils.isNotFalse(this.latest);
	}

	public void setOpinion(String opinion) {
		this.opinion = opinion;
		this.getProperties().setOpinion(opinion);
	}

	public String getOpinion() {
		if ((null != this.properties) && StringUtils.isNotEmpty(this.properties.getOpinion())) {
			return this.properties.getOpinion();
		} else {
			return this.opinion;
		}<commit_msg>修复旧版本流程意见展现不全问题<commit_after>package com.x.processplatform.core.entity.content;

import java.util.Date;
import java.util.Objects;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Lob;
import javax.persistence.PostLoad;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;

import com.x.base.core.entity.JpaObject;
import com.x.base.core.entity.SliceJpaObject;
import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.entity.annotation.Flag;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.DateTools;
import com.x.base.core.project.tools.StringTools;
import com.x.processplatform.core.entity.PersistenceProperties;
import com.x.processplatform.core.entity.content.TaskCompletedProperties.PrevTask;
import com.x.processplatform.core.entity.element.ActivityType;
import com.x.processplatform.core.entity.element.Route;

import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.openjpa.persistence.Persistent;
import org.apache.openjpa.persistence.jdbc.Index;
import org.apache.openjpa.persistence.jdbc.Strategy;

/**
 * 没有多值字段
 * 
 * @author zhour
 *
 */
@Entity
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Content.TaskCompleted.table, uniqueConstraints = {
		@UniqueConstraint(name = PersistenceProperties.Content.TaskCompleted.table + JpaObject.IndexNameMiddle
				+ JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN,
						JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) })
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class TaskCompleted extends SliceJpaObject implements ProjectionInterface {

	private static final long serialVersionUID = 3290580054829723177L;
	private static final String TABLE = PersistenceProperties.Content.TaskCompleted.table;

	/* 继续流转 */
	public static final String PROCESSINGTYPE_TASK = "task";
	/* 开始 */
	public static final String PROCESSINGTYPE_START = "start";
	/* 调度 */
	public static final String PROCESSINGTYPE_REROUTE = "reroute";
	/* 召回 */
	public static final String PROCESSINGTYPE_RETRACT = "retract";
	/* 回滚 */
	public static final String PROCESSINGTYPE_ROLLBACK = "rollback";
	/* 重置处理人 */
	public static final String PROCESSINGTYPE_RESET = "reset";
	/* 智能流转 */
	public static final String PROCESSINGTYPE_SAMETARGET = "sameTarget";
	/* 超时流转 */
	public static final String PROCESSINGTYPE_PASSEXPIRED = "passExpired";
	/* 管理员流转 */
	public static final String PROCESSINGTYPE_CONTROL = "control";
	/* 添加处理人 */
	public static final String PROCESSINGTYPE_APPENDTASK = "appendTask";
	/* 被添加处理人 */
	public static final String PROCESSINGTYPE_BEAPPENDEDTASK = "beAppendedTask";
	/* 授权,授权给他人处理 */
	public static final String PROCESSINGTYPE_EMPOWER = "empower";

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@FieldDescribe("数据库主键,自动生成.")
	@Id
	@Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME)
	private String id = createId();

	/* 以上为 JpaObject 默认字段 */

	public void onPersist() throws Exception {
		if (StringUtils.isEmpty(this.startTimeMonth) && (null != this.startTime)) {
			this.startTimeMonth = DateTools.format(this.startTime, DateTools.format_yyyyMM);
		}
		if (StringUtils.isEmpty(this.completedTimeMonth) && (null != this.completedTime)) {
			this.completedTimeMonth = DateTools.format(this.completedTime, DateTools.format_yyyyMM);
		}
		/* 将null值赋值为空保证Gson输出 */
		if (null == this.routeName) {
			this.routeName = "";
		}
		if (Objects.isNull(this.processingType)) {
			this.processingType = PROCESSINGTYPE_TASK;
		}
		switch (this.processingType) {
			case PROCESSINGTYPE_APPENDTASK:
			case PROCESSINGTYPE_BEAPPENDEDTASK:
			case PROCESSINGTYPE_REROUTE:
			case PROCESSINGTYPE_RETRACT:
			case PROCESSINGTYPE_ROLLBACK:
			case PROCESSINGTYPE_EMPOWER:
			case PROCESSINGTYPE_RESET:
				this.joinInquire = false;
				break;
			default:
				this.joinInquire = true;
				break;
		}

		if (StringTools.utf8Length(this.getProperties().getTitle()) > length_255B) {
			this.title = StringTools.utf8SubString(this.getProperties().getTitle(), length_255B - 3) + "...";
		}
		if (StringTools.utf8Length(this.getProperties().getOpinion()) > length_255B) {
			this.opinion = StringTools.utf8SubString(this.getProperties().getOpinion(), length_255B - 3) + "...";
		}
	}

	@PostLoad
	public void postLoad() {
		if (null != this.properties) {
			if (StringUtils.isNotEmpty(this.getProperties().getTitle())) {
				this.title = this.getProperties().getTitle();
			}
			if (StringUtils.isNotEmpty(this.getProperties().getOpinion())) {
				this.opinion = this.getProperties().getOpinion();
			}
		}
	}

	public Boolean getJoinInquire() {
		return BooleanUtils.isNotFalse(this.joinInquire);
	}

	public Boolean getLatest() {
		return BooleanUtils.isNotFalse(this.latest);
	}

	public void setOpinion(String opinion) {
		this.opinion = opinion;
		this.getProperties().setOpinion(opinion);
	}

	public String getOpinion() {
		if ((null != this.properties) && StringUtils.isNotEmpty(this.properties.getOpinion())) {
			return this.properties.getOpinion();
		} else if (StringUtils.isNotEmpty(this.opinionLob)) {
			return this.opinionLob;
		} else {
			return this.opinion;
		}
{'fraction_non_alphanumeric': 0.11444896545753615, 'fraction_numerical': 0.007445242836118085, 'mean_word_length': 5.105708245243129, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5223142', 'n_tokens_mistral': 4095, 'n_tokens_neox': 3877, 'n_words': 667}