提交 c21b1d7c 编写于 作者: R roo00

table update

上级 0fd9848d
package com.x.cms.core.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.jdbc.Index;
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.project.annotation.FieldDescribe;
/**
* 内容管理应用目录分类管理员配置表 (取消数据结构,后续删除)
*
* @author 李义
*
*/
@ContainerEntity
@Entity
@Table(name = PersistenceProperties.AppCategoryAdmin.table, uniqueConstraints = {
@UniqueConstraint(name = PersistenceProperties.AppCategoryAdmin.table + JpaObject.IndexNameMiddle
+ JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN,
JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) })
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class AppCategoryAdmin extends SliceJpaObject {
private static final long serialVersionUID = 3856138316794473794L;
private static final String TABLE = PersistenceProperties.AppCategoryAdmin.table;
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();
public void onPersist() throws Exception {
}
/*
* =============================================================================
* ===== 以上为 JpaObject 默认字段
* =============================================================================
* =====
*/
/*
* =============================================================================
* ===== 以下为具体不同的业务及数据表字段要求
* =============================================================================
* =====
*/
public static final String objectType_FIELDNAME = "objectType";
@FieldDescribe("对象类别:应用|分类")
@Column( length = JpaObject.length_16B, name = ColumnNamePrefix + objectType_FIELDNAME)
@CheckPersist(allowEmpty = true)
@Index(name = TABLE + IndexNameMiddle + objectType_FIELDNAME)
private String objectType;
public static final String objectId_FIELDNAME = "objectId";
@FieldDescribe("对象ID")
@Column( length = JpaObject.length_id, name = ColumnNamePrefix + objectId_FIELDNAME)
@CheckPersist(allowEmpty = true)
@Index(name = TABLE + IndexNameMiddle + objectId_FIELDNAME)
private String objectId;
public static final String objectName_FIELDNAME = "objectName";
@FieldDescribe("对象名称")
@Column( length = JpaObject.length_255B, name = ColumnNamePrefix + objectName_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String objectName;
public static final String adminUid_FIELDNAME = "adminUid";
@FieldDescribe("管理员UID")
@Column( length = JpaObject.length_255B, name = ColumnNamePrefix + adminUid_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + adminUid_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String adminUid;
public static final String adminName_FIELDNAME = "adminName";
@FieldDescribe("管理员姓名")
@Column( length = JpaObject.length_255B, name = ColumnNamePrefix + adminName_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String adminName;
public static final String adminLevel_FIELDNAME = "adminLevel";
@FieldDescribe("管理员级别: ADMIN | DOCUMENTADMIN | PUBLISHER")
@Column( length = JpaObject.length_32B, name = ColumnNamePrefix + adminLevel_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String adminLevel;
public static final String description_FIELDNAME = "description";
@FieldDescribe("描述")
@Column( length = JpaObject.length_255B, name = ColumnNamePrefix + description_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String description;
public static final String creatorUid_FIELDNAME = "creatorUid";
@FieldDescribe("创建者UID")
@Column( length = JpaObject.length_255B, name = ColumnNamePrefix + creatorUid_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String creatorUid;
/**
* 获取操作对象类别
*
* @return
*/
public String getObjectType() {
return objectType;
}
/**
* 设置操作对象类别
*
* @param objectType
*/
public void setObjectType(String objectType) {
this.objectType = objectType;
}
/**
* 获取操作对象ID
*
* @return
*/
public String getObjectId() {
return objectId;
}
/**
* 设置操作对象ID
*
* @param objectId
*/
public void setObjectId(String objectId) {
this.objectId = objectId;
}
/**
* 获取操作者帐号
*
* @return
*/
public String getAdminUid() {
return adminUid;
}
/**
* 设置操作者帐号
*
* @param operatorUid
*/
public void setAdminUid(String adminUid) {
this.adminUid = adminUid;
}
/**
* 获取操作者姓名
*
* @return
*/
public String getAdminName() {
return adminName;
}
/**
* 设置操作者姓名
*
* @param operatorName
*/
public void setAdminName(String adminName) {
this.adminName = adminName;
}
/**
* 获取文字描述
*
* @return
*/
public String getDescription() {
return description;
}
/**
* 设置文字描述
*
* @param description
*/
public void setDescription(String description) {
this.description = description;
}
/**
* 获取配置创建者帐号
*
* @return
*/
public String getCreatorUid() {
return creatorUid;
}
/**
* 设置配置创建者帐号
*
* @param creatorUid
*/
public void setCreatorUid(String creatorUid) {
this.creatorUid = creatorUid;
}
/**
* 获取用户的管理级别:管理员级别: ADMIN | DOCUMENTADMIN | PUBLISHER
*
* @return
*/
public String getAdminLevel() {
return adminLevel;
}
/**
* 设置用户的管理级别:管理员级别: ADMIN | DOCUMENTADMIN | PUBLISHER
*
* @param adminLevel
*/
public void setAdminLevel(String adminLevel) {
this.adminLevel = adminLevel;
}
public String getObjectName() {
return objectName;
}
public void setObjectName(String objectName) {
this.objectName = objectName;
}
}
\ No newline at end of file
package com.x.cms.core.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.jdbc.Index;
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.project.annotation.FieldDescribe;
/**
* 内容管理应用目录分类可见使用范围配置表 (取消数据结构,后续删除)
*
* @author 李义
*
*/
@ContainerEntity
@Entity
@Table(name = PersistenceProperties.AppCategoryPermission.table, uniqueConstraints = {
@UniqueConstraint(name = PersistenceProperties.AppCategoryPermission.table + JpaObject.IndexNameMiddle
+ JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN,
JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) })
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class AppCategoryPermission extends SliceJpaObject {
private static final long serialVersionUID = 3856138316794473794L;
private static final String TABLE = PersistenceProperties.AppCategoryPermission.table;
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();
public void onPersist() throws Exception {
}
/*
* =============================================================================
* ===== 以上为 JpaObject 默认字段
* =============================================================================
* =====
*/
/*
* =============================================================================
* ===== 以下为具体不同的业务及数据表字段要求
* =============================================================================
* =====
*/
public static final String objectType_FIELDNAME = "objectType";
@FieldDescribe("对象类别:应用|分类")
@Column( length = JpaObject.length_16B, name = ColumnNamePrefix + objectType_FIELDNAME)
@CheckPersist(allowEmpty = true)
@Index(name = TABLE + IndexNameMiddle + objectType_FIELDNAME)
private String objectType;
public static final String permission_FIELDNAME = "permission";
@FieldDescribe("权限类别:VIEW|PUBLISH")
@Column( length = JpaObject.length_16B, name = ColumnNamePrefix + permission_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String permission = "VIEW";
public static final String appId_FIELDNAME = "appId";
@FieldDescribe("所属栏目ID")
@Column( length = JpaObject.length_id, name = ColumnNamePrefix + appId_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + appId_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String appId;
public static final String objectId_FIELDNAME = "objectId";
@FieldDescribe("对象ID")
@Column( length = JpaObject.length_id, name = ColumnNamePrefix + objectId_FIELDNAME)
@CheckPersist(allowEmpty = true)
@Index(name = TABLE + IndexNameMiddle + objectId_FIELDNAME)
private String objectId;
public static final String objectName_FIELDNAME = "objectName";
@FieldDescribe("对象名称")
@Column( length = JpaObject.length_255B, name = ColumnNamePrefix + objectName_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String objectName;
public static final String usedObjectType_FIELDNAME = "usedObjectType";
@FieldDescribe("使用者类别:组织|人员|群组|角色")
@Column( length = JpaObject.length_16B, name = ColumnNamePrefix + usedObjectType_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String usedObjectType;
public static final String usedObjectCode_FIELDNAME = "usedObjectCode";
@FieldDescribe("使用者编码:顶层组织OU、组织OU或者人员UID")
@Column( length = JpaObject.length_255B, name = ColumnNamePrefix + usedObjectCode_FIELDNAME)
@CheckPersist(allowEmpty = true)
@Index(name = TABLE + IndexNameMiddle + usedObjectCode_FIELDNAME)
private String usedObjectCode;
public static final String usedObjectName_FIELDNAME = "usedObjectName";
@FieldDescribe("使用者名称:组织名称|人员姓名")
@Column( length = JpaObject.length_255B, name = ColumnNamePrefix + usedObjectName_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String usedObjectName;
public static final String description_FIELDNAME = "description";
@FieldDescribe("描述")
@Column( length = JpaObject.length_255B, name = ColumnNamePrefix + description_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String description;
public static final String creatorUid_FIELDNAME = "creatorUid";
@FieldDescribe("创建者UID")
@Column( length = JpaObject.length_64B, name = ColumnNamePrefix + creatorUid_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String creatorUid;
/**
* 获取操作对象类别
*
* @return
*/
public String getObjectType() {
return objectType;
}
/**
* 设置操作对象类别
*
* @param objectType
*/
public void setObjectType(String objectType) {
this.objectType = objectType;
}
/**
* 获取操作对象ID
*
* @return
*/
public String getObjectId() {
return objectId;
}
/**
* 设置操作对象ID
*
* @param objectId
*/
public void setObjectId(String objectId) {
this.objectId = objectId;
}
/**
* 获取文字描述
*
* @return
*/
public String getDescription() {
return description;
}
/**
* 设置文字描述
*
* @param description
*/
public void setDescription(String description) {
this.description = description;
}
/**
* 获取配置创建者帐号
*
* @return
*/
public String getCreatorUid() {
return creatorUid;
}
/**
* 设置配置创建者帐号
*
* @param creatorUid
*/
public void setCreatorUid(String creatorUid) {
this.creatorUid = creatorUid;
}
/**
* 获取使用者类别(组织(ORGAN)|人员(USER)
*
* @return
*/
public String getUsedObjectType() {
return usedObjectType;
}
/**
* 设置使用者类别(组织(ORGAN)|人员(USER)
*
* @param usedObjectType
*/
public void setUsedObjectType(String usedObjectType) {
this.usedObjectType = usedObjectType;
}
/**
* 获取使用者编码(组织OU|人员UID)
*
* @return
*/
public String getUsedObjectCode() {
return usedObjectCode;
}
/**
* 设置使用者编码(组织OU|人员UID)
*
* @param usedObjectCode
*/
public void setUsedObjectCode(String usedObjectCode) {
this.usedObjectCode = usedObjectCode;
}
/**
* 获取使用者名称
*
* @return
*/
public String getUsedObjectName() {
return usedObjectName;
}
/**
* 设置使用者名称
*
* @param usedObjectName
*/
public void setUsedObjectName(String usedObjectName) {
this.usedObjectName = usedObjectName;
}
public String getPermission() {
return permission;
}
public void setPermission(String permission) {
this.permission = permission;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getObjectName() {
return objectName;
}
public void setObjectName(String objectName) {
this.objectName = objectName;
}
}
\ No newline at end of file
......@@ -31,6 +31,11 @@ import com.x.base.core.entity.annotation.Flag;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.ListTools;
/**
* 栏目信息
* @author O2LEE
*
*/
@ContainerEntity
@Entity
@Table(name = PersistenceProperties.AppInfo.table, uniqueConstraints = {
......@@ -153,13 +158,13 @@ public class AppInfo extends SliceJpaObject {
@Column( length =AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + creatorTopUnitName_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String creatorTopUnitName;
public static final String reviewed_FIELDNAME = "reviewed";
@FieldDescribe("是否已经更新review.")
@Column( name = ColumnNamePrefix + reviewed_FIELDNAME)
public static final String anonymousAble_FIELDNAME = "anonymousAble";
@FieldDescribe("是否允许匿名访问.")
@Column( name = ColumnNamePrefix + anonymousAble_FIELDNAME)
@CheckPersist(allowEmpty = true)
@Index(name = TABLE + IndexNameMiddle + reviewed_FIELDNAME)
private Boolean reviewed = false;
@Index(name = TABLE + IndexNameMiddle + anonymousAble_FIELDNAME)
private Boolean anonymousAble = true;
public static final String allPeopleView_FIELDNAME = "allPeopleView";
@FieldDescribe("可见范围为所有人可见.")
......@@ -637,12 +642,12 @@ public class AppInfo extends SliceJpaObject {
removeStringFromList(this.manageableGroupList, groupName);
}
public Boolean getReviewed() {
return reviewed;
public Boolean getAnonymousAble() {
return anonymousAble;
}
public void setReviewed(Boolean reviewed) {
this.reviewed = reviewed;
public void setAnonymousAble(Boolean anonymousAble) {
this.anonymousAble = anonymousAble;
}
private List<String> addStringToList(List<String> sourceList, String targetString) {
......
......@@ -33,7 +33,7 @@ import com.x.base.core.project.tools.ListTools;
/**
* 内容管理栏目目录分类信息
*
* @author 李义
* @author O2LEE
*
*/
@ContainerEntity
......@@ -273,14 +273,14 @@ public class CategoryInfo extends SliceJpaObject {
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + importViewName_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String importViewName = null;
public static final String reviewed_FIELDNAME = "reviewed";
@FieldDescribe("是否已经更新review.")
@Column(name = ColumnNamePrefix + reviewed_FIELDNAME)
@CheckPersist(allowEmpty = true)
@Index(name = TABLE + IndexNameMiddle + reviewed_FIELDNAME)
private Boolean reviewed = false;
public static final String anonymousAble_FIELDNAME = "anonymousAble";
@FieldDescribe("是否允许匿名访问.")
@Column( name = ColumnNamePrefix + anonymousAble_FIELDNAME)
@CheckPersist(allowEmpty = true)
@Index(name = TABLE + IndexNameMiddle + anonymousAble_FIELDNAME)
private Boolean anonymousAble = true;
public static final String viewablePersonList_FIELDNAME = "viewablePersonList";
@FieldDescribe("发布可见人员")
@PersistentCollection(fetch = FetchType.EAGER)
......@@ -962,12 +962,12 @@ public class CategoryInfo extends SliceJpaObject {
this.importViewAppId = importViewAppId;
}
public Boolean getReviewed() {
return reviewed;
public Boolean getAnonymousAble() {
return anonymousAble;
}
public void setReviewed(Boolean reviewed) {
this.reviewed = reviewed;
public void setAnonymousAble(Boolean anonymousAble) {
this.anonymousAble = anonymousAble;
}
}
\ No newline at end of file
......@@ -12,6 +12,8 @@ import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OrderColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.PersistentCollection;
......@@ -27,6 +29,11 @@ import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
/**
* 文档基础信息类
* @author O2LEE
*
*/
@Entity
@ContainerEntity
@Table(name = PersistenceProperties.Document.table, uniqueConstraints = {
......@@ -197,6 +204,7 @@ public class Document extends SliceJpaObject {
public static final String publishTime_FIELDNAME = "publishTime";
@FieldDescribe("文档发布时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + publishTime_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + publishTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
......@@ -288,6 +296,43 @@ public class Document extends SliceJpaObject {
@ElementIndex(name = TABLE + IndexNameMiddle + authorGroupList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true)
private List<String> authorGroupList;
public static final String remindPersonList_FIELDNAME = "remindPersonList";
@FieldDescribe("发布提醒人员")
@PersistentCollection(fetch = FetchType.EAGER)
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ContainerTable(name = TABLE + ContainerTableNameMiddle
+ remindPersonList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle + remindPersonList_FIELDNAME
+ JoinIndexNameSuffix))
@ElementColumn(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix
+ remindPersonList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + remindPersonList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true)
private List<String> remindPersonList;
public static final String remindUnitList_FIELDNAME = "remindUnitList";
@FieldDescribe("发布提醒组织")
@PersistentCollection(fetch = FetchType.EAGER)
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ContainerTable(name = TABLE + ContainerTableNameMiddle + remindUnitList_FIELDNAME, joinIndex = @Index(name = TABLE
+ IndexNameMiddle + remindUnitList_FIELDNAME + JoinIndexNameSuffix))
@ElementColumn(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix
+ remindUnitList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + remindUnitList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true)
private List<String> remindUnitList;
public static final String remindGroupList_FIELDNAME = "remindGroupList";
@FieldDescribe("发布提醒群组")
@PersistentCollection(fetch = FetchType.EAGER)
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ContainerTable(name = TABLE + ContainerTableNameMiddle + remindGroupList_FIELDNAME, joinIndex = @Index(name = TABLE
+ IndexNameMiddle + remindGroupList_FIELDNAME + JoinIndexNameSuffix))
@ElementColumn(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix
+ remindGroupList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + remindGroupList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true)
private List<String> remindGroupList;
public static final String managerList_FIELDNAME = "managerList";
@FieldDescribe("管理者")
......@@ -633,6 +678,30 @@ public class Document extends SliceJpaObject {
public void setDescription(String description) {
this.description = description;
}
public List<String> getRemindPersonList() {
return remindPersonList;
}
public void setRemindPersonList(List<String> remindPersonList) {
this.remindPersonList = remindPersonList;
}
public List<String> getRemindUnitList() {
return remindUnitList;
}
public void setRemindUnitList(List<String> remindUnitList) {
this.remindUnitList = remindUnitList;
}
public List<String> getRemindGroupList() {
return remindGroupList;
}
public void setRemindGroupList(List<String> remindGroupList) {
this.remindGroupList = remindGroupList;
}
private List<String> addStringToList(List<String> sourceList, String targetString) {
if (sourceList == null) {
......
package com.x.cms.core.entity;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.jdbc.Index;
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.project.annotation.FieldDescribe;
/**
* 文档可见权限记录表 (取消数据结构,后续删除)
*
* @author 李义
*
*/
@ContainerEntity
@Entity
@Table(name = PersistenceProperties.DocumentPermission.table, uniqueConstraints = {
@UniqueConstraint(name = PersistenceProperties.DocumentPermission.table + JpaObject.IndexNameMiddle
+ JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN,
JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) })
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class DocumentPermission extends SliceJpaObject {
private static final long serialVersionUID = 3856138316794473794L;
private static final String TABLE = PersistenceProperties.DocumentPermission.table;
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();
public void onPersist() throws Exception {
}
/*
* =============================================================================
* ===== 以上为 JpaObject 默认字段
* =============================================================================
* =====
*/
/*
* =============================================================================
* ===== 以下为具体不同的业务及数据表字段要求
* =============================================================================
* =====
*/
public static final String documentId_FIELDNAME = "documentId";
@FieldDescribe("文档ID")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + documentId_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String documentId;
public static final String title_FIELDNAME = "title";
@FieldDescribe("文档标题")
@Column(length = JpaObject.length_255B, name = ColumnNamePrefix + title_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String title = "无标题";
public static final String appId_FIELDNAME = "appId";
@FieldDescribe("应用ID")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + appId_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + appId_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String appId;
public static final String appName_FIELDNAME = "appName";
@FieldDescribe("应用名称")
@Column(length = JpaObject.length_255B, name = ColumnNamePrefix + appName_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String appName;
public static final String categoryId_FIELDNAME = "categoryId";
@FieldDescribe("分类ID")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + categoryId_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + categoryId_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String categoryId;
public static final String categoryName_FIELDNAME = "categoryName";
@FieldDescribe("分类名称")
@Column(length = JpaObject.length_255B, name = ColumnNamePrefix + categoryName_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String categoryName;
public static final String categoryAlias_FIELDNAME = "categoryAlias";
@FieldDescribe("分类别名")
@Column(length = JpaObject.length_255B, name = ColumnNamePrefix + categoryAlias_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String categoryAlias;
public static final String docCreateDate_FIELDNAME = "docCreateDate";
@FieldDescribe("创建日期")
@Column( name = ColumnNamePrefix + docCreateDate_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + docCreateDate_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date docCreateDate;
public static final String publishDate_FIELDNAME = "publishDate";
@FieldDescribe("发布日期")
@Column( name = ColumnNamePrefix + publishDate_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + publishDate_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date publishDate;
public static final String documentStatus_FIELDNAME = "documentStatus";
@FieldDescribe("文档状态:草稿|审核中|已发布|已归档")
@Column(length = JpaObject.length_16B, name = ColumnNamePrefix + documentStatus_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + documentStatus_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String documentStatus = "草稿";
public static final String publisher_FIELDNAME = "publisher";
@FieldDescribe("发布者姓名")
@Column(length = JpaObject.length_255B, name = ColumnNamePrefix + publisher_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String publisher;
public static final String permission_FIELDNAME = "permission";
@FieldDescribe("权限类别:阅读|管理")
@Column(length = JpaObject.length_16B, name = ColumnNamePrefix + permission_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + permission_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String permission = "所有人";
public static final String permissionObjectType_FIELDNAME = "permissionObjectType";
@FieldDescribe("使用者类别:所有人|组织|人员|群组|角色")
@Column(length = JpaObject.length_16B, name = ColumnNamePrefix + permissionObjectType_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + permissionObjectType_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String permissionObjectType = "所有人";
public static final String permissionObjectCode_FIELDNAME = "permissionObjectCode";
@FieldDescribe("使用者编码:所有人|组织编码|人员UID|群组编码|角色编码")
@Column(length = JpaObject.length_255B, name = ColumnNamePrefix + permissionObjectCode_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + permissionObjectCode_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String permissionObjectCode = "所有人";
public static final String permissionObjectName_FIELDNAME = "permissionObjectName";
@FieldDescribe("使用者名称:所有人|组织名称|人员名称|群组名称|角色名称")
@Column(length = JpaObject.length_255B, name = ColumnNamePrefix + permissionObjectName_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String permissionObjectName = "所有人";
public static final String updateFlag_FIELDNAME = "updateFlag";
@FieldDescribe("更新标识")
@Column(length = JpaObject.length_32B, name = ColumnNamePrefix + updateFlag_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String updateFlag = null;
public String getAppId() {
return appId;
}
public String getAppName() {
return appName;
}
public String getCategoryId() {
return categoryId;
}
public String getCategoryName() {
return categoryName;
}
public void setAppId(String appId) {
this.appId = appId;
}
public void setAppName(String appName) {
this.appName = appName;
}
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public String getTitle() {
return title;
}
public Date getPublishDate() {
return publishDate;
}
public String getDocumentStatus() {
return documentStatus;
}
public String getPublisher() {
return publisher;
}
public void setTitle(String title) {
this.title = title;
}
public void setPublishDate(Date publishDate) {
this.publishDate = publishDate;
}
public void setDocumentStatus(String documentStatus) {
this.documentStatus = documentStatus;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
public String getDocumentId() {
return documentId;
}
public String getPermissionObjectType() {
return permissionObjectType;
}
public String getPermissionObjectCode() {
return permissionObjectCode;
}
public String getPermissionObjectName() {
return permissionObjectName;
}
public void setDocumentId(String documentId) {
this.documentId = documentId;
}
public void setPermissionObjectType(String permissionObjectType) {
this.permissionObjectType = permissionObjectType;
}
public void setPermissionObjectCode(String permissionObjectCode) {
this.permissionObjectCode = permissionObjectCode;
}
public void setPermissionObjectName(String permissionObjectName) {
this.permissionObjectName = permissionObjectName;
}
public String getPermission() {
return permission;
}
public void setPermission(String permission) {
this.permission = permission;
}
public String getUpdateFlag() {
return updateFlag;
}
public void setUpdateFlag(String updateFlag) {
this.updateFlag = updateFlag;
}
public Date getDocCreateDate() {
return docCreateDate;
}
public void setDocCreateDate(Date docCreateDate) {
this.docCreateDate = docCreateDate;
}
public String getCategoryAlias() {
return categoryAlias;
}
public void setCategoryAlias(String categoryAlias) {
this.categoryAlias = categoryAlias;
}
}
\ No newline at end of file
......@@ -8,6 +8,8 @@ import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.jdbc.Index;
......@@ -129,6 +131,7 @@ public class DocumentViewRecord extends SliceJpaObject {
public static final String lastViewTime_FIELDNAME = "lastViewTime";
@FieldDescribe("最后访问时间.")
@Temporal(TemporalType.TIMESTAMP)
@Column( name = ColumnNamePrefix + lastViewTime_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + lastViewTime_FIELDNAME)
private Date lastViewTime;
......
......@@ -8,6 +8,8 @@ import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.commons.lang3.StringUtils;
......@@ -60,6 +62,7 @@ public class FileInfo extends StorageObject {
public static final String lastUpdateTime_FIELDNAME = "lastUpdateTime";
@FieldDescribe("最后更新时间")
@Temporal(TemporalType.TIMESTAMP)
@Column( name = ColumnNamePrefix + lastUpdateTime_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + lastUpdateTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
......
......@@ -72,31 +72,8 @@ public final class PersistenceProperties extends AbstractPersistenceProperties {
public static final String table = "CMS_REVIEW";
}
/**
* 不用了,后续会删除
* @author O2LEE
*
*/
public static class AppCategoryAdmin {
public static final String table = "CMS_APPCATEGORY_ADMIN";
}
/**
* 不用了,后续会删除
* @author O2LEE
*
*/
public static class AppCategoryPermission {
public static final String table = "CMS_APPCATEGORY_PERMISSION";
}
/**
* 不用了,后续会删除
* @author O2LEE
*
*/
public static class DocumentPermission {
public static final String table = "CMS_DOCUMENT_PERMISSION";
public static class ReadRemind {
public static final String table = "CMS_READREMIND";
}
}
\ No newline at end of file
......@@ -23,6 +23,12 @@ import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.DateTools;
/**
* 文档发布消息提醒信息表
*
* @author O2LEE
*
*/
@Entity
@ContainerEntity
@Table(name = PersistenceProperties.Review.table, uniqueConstraints = {
......@@ -30,7 +36,7 @@ import com.x.base.core.project.tools.DateTools;
+ JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN,
JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) })
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Review extends SliceJpaObject {
public class ReadRemind extends SliceJpaObject {
private static final long serialVersionUID = -570048661936488247L;
private static final String TABLE = PersistenceProperties.Review.table;
......@@ -51,45 +57,23 @@ public class Review extends SliceJpaObject {
/* 以上为 JpaObject 默认字段 */
public void onPersist() throws Exception {
if ( StringUtils.isEmpty( this.publishTimeMonth ) && (null != this.publishTime )) {
try {
this.publishTimeMonth = DateTools.format( this.publishTime, DateTools.format_yyyyMM );
}catch( Exception e ) {
this.publishTimeMonth = "0";
}
}
}
/* 更新运行方法 */
public Review() {
public ReadRemind() {
}
public Review( Document doc, String readerType, String readerName, Boolean isPublic ) {
public ReadRemind( Document doc, String readerFlagType, String readerFlagName, String remindReader ) {
this.title = doc.getTitle();
this.appAlias = doc.getAppName();
this.appId = doc.getAppId();
this.appName = doc.getAppName();
this.categoryAlias = doc.getCategoryAlias();
this.categoryId = doc.getCategoryId();
this.categoryName = doc.getCategoryName();
this.creatorIdentity = doc.getCreatorIdentity();
this.creatorPerson = doc.getCreatorPerson();
this.creatorUnit = doc.getCreatorUnitName();
this.documentId = doc.getId();
this.isPublic = isPublic;
this.publishTime = doc.getPublishTime();
if ( StringUtils.isEmpty( this.publishTimeMonth ) && (null != this.publishTime )) {
try {
this.publishTimeMonth = DateTools.format( this.publishTime, DateTools.format_yyyyMM );
}catch( Exception e ) {
this.publishTimeMonth = "0";
}
}
this.readerName = readerName;
this.readerType = readerType;
this.remindTime = new Date();
this.readerFlagName = readerFlagName;
this.readerFlagType = readerFlagName;
this.remindReader = remindReader;
}
public static final String documentId_FIELDNAME = "documentId";
......@@ -102,32 +86,9 @@ public class Review extends SliceJpaObject {
public static final String title_FIELDNAME = "title";
@FieldDescribe("标题.")
@Column(length = length_255B, name = ColumnNamePrefix + title_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + title_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String title;
public static final String isPublic_FIELDNAME = "isPublic";
@FieldDescribe("是否全员可见.")
@Column(name = ColumnNamePrefix + isPublic_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + isPublic_FIELDNAME)
@CheckPersist(allowEmpty = false)
private Boolean isPublic;
public static final String publishTime_FIELDNAME = "publishTime";
@FieldDescribe("发布时间.")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + publishTime_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + publishTime_FIELDNAME)
@CheckPersist(allowEmpty = false)
private Date publishTime;
public static final String publishTimeMonth_FIELDNAME = "publishTimeMonth";
@FieldDescribe("用于在Filter中分类使用.")
@Column(length = JpaObject.length_16B, name = ColumnNamePrefix + publishTimeMonth_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + publishTimeMonth_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String publishTimeMonth;
public static final String appId_FIELDNAME = "appId";
@FieldDescribe("栏目ID.")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + appId_FIELDNAME)
......@@ -135,201 +96,142 @@ public class Review extends SliceJpaObject {
@CheckPersist(allowEmpty = false)
private String appId;
public static final String appName_FIELDNAME = "appName";
@FieldDescribe("栏目名称.")
@Column(length = AbstractPersistenceProperties.processPlatform_name_length, name = ColumnNamePrefix + appName_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + appName_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String appName;
public static final String appAlias_FIELDNAME = "appAlias";
@FieldDescribe("栏目别名.")
@Column(length = AbstractPersistenceProperties.processPlatform_name_length, name = ColumnNamePrefix + appAlias_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + appAlias_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String appAlias;
public static final String categoryId_FIELDNAME = "categoryId";
@FieldDescribe("分类ID.")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + categoryId_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + categoryId_FIELDNAME)
@CheckPersist(allowEmpty = false)
private String categoryId;
public static final String categoryName_FIELDNAME = "categoryName";
@FieldDescribe("分类名称.")
@Column(length = AbstractPersistenceProperties.processPlatform_name_length, name = ColumnNamePrefix + categoryName_FIELDNAME )
@Index(name = TABLE + IndexNameMiddle + categoryName_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String categoryName;
public static final String categoryAlias_FIELDNAME = "categoryAlias";
@FieldDescribe("分类别名.")
@Column(length = AbstractPersistenceProperties.processPlatform_name_length, name = ColumnNamePrefix + categoryAlias_FIELDNAME )
@Index(name = TABLE + IndexNameMiddle + categoryAlias_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String categoryAlias;
public static final String creatorPerson_FIELDNAME = "creatorPerson";
@FieldDescribe("创建人")
@Column(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + creatorPerson_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + creatorPerson_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String creatorPerson;
public static final String creatorIdentity_FIELDNAME = "creatorIdentity";
@FieldDescribe("创建人Identity")
@Column(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + creatorIdentity_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + creatorIdentity_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String creatorIdentity;
public static final String creatorUnit_FIELDNAME = "creatorUnit";
@FieldDescribe("创建人组织")
@Column(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + creatorUnit_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + creatorUnit_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String creatorUnit;
public static final String readerType_FIELDNAME = "readerType";
@FieldDescribe("可见人员|组织|群组")
@Column(length = JpaObject.length_16B, name = ColumnNamePrefix + readerType_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + readerType_FIELDNAME)
public static final String readerFlagType_FIELDNAME = "readerFlagType";
@FieldDescribe("标识:需要被提醒的人员|组织|群组")
@Column(length = JpaObject.length_16B, name = ColumnNamePrefix + readerFlagType_FIELDNAME)
@CheckPersist(allowEmpty = false)
private String readerFlagType;
public static final String readerFlagName_FIELDNAME = "readerFlagName";
@FieldDescribe("标识:需要被提醒的人员|组织|群组名称")
@Column(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + readerFlagName_FIELDNAME)
@CheckPersist(allowEmpty = false)
private String readerFlagName;
public static final String remindReader_FIELDNAME = "remindReader";
@FieldDescribe("真正需要被提醒的人员标识")
@Column(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + remindReader_FIELDNAME)
@CheckPersist(allowEmpty = false)
private String remindReader;
public static final String remindTime_FIELDNAME = "remindTime";
@FieldDescribe("提醒发送时间.")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + remindTime_FIELDNAME)
@CheckPersist(allowEmpty = false)
private String readerType;
private Date remindTime;
public static final String readerName_FIELDNAME = "readerName";
@FieldDescribe("可见人员|组织|群组名称")
@Column(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix + readerName_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + readerName_FIELDNAME)
public static final String readTime_FIELDNAME = "readTime";
@FieldDescribe("阅读时间.")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + readTime_FIELDNAME)
@CheckPersist(allowEmpty = false)
private String readerName;
private Date readTime;
public static final String reminded_FIELDNAME = "reminded";
@FieldDescribe("是否已经提醒.")
@Column(name = ColumnNamePrefix + reminded_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + reminded_FIELDNAME)
private Boolean reminded = false;
public static final String readed_FIELDNAME = "readed";
@FieldDescribe("是否已经阅读.")
@Column(name = ColumnNamePrefix + readed_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + readed_FIELDNAME)
private Boolean readed = false;
public String getDocumentId() {
return documentId;
}
public String getTitle() {
return title;
}
public Boolean getIsPublic() {
return isPublic;
public void setDocumentId(String documentId) {
this.documentId = documentId;
}
public Date getPublishTime() {
return publishTime;
public String getTitle() {
return title;
}
public String getPublishTimeMonth() {
return publishTimeMonth;
public void setTitle(String title) {
this.title = title;
}
public String getAppId() {
return appId;
}
public String getAppName() {
return appName;
}
public String getAppAlias() {
return appAlias;
public void setAppId(String appId) {
this.appId = appId;
}
public String getCategoryId() {
return categoryId;
}
public String getCategoryName() {
return categoryName;
}
public String getCategoryAlias() {
return categoryAlias;
}
public String getCreatorPerson() {
return creatorPerson;
}
public String getCreatorIdentity() {
return creatorIdentity;
}
public String getCreatorUnit() {
return creatorUnit;
}
public String getReaderType() {
return readerType;
}
public String getReaderName() {
return readerName;
}
public void setDocumentId(String documentId) {
this.documentId = documentId;
}
public void setTitle(String title) {
this.title = title;
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
public void setIsPublic(Boolean isPublic) {
this.isPublic = isPublic;
public String getReaderFlagType() {
return readerFlagType;
}
public void setPublishTime(Date publishTime) {
this.publishTime = publishTime;
public void setReaderFlagType(String readerFlagType) {
this.readerFlagType = readerFlagType;
}
public void setPublishTimeMonth(String publishTimeMonth) {
this.publishTimeMonth = publishTimeMonth;
public String getReaderFlagName() {
return readerFlagName;
}
public void setAppId(String appId) {
this.appId = appId;
public void setReaderFlagName(String readerFlagName) {
this.readerFlagName = readerFlagName;
}
public void setAppName(String appName) {
this.appName = appName;
public String getRemindReader() {
return remindReader;
}
public void setAppAlias(String appAlias) {
this.appAlias = appAlias;
public void setRemindReader(String remindReader) {
this.remindReader = remindReader;
}
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
public Date getRemindTime() {
return remindTime;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
public void setRemindTime(Date remindTime) {
this.remindTime = remindTime;
}
public void setCategoryAlias(String categoryAlias) {
this.categoryAlias = categoryAlias;
public Date getReadTime() {
return readTime;
}
public void setCreatorPerson(String creatorPerson) {
this.creatorPerson = creatorPerson;
public void setReadTime(Date readTime) {
this.readTime = readTime;
}
public void setCreatorIdentity(String creatorIdentity) {
this.creatorIdentity = creatorIdentity;
public Boolean getReaded() {
return readed;
}
public void setCreatorUnit(String creatorUnit) {
this.creatorUnit = creatorUnit;
public void setReaded(Boolean readed) {
this.readed = readed;
}
public void setReaderType(String readerType) {
this.readerType = readerType;
public Boolean getReminded() {
return reminded;
}
public void setReaderName(String readerName) {
this.readerName = readerName;
public void setReminded(Boolean reminded) {
this.reminded = reminded;
}
}
\ No newline at end of file
......@@ -11,6 +11,8 @@ import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.jdbc.Index;
......@@ -114,6 +116,7 @@ public class File extends SliceJpaObject {
public static final String lastUpdateTime_FIELDNAME = "lastUpdateTime";
@FieldDescribe("最后的编辑时间.")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + lastUpdateTime_FIELDNAME)
@CheckPersist(allowEmpty = false)
private Date lastUpdateTime;
......
......@@ -13,6 +13,8 @@ import javax.persistence.InheritanceType;
import javax.persistence.Lob;
import javax.persistence.OrderColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.PersistentCollection;
......@@ -140,6 +142,7 @@ public class QueryView extends SliceJpaObject {
public static final String lastUpdateTime_FIELDNAME = "lastUpdateTime";
@FieldDescribe("应用的最后修改时间。")
@Temporal(TemporalType.TIMESTAMP)
@CheckPersist(allowEmpty = false)
@Column( name = ColumnNamePrefix + lastUpdateTime_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + lastUpdateTime_FIELDNAME)
......
......@@ -13,6 +13,8 @@ import javax.persistence.InheritanceType;
import javax.persistence.Lob;
import javax.persistence.OrderColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.PersistentCollection;
......@@ -132,6 +134,7 @@ public class Script extends SliceJpaObject {
public static final String lastUpdateTime_FIELDNAME = "lastUpdateTime";
@FieldDescribe("最后的编辑时间.")
@Temporal(TemporalType.TIMESTAMP)
@Column( name = ColumnNamePrefix + lastUpdateTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date lastUpdateTime;
......
......@@ -790,7 +790,6 @@ public class Main {
method.invoke(urlClassLoader, new Object[] { file.toURI().toURL() });
}
}
/* load temp class */
method.invoke(urlClassLoader, new Object[] { Config.dir_local_temp_classes().toURI().toURL() });
}
......
......@@ -7,10 +7,10 @@ import com.x.base.core.project.config.Config;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.cms.core.entity.Document;
import com.x.cms.core.entity.DocumentPermission;
import com.x.cms.core.entity.DocumentViewRecord;
import com.x.cms.core.entity.FileInfo;
import com.x.cms.core.entity.Log;
import com.x.cms.core.entity.ReadRemind;
public class ActionEraseContentCms extends ActionEraseContentProcessPlatform {
......@@ -23,10 +23,10 @@ public class ActionEraseContentCms extends ActionEraseContentProcessPlatform {
}
this.init("cms", ItemCategory.cms);
addClass(Document.class);
addClass(DocumentPermission.class);
addClass(DocumentViewRecord.class);
addClass(FileInfo.class);
addClass(Log.class);
addClass(ReadRemind.class);
this.run();
return true;
}
......
......@@ -169,10 +169,17 @@ public class ActionUpdate extends ActionBase {
}
private void unzip(File file) throws Exception {
File dir = new File(Config.base(), "local/update");
FileUtils.forceMkdir(dir);
File dir = Config.dir_local_update(true);
FileUtils.cleanDirectory(dir);
JarTools.unjar(file, "", dir, true);
File dir_local = new File(dir, "local");
if (dir_local.exists()) {
FileUtils.forceDelete(dir_local);
}
File dir_config = new File(dir, "config");
if (dir_config.exists()) {
FileUtils.forceDelete(dir_config);
}
}
}
\ No newline at end of file
......@@ -69,7 +69,8 @@ public class ActionUpdateFile extends ActionUpdate {
files.add(new File(Config.base(), "console.jar"));
files.add(new File(Config.base(), "index.html"));
files.add(new File(Config.base(), "version.o2"));
FileFilter fileFilter = new RegexFileFilter("^(start_|stop_|console_|service_)(aix|windows|linux|macos).(sh|bat)$");
FileFilter fileFilter = new RegexFileFilter(
"^(start_|stop_|console_|service_)(aix|windows|linux|macos).(sh|bat)$");
for (File _f : new File(Config.base()).listFiles(fileFilter)) {
files.add(_f);
}
......@@ -81,5 +82,13 @@ public class ActionUpdateFile extends ActionUpdate {
File dir = Config.dir_local_update(true);
FileUtils.cleanDirectory(dir);
JarTools.unjar(file, "", dir, true);
File dir_local = new File(dir, "local");
if (dir_local.exists()) {
FileUtils.forceDelete(dir_local);
}
File dir_config = new File(dir, "config");
if (dir_config.exists()) {
FileUtils.forceDelete(dir_config);
}
}
}
\ No newline at end of file
......@@ -58,7 +58,7 @@ class ActionUpload extends BaseAction {
BufferedImage image = ImageIO.read(in);
if (image.getWidth() > scale) {
/** 图像的实际大小比scale大的要进行压缩 */
BufferedImage scalrImage = Scalr.resize(image, Method.SPEED, Mode.FIT_TO_WIDTH, scale);
BufferedImage scalrImage = Scalr.resize(image, Method.QUALITY, Mode.FIT_TO_WIDTH, scale);
ImageIO.write(scalrImage, file.getExtension(), baos);
} else {
/** 图像的实际大小比scale小,保存原图不进行压缩 */
......
......@@ -58,7 +58,7 @@ class ActionUploadCallback extends BaseAction {
BufferedImage image = ImageIO.read(in);
if (image.getWidth() > scale) {
/** 图像的实际大小比scale大的要进行压缩 */
BufferedImage scalrImage = Scalr.resize(image, Method.SPEED, Mode.FIT_TO_WIDTH, scale);
BufferedImage scalrImage = Scalr.resize(image, Method.QUALITY, Mode.FIT_TO_WIDTH, scale);
ImageIO.write(scalrImage, file.getExtension(), baos);
} else {
/** 图像的实际大小比scale小,保存原图不进行压缩 */
......
......@@ -49,7 +49,7 @@ class ActionUploadOctetStream extends BaseAction {
BufferedImage image = ImageIO.read(in);
if (image.getWidth() > scale) {
/** 图像的实际大小比scale大的要进行压缩 */
BufferedImage scalrImage = Scalr.resize(image, Method.SPEED, Mode.FIT_TO_WIDTH, scale);
BufferedImage scalrImage = Scalr.resize(image, Method.QUALITY, Mode.FIT_TO_WIDTH, scale);
ImageIO.write(scalrImage, file.getExtension(), baos);
} else {
/** 图像的实际大小比scale小,保存原图不进行压缩 */
......
......@@ -8,6 +8,8 @@ import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.commons.lang3.StringUtils;
......@@ -118,6 +120,7 @@ public class MindRecycleInfo extends SliceJpaObject {
public static final String fileCreateTime_FIELDNAME = "fileCreateTime";
@FieldDescribe("自动生成,文件创建时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + fileCreateTime_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + fileCreateTime_FIELDNAME)
private Date fileCreateTime;
......
......@@ -8,6 +8,8 @@ import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.commons.lang3.StringUtils;
......@@ -60,6 +62,7 @@ public class OkrAttachmentFileInfo extends StorageObject {
public static final String lastUpdateTime_FIELDNAME = "lastUpdateTime";
@FieldDescribe("最后更新时间")
@Temporal(TemporalType.TIMESTAMP)
@Column( name = ColumnNamePrefix + lastUpdateTime_FIELDNAME )
@Index(name = TABLE + IndexNameMiddle + lastUpdateTime_FIELDNAME)
@CheckPersist(allowEmpty = false)
......
......@@ -14,6 +14,8 @@ import javax.persistence.InheritanceType;
import javax.persistence.Lob;
import javax.persistence.OrderColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.PersistentCollection;
......@@ -165,6 +167,7 @@ public class OkrCenterWorkInfo extends SliceJpaObject {
public static final String defaultCompleteDateLimit_FIELDNAME = "defaultCompleteDateLimit";
@FieldDescribe("中心工作默认完成日期")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + defaultCompleteDateLimit_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date defaultCompleteDateLimit = null;
......
......@@ -11,6 +11,8 @@ import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.jdbc.Index;
......@@ -126,6 +128,7 @@ public class OkrStatisticReportContent extends SliceJpaObject {
public static final String statisticTime_FIELDNAME = "statisticTime";
@FieldDescribe("统计时间.")
@Temporal(TemporalType.TIMESTAMP)
@Column( name = ColumnNamePrefix + statisticTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date statisticTime = null;
......
......@@ -8,6 +8,8 @@ import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.jdbc.Index;
......@@ -137,6 +139,7 @@ public class OkrTask extends SliceJpaObject {
public static final String arriveDateTime_FIELDNAME = "arriveDateTime";
@FieldDescribe("到达时间")
@Temporal(TemporalType.TIMESTAMP)
@Column( name = ColumnNamePrefix + arriveDateTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date arriveDateTime = null;
......
......@@ -8,6 +8,8 @@ import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.jdbc.Index;
......@@ -135,6 +137,7 @@ public class OkrTaskHandled extends SliceJpaObject {
public static final String arriveDateTime_FIELDNAME = "arriveDateTime";
@FieldDescribe("到达时间")
@Temporal(TemporalType.TIMESTAMP)
@Column( name = ColumnNamePrefix + arriveDateTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date arriveDateTime = null;
......@@ -173,6 +176,7 @@ public class OkrTaskHandled extends SliceJpaObject {
public static final String processDateTime_FIELDNAME = "processDateTime";
@FieldDescribe("办理时间")
@Temporal(TemporalType.TIMESTAMP)
@Column( name = ColumnNamePrefix + processDateTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date processDateTime = null;
......
......@@ -8,6 +8,8 @@ import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.jdbc.Index;
......@@ -151,12 +153,14 @@ public class OkrWorkAuthorizeRecord extends SliceJpaObject {
public static final String delegateDateTime_FIELDNAME = "delegateDateTime";
@FieldDescribe("委托时间")
@Temporal(TemporalType.TIMESTAMP)
@Column( name = ColumnNamePrefix + delegateDateTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date delegateDateTime = null;
public static final String takebackDateTime_FIELDNAME = "takebackDateTime";
@FieldDescribe("收回时间")
@Temporal(TemporalType.TIMESTAMP)
@Column( name = ColumnNamePrefix + takebackDateTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date takebackDateTime = null;
......
......@@ -14,6 +14,8 @@ import javax.persistence.InheritanceType;
import javax.persistence.Lob;
import javax.persistence.OrderColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.PersistentCollection;
......@@ -188,13 +190,17 @@ public class OkrWorkBaseInfo extends SliceJpaObject {
private String confirmDateStr = "";
public static final String completeDateLimit_FIELDNAME = "completeDateLimit";
@FieldDescribe("工作完成日期")
@Temporal(TemporalType.TIMESTAMP)
@Column( name = ColumnNamePrefix + completeDateLimit_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date completeDateLimit = null;
public static final String archiveDate_FIELDNAME = "archiveDate";
@FieldDescribe("工作归档时间")
@Temporal(TemporalType.TIMESTAMP)
@Column( name = ColumnNamePrefix + archiveDate_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date archiveDate = null;
......@@ -267,19 +273,22 @@ public class OkrWorkBaseInfo extends SliceJpaObject {
public static final String completeTime_FIELDNAME = "completeTime";
@FieldDescribe("工作完成时间")
@Temporal(TemporalType.TIMESTAMP)
@Column( name = ColumnNamePrefix + completeTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date completeTime = null;
public static final String lastReportTime_FIELDNAME = "lastReportTime";
@FieldDescribe("上一次汇报时间")
@Column( length = JpaObject.length_32B, name = ColumnNamePrefix + lastReportTime_FIELDNAME)
@Temporal(TemporalType.TIMESTAMP)
@Column( name = ColumnNamePrefix + lastReportTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date lastReportTime = null;
public static final String nextReportTime_FIELDNAME = "nextReportTime";
@FieldDescribe("下一次汇报时间")
@Column( length = JpaObject.length_32B, name = ColumnNamePrefix + nextReportTime_FIELDNAME)
@Temporal(TemporalType.TIMESTAMP)
@Column( name = ColumnNamePrefix + nextReportTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date nextReportTime = null;
......
......@@ -8,6 +8,8 @@ import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.jdbc.Index;
......@@ -124,6 +126,7 @@ public class OkrWorkDynamics extends SliceJpaObject {
public static final String dateTime_FIELDNAME = "dateTime";
@FieldDescribe("操作时间")
@Temporal(TemporalType.TIMESTAMP)
@Column( name = ColumnNamePrefix + dateTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date dateTime = null;
......
......@@ -8,6 +8,8 @@ import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.jdbc.Index;
......@@ -168,6 +170,7 @@ public class OkrWorkPerson extends SliceJpaObject {
public static final String completeDateLimit_FIELDNAME = "completeDateLimit";
@FieldDescribe("工作完成日期")
@Temporal(TemporalType.TIMESTAMP)
@Column( name = ColumnNamePrefix + completeDateLimit_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date completeDateLimit = null;
......
......@@ -12,6 +12,8 @@ import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OrderColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.PersistentCollection;
......@@ -74,6 +76,7 @@ public class OkrWorkReportBaseInfo extends SliceJpaObject {
*/
public static final String submitTime_FIELDNAME = "submitTime";
@FieldDescribe("汇报提交时间.")
@Temporal(TemporalType.TIMESTAMP)
@Column( name = ColumnNamePrefix + submitTime_FIELDNAME)
private Date submitTime;
......
......@@ -11,6 +11,8 @@ import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.jdbc.Index;
......@@ -159,6 +161,7 @@ public class OkrWorkReportProcessLog extends SliceJpaObject {
public static final String arriveTime_FIELDNAME = "arriveTime";
@FieldDescribe("到达时间")
@Temporal(TemporalType.TIMESTAMP)
@Column( name = ColumnNamePrefix + arriveTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date arriveTime = null;
......@@ -171,6 +174,7 @@ public class OkrWorkReportProcessLog extends SliceJpaObject {
public static final String processTime_FIELDNAME = "processTime";
@FieldDescribe("处理时间")
@Temporal(TemporalType.TIMESTAMP)
@Column( name = ColumnNamePrefix + processTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date processTime = null;
......
......@@ -4,7 +4,7 @@ import javax.servlet.annotation.WebFilter;
import com.x.base.core.project.jaxrs.AnonymousCipherManagerUserJaxrsFilter;
@WebFilter(urlPatterns = "/jaxrs/qyweixin/*" ,asyncSupported=true)
public class QyweixinJaxrsFilter extends AnonymousCipherManagerUserJaxrsFilter {
@WebFilter(urlPatterns = "/jaxrs/qiyeweixin/*", asyncSupported = true)
public class QiyeweixinJaxrsFilter extends AnonymousCipherManagerUserJaxrsFilter {
}
......@@ -27,7 +27,7 @@ import com.x.organization.core.entity.Bind;
class ActionBind extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionBind.class);
private static Logger logger = LoggerFactory.getLogger(ActionBind.class);
ActionResult<Wo> execute() throws Exception {
......@@ -55,7 +55,8 @@ class ActionBind extends BaseAction {
}
}
Graphics2D graphics = image.createGraphics();
Image logo = ImageIO.read(new ByteArrayInputStream(logoBytes));
Image logo = ImageIO.read(new ByteArrayInputStream(Config.bindLogo()));
graphics.drawImage(logo, 68, 68, null);
graphics.dispose();
logo.flush();
......@@ -71,47 +72,47 @@ class ActionBind extends BaseAction {
private static final int BLACK = 0xFF000000;
private static final int WHITE = 0xFFFFFFFF;
private static final byte[] logoBytes = new byte[] { -119, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82,
0, 0, 0, 64, 0, 0, 0, 64, 8, 6, 0, 0, 0, -86, 105, 113, -34, 0, 0, 0, 4, 103, 65, 77, 65, 0, 0, -79, -113,
11, -4, 97, 5, 0, 0, 0, 32, 99, 72, 82, 77, 0, 0, 122, 38, 0, 0, -128, -124, 0, 0, -6, 0, 0, 0, -128, -24,
0, 0, 117, 48, 0, 0, -22, 96, 0, 0, 58, -104, 0, 0, 23, 112, -100, -70, 81, 60, 0, 0, 0, 6, 98, 75, 71, 68,
0, 0, 0, 0, 0, 0, -7, 67, -69, 127, 0, 0, 0, 9, 112, 72, 89, 115, 0, 0, 11, 18, 0, 0, 11, 18, 1, -46, -35,
126, -4, 0, 0, 3, 36, 73, 68, 65, 84, 120, -38, -19, -101, -51, 79, 19, 65, 24, -58, -97, 89, 49, -107,
-125, -75, 74, 37, 86, 69, 18, 67, -62, 87, -119, 7, 77, -76, -127, -58, -125, 127, 0, -31, 35, 106, 60,
-101, 72, 52, 24, 14, 4, 57, 122, -82, 112, -63, 24, 76, -4, 7, -60, -92, -59, -60, -77, 94, 10, 42, 28,
-107, 34, 120, 48, -126, 32, 6, -86, -108, 30, -124, 30, -24, 122, 104, 119, 83, 118, 27, 29, 103, 63, -34,
118, 119, 127, -57, -39, -39, -23, -13, 60, -23, -68, -99, -66, -39, 101, 40, 65, -106, -27, 65, 0, 93, 0,
-94, 0, 66, 112, 22, 27, 0, -110, 0, 102, 24, 99, -113, -107, 65, 86, 52, 30, 0, -16, 20, -64, 13, 106,
-107, 54, 49, 5, 96, -128, 49, -106, 81, 2, 120, -18, 34, -13, 106, 8, -116, -79, -101, -84, -8, -75, -97,
-96, 86, 67, -60, -3, 26, 20, -10, -68, -54, -20, -89, 77, -116, 37, 82, 72, 103, 115, -44, -30, 76, 37,
-24, -9, 97, -72, -73, 29, -99, -83, -11, -91, -61, 93, 18, 10, 5, 79, -59, -119, -26, 1, 32, -99, -51, 97,
44, -111, -46, 14, 71, 37, 104, -86, -67, 19, -51, -1, -59, 91, 72, -94, 22, 69, -115, 23, 0, -75, 0, 106,
106, 120, 39, 62, 27, -116, -96, -27, -20, 49, 106, -67, 92, 44, -81, 103, 113, 123, -30, 45, -41, 92, -18,
111, 64, -75, -104, 7, -128, -26, 51, 126, -18, -71, -82, -33, 2, -36, 1, 124, -8, -70, 77, -83, -43, 18,
-72, 107, -64, -67, -55, 57, 106, -83, 101, 9, -6, 125, 24, -23, 11, 35, -46, 114, 82, -24, -2, -86, -33, 2,
-23, 108, 14, -79, -8, -126, -16, -3, 85, 31, -128, 18, -126, -85, 3, 48, -126, -124, 66, -89, 68, 37, -24,
-9, 81, 107, -78, 61, -128, 100, -23, -64, 104, 127, 7, 66, 39, 106, -87, 117, -39, 70, 13, -128, 25, 0,
-41, -107, -127, -53, -51, 65, -68, 120, 112, -107, 90, 87, 89, 22, 87, 51, -72, -13, -28, -67, -87, 107,
74, -59, 6, -31, 20, -75, 57, 30, -38, -50, 5, 76, 95, -45, 43, -126, -59, -98, -96, -37, 26, -94, 42, -70,
-98, -32, -69, -91, 45, 60, 74, -92, -80, -75, -77, 7, 0, 56, 117, -68, 22, -93, -3, 97, 92, 108, -86, -125,
118, -34, -40, 116, 10, -101, -103, 61, -31, 15, -105, 36, -122, 75, 77, 117, 120, 120, -21, 2, -114, -42,
30, 46, -67, 116, -115, 49, -10, 6, 0, 100, 89, -106, -83, 12, 64, -41, 19, -116, -59, 23, 84, -13, 0, -16,
99, 123, -73, 92, 47, 13, -79, -8, -126, 33, -13, 0, -112, -49, -53, -104, -1, -100, 70, 124, 118, 69, 123,
41, 42, -78, -98, 104, 0, -1, -20, 9, -82, -3, -4, -83, 27, 51, -77, 119, -8, -3, -41, -82, 118, -24, -68,
-99, 1, -72, 26, -31, 0, -22, 3, 71, -88, -75, -45, 6, 48, -46, 27, 118, -60, -119, -111, -69, 31, -96, -27,
127, 79, -116, -5, 121, 25, -29, -45, -117, 120, 53, -1, -115, -38, -13, 1, 108, -85, 1, -121, 36, -122,
-114, -58, 0, -75, 95, -70, 0, 42, 21, -37, 2, -40, -49, -53, -8, -72, -110, -95, -10, -85, 67, -72, 6, -52,
45, -89, 49, -2, 50, -123, 13, -3, 111, 120, 85, 33, 28, 64, 44, 97, -4, 36, 88, 9, 8, 111, 1, 39, -104, 55,
20, -128, 83, -88, -120, 0, 78, -21, 15, 84, 95, -20, -6, 108, -31, 26, 96, 6, -54, -33, -31, -66, -50, 70,
-19, -91, -92, -56, 122, 21, 17, -64, -28, -35, 43, 8, 27, 63, -16, -68, -74, -72, 13, -96, 98, -6, 22, 48,
-63, -68, -83, 84, 68, 13, 112, 84, 0, -117, -85, 25, -53, -60, 90, -79, -74, -23, 53, -64, -20, -66, -67,
-43, 120, 91, -128, 90, 0, 53, 94, 0, -62, 55, 50, 70, -83, -35, 20, 45, -62, 1, -12, 68, 26, 42, 34, 4,
-119, 49, -12, 68, 26, -124, -17, 23, -2, 21, 24, -22, 110, -61, 80, 119, 27, -75, 127, -61, 120, 53, -128,
90, 0, 53, -36, 1, 44, -81, 103, -87, -75, 114, -77, -76, -74, -61, 61, -105, -69, 6, -16, 62, 123, 91, 109,
120, 91, -128, 90, 0, 53, 94, 0, 112, -47, 115, -126, 101, -68, 109, -24, -98, 19, 28, -18, 109, 119, 100,
8, -54, 107, 115, 26, -110, -82, 127, 113, -46, -11, -81, -50, 42, 69, 112, 0, 85, -14, -80, -92, 89, -26,
-117, -98, 113, -32, -17, -100, 27, 95, -97, -1, 3, 15, 32, -32, 95, -60, -127, 21, 87, 0, 0, 0, 0, 73, 69,
78, 68, -82, 66, 96, -126 };
// private static final byte[] logoBytes = new byte[] { -119, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82,
// 0, 0, 0, 64, 0, 0, 0, 64, 8, 6, 0, 0, 0, -86, 105, 113, -34, 0, 0, 0, 4, 103, 65, 77, 65, 0, 0, -79, -113,
// 11, -4, 97, 5, 0, 0, 0, 32, 99, 72, 82, 77, 0, 0, 122, 38, 0, 0, -128, -124, 0, 0, -6, 0, 0, 0, -128, -24,
// 0, 0, 117, 48, 0, 0, -22, 96, 0, 0, 58, -104, 0, 0, 23, 112, -100, -70, 81, 60, 0, 0, 0, 6, 98, 75, 71, 68,
// 0, 0, 0, 0, 0, 0, -7, 67, -69, 127, 0, 0, 0, 9, 112, 72, 89, 115, 0, 0, 11, 18, 0, 0, 11, 18, 1, -46, -35,
// 126, -4, 0, 0, 3, 36, 73, 68, 65, 84, 120, -38, -19, -101, -51, 79, 19, 65, 24, -58, -97, 89, 49, -107,
// -125, -75, 74, 37, 86, 69, 18, 67, -62, 87, -119, 7, 77, -76, -127, -58, -125, 127, 0, -31, 35, 106, 60,
// -101, 72, 52, 24, 14, 4, 57, 122, -82, 112, -63, 24, 76, -4, 7, -60, -92, -59, -60, -77, 94, 10, 42, 28,
// -107, 34, 120, 48, -126, 32, 6, -86, -108, 30, -124, 30, -24, 122, 104, 119, 83, 118, 27, 29, 103, 63, -34,
// 118, 119, 127, -57, -39, -39, -23, -13, 60, -23, -68, -99, -66, -39, 101, 40, 65, -106, -27, 65, 0, 93, 0,
// -94, 0, 66, 112, 22, 27, 0, -110, 0, 102, 24, 99, -113, -107, 65, 86, 52, 30, 0, -16, 20, -64, 13, 106,
// -107, 54, 49, 5, 96, -128, 49, -106, 81, 2, 120, -18, 34, -13, 106, 8, -116, -79, -101, -84, -8, -75, -97,
// -96, 86, 67, -60, -3, 26, 20, -10, -68, -54, -20, -89, 77, -116, 37, 82, 72, 103, 115, -44, -30, 76, 37,
// -24, -9, 97, -72, -73, 29, -99, -83, -11, -91, -61, 93, 18, 10, 5, 79, -59, -119, -26, 1, 32, -99, -51, 97,
// 44, -111, -46, 14, 71, 37, 104, -86, -67, 19, -51, -1, -59, 91, 72, -94, 22, 69, -115, 23, 0, -75, 0, 106,
// 106, 120, 39, 62, 27, -116, -96, -27, -20, 49, 106, -67, 92, 44, -81, 103, 113, 123, -30, 45, -41, 92, -18,
// 111, 64, -75, -104, 7, -128, -26, 51, 126, -18, -71, -82, -33, 2, -36, 1, 124, -8, -70, 77, -83, -43, 18,
// -72, 107, -64, -67, -55, 57, 106, -83, 101, 9, -6, 125, 24, -23, 11, 35, -46, 114, 82, -24, -2, -86, -33, 2,
// -23, 108, 14, -79, -8, -126, -16, -3, 85, 31, -128, 18, -126, -85, 3, 48, -126, -124, 66, -89, 68, 37, -24,
// -9, 81, 107, -78, 61, -128, 100, -23, -64, 104, 127, 7, 66, 39, 106, -87, 117, -39, 70, 13, -128, 25, 0,
// -41, -107, -127, -53, -51, 65, -68, 120, 112, -107, 90, 87, 89, 22, 87, 51, -72, -13, -28, -67, -87, 107,
// 74, -59, 6, -31, 20, -75, 57, 30, -38, -50, 5, 76, 95, -45, 43, -126, -59, -98, -96, -37, 26, -94, 42, -70,
// -98, -32, -69, -91, 45, 60, 74, -92, -80, -75, -77, 7, 0, 56, 117, -68, 22, -93, -3, 97, 92, 108, -86, -125,
// 118, -34, -40, 116, 10, -101, -103, 61, -31, 15, -105, 36, -122, 75, 77, 117, 120, 120, -21, 2, -114, -42,
// 30, 46, -67, 116, -115, 49, -10, 6, 0, 100, 89, -106, -83, 12, 64, -41, 19, -116, -59, 23, 84, -13, 0, -16,
// 99, 123, -73, 92, 47, 13, -79, -8, -126, 33, -13, 0, -112, -49, -53, -104, -1, -100, 70, 124, 118, 69, 123,
// 41, 42, -78, -98, 104, 0, -1, -20, 9, -82, -3, -4, -83, 27, 51, -77, 119, -8, -3, -41, -82, 118, -24, -68,
// -99, 1, -72, 26, -31, 0, -22, 3, 71, -88, -75, -45, 6, 48, -46, 27, 118, -60, -119, -111, -69, 31, -96, -27,
// 127, 79, -116, -5, 121, 25, -29, -45, -117, 120, 53, -1, -115, -38, -13, 1, 108, -85, 1, -121, 36, -122,
// -114, -58, 0, -75, 95, -70, 0, 42, 21, -37, 2, -40, -49, -53, -8, -72, -110, -95, -10, -85, 67, -72, 6, -52,
// 45, -89, 49, -2, 50, -123, 13, -3, 111, 120, 85, 33, 28, 64, 44, 97, -4, 36, 88, 9, 8, 111, 1, 39, -104, 55,
// 20, -128, 83, -88, -120, 0, 78, -21, 15, 84, 95, -20, -6, 108, -31, 26, 96, 6, -54, -33, -31, -66, -50, 70,
// -19, -91, -92, -56, 122, 21, 17, -64, -28, -35, 43, 8, 27, 63, -16, -68, -74, -72, 13, -96, 98, -6, 22, 48,
// -63, -68, -83, 84, 68, 13, 112, 84, 0, -117, -85, 25, -53, -60, 90, -79, -74, -23, 53, -64, -20, -66, -67,
// -43, 120, 91, -128, 90, 0, 53, 94, 0, -62, 55, 50, 70, -83, -35, 20, 45, -62, 1, -12, 68, 26, 42, 34, 4,
// -119, 49, -12, 68, 26, -124, -17, 23, -2, 21, 24, -22, 110, -61, 80, 119, 27, -75, 127, -61, 120, 53, -128,
// 90, 0, 53, -36, 1, 44, -81, 103, -87, -75, 114, -77, -76, -74, -61, 61, -105, -69, 6, -16, 62, 123, 91, 109,
// 120, 91, -128, 90, 0, 53, 94, 0, 112, -47, 115, -126, 101, -68, 109, -24, -98, 19, 28, -18, 109, 119, 100,
// 8, -54, 107, 115, 26, -110, -82, 127, 113, -46, -11, -81, -50, 42, 69, 112, 0, 85, -14, -80, -92, 89, -26,
// -117, -98, 113, -32, -17, -100, 27, 95, -97, -1, 3, 15, 32, -32, 95, -60, -127, 21, 87, 0, 0, 0, 0, 73, 69,
// 78, 68, -82, 66, 96, -126 };
public class Wo extends Bind {
......
......@@ -45,7 +45,13 @@ class ActionGetLogin extends BaseAction {
}
String url = Config.qiyeweixin().getApiAddress() + "/cgi-bin/user/getuserinfo?access_token="
+ Config.qiyeweixin().corpAccessToken() + "&code=" + code;
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
System.out.println(url);
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
String str = HttpConnection.getAsString(url, null);
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
System.out.println(str);
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
logger.debug("qyweixin return:{}", str);
JsonElement jsonElement = gson.fromJson(str, JsonElement.class);
......
......@@ -44,8 +44,8 @@ class ActionList extends BaseAction {
ListTools.groupStick(wos, pageList, "id", "portal", "pageList");
ListTools.groupStick(wos, scriptList, "id", "portal", "scriptList");
ListTools.groupStick(wos, fileList, "id", "portal", "fileList");
ListTools.groupStick(wos, widgetList, "id", "portal", "widgetList");
wos = wos.stream()
.sorted(Comparator.comparing(Wo::getAlias, Comparator.nullsLast(String::compareTo))
.thenComparing(Wo::getName, Comparator.nullsLast(String::compareTo)))
......
<?xml version="1.0" encoding="UTF-8"?><Configure class="org.eclipse.jetty.webapp.WebAppContext"><Set name="contextPath">/x_portal_assemble_designer</Set><Set name="war">D:\O2\o2oa\o2server\store\x_portal_assemble_designer.war</Set><Set name="extraClasspath">D:\O2\o2oa\o2server\store\jars\x_base_core_project.jar;D:\O2\o2oa\o2server\commons\ext\ehcache-2.10.3.jar;D:\O2\o2oa\o2server\commons\ext\jetty-all-9.4.10.v20180503-uber.jar;D:\O2\o2oa\o2server\commons\ext\jul-to-slf4j-1.7.25.jar;D:\O2\o2oa\o2server\commons\ext\openjpa-3.0.1-SNAPSHOT.jar;D:\O2\o2oa\o2server\commons\ext\quartz-2.3.0.jar;D:\O2\o2oa\o2server\commons\ext\slf4j-api-1.7.25.jar;D:\O2\o2oa\o2server\commons\ext\slf4j-simple-1.7.25.jar;D:\O2\o2oa\o2server\store\jars\x_organization_core_entity.jar;D:\O2\o2oa\o2server\store\jars\x_organization_core_express.jar;D:\O2\o2oa\o2server\store\jars\x_portal_core_entity.jar</Set><Set name="tempDirectory">D:\O2\o2oa\o2server\servers\applicationServer\work\x_portal_assemble_designer</Set></Configure>
\ No newline at end of file
......@@ -1004,6 +1004,43 @@ public class Business {
return false;
}
public boolean readableWithWork(EffectivePerson effectivePerson, String workId, PromptException entityException)
throws Exception {
Work work = emc.fetch(workId, Work.class, ListTools.toList(Work.job_FIELDNAME, Work.application_FIELDNAME,
Work.process_FIELDNAME, Work.creatorPerson_FIELDNAME));
if (null == work) {
if (null != entityException) {
throw entityException;
} else {
return false;
}
}
if (effectivePerson.isPerson(work.getCreatorPerson())) {
return true;
}
if (emc.countEqualAndEqual(TaskCompleted.class, TaskCompleted.person_FIELDNAME,
effectivePerson.getDistinguishedName(), TaskCompleted.job_FIELDNAME, work.getJob()) == 0) {
if (emc.countEqualAndEqual(ReadCompleted.class, ReadCompleted.person_FIELDNAME,
effectivePerson.getDistinguishedName(), ReadCompleted.job_FIELDNAME, work.getJob()) == 0) {
if (emc.countEqualAndEqual(Task.class, Task.person_FIELDNAME, effectivePerson.getDistinguishedName(),
Task.job_FIELDNAME, work.getJob()) == 0) {
if (emc.countEqualAndEqual(Read.class, Read.person_FIELDNAME,
effectivePerson.getDistinguishedName(), Read.job_FIELDNAME, work.getJob()) == 0) {
if (emc.countEqualAndEqual(Review.class, Review.person_FIELDNAME,
effectivePerson.getDistinguishedName(), Review.job_FIELDNAME, work.getJob()) == 0) {
Application application = application().pick(work.getApplication());
Process process = process().pick(work.getProcess());
if (!canManageApplicationOrProcess(effectivePerson, application, process)) {
return false;
}
}
}
}
}
}
return true;
}
public boolean readableWithWorkOrWorkCompleted(EffectivePerson effectivePerson, String workOrWorkCompleted,
PromptException entityException) throws Exception {
Work work = emc.fetch(workOrWorkCompleted, Work.class, ListTools.toList(Work.job_FIELDNAME,
......@@ -1120,6 +1157,23 @@ public class Business {
return true;
}
public boolean editable(EffectivePerson effectivePerson, Work work) throws Exception {
if (null == work) {
return false;
}
if (effectivePerson.isManager()) {
return true;
}
if (emc.countEqualAndEqual(Task.class, Task.person_FIELDNAME, effectivePerson.getDistinguishedName(),
Task.work_FIELDNAME, work.getId()) > 0) {
return true;
}
if (this.canManageApplicationOrProcess(effectivePerson, work.getApplication(), work.getProcess())) {
return true;
}
return false;
}
public boolean controllerable(Business business, EffectivePerson effectivePerson, Application application,
Process process, Attachment attachment) throws Exception {
if (ListTools.isEmpty(attachment.getControllerIdentityList(), attachment.getControllerUnitList())) {
......
package com.x.processplatform.assemble.surface.jaxrs.data;
import org.apache.commons.lang3.BooleanUtils;
import com.google.gson.JsonElement;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
......@@ -36,8 +34,7 @@ class ActionUpdateWithWork extends BaseAction {
if (null == work) {
throw new ExceptionEntityNotExist(id, Work.class);
}
WoControl control = business.getControl(effectivePerson, work, WoControl.class);
if (BooleanUtils.isNotTrue(control.getAllowSave())) {
if (!business.editable(effectivePerson, work)) {
throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(),
work.getId());
}
......
package com.x.processplatform.assemble.surface.jaxrs.data;
import org.apache.commons.lang3.BooleanUtils;
import com.google.gson.JsonElement;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
......@@ -24,8 +22,7 @@ class ActionUpdateWithWorkPath0 extends BaseAction {
if (null == work) {
throw new ExceptionEntityNotExist(id, Work.class);
}
WoControl control = business.getControl(effectivePerson, work, WoControl.class);
if (BooleanUtils.isNotTrue(control.getAllowSave())) {
if (!business.editable(effectivePerson, work)) {
throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(),
work.getId());
}
......
......@@ -24,8 +24,7 @@ class ActionUpdateWithWorkPath1 extends BaseAction {
if (null == work) {
throw new ExceptionEntityNotExist(id, Work.class);
}
WoControl control = business.getControl(effectivePerson, work, WoControl.class);
if (BooleanUtils.isNotTrue(control.getAllowSave())) {
if (!business.editable(effectivePerson, work)) {
throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(),
work.getId());
}
......
......@@ -24,8 +24,7 @@ class ActionUpdateWithWorkPath2 extends BaseAction {
if (null == work) {
throw new ExceptionEntityNotExist(id, Work.class);
}
WoControl control = business.getControl(effectivePerson, work, WoControl.class);
if (BooleanUtils.isNotTrue(control.getAllowSave())) {
if (!business.editable(effectivePerson, work)) {
throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(),
work.getId());
}
......
......@@ -24,8 +24,7 @@ class ActionUpdateWithWorkPath3 extends BaseAction {
if (null == work) {
throw new ExceptionEntityNotExist(id, Work.class);
}
WoControl control = business.getControl(effectivePerson, work, WoControl.class);
if (BooleanUtils.isNotTrue(control.getAllowSave())) {
if (!business.editable(effectivePerson, work)) {
throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(),
work.getId());
}
......
......@@ -24,9 +24,9 @@ class ActionUpdateWithWorkPath4 extends BaseAction {
if (null == work) {
throw new ExceptionEntityNotExist(id, Work.class);
}
WoControl control = business.getControl(effectivePerson, work, WoControl.class);
if (BooleanUtils.isNotTrue(control.getAllowSave())) {
throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(), work.getId());
if (!business.editable(effectivePerson, work)) {
throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(),
work.getId());
}
/** 先更新title和serial,再更新DataItem,因为旧的DataItem中也有title和serial数据. */
this.updateTitleSerial(business, work, jsonElement);
......
......@@ -24,8 +24,7 @@ class ActionUpdateWithWorkPath5 extends BaseAction {
if (null == work) {
throw new ExceptionEntityNotExist(id, Work.class);
}
WoControl control = business.getControl(effectivePerson, work, WoControl.class);
if (BooleanUtils.isNotTrue(control.getAllowSave())) {
if (!business.editable(effectivePerson, work)) {
throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(),
work.getId());
}
......
......@@ -25,9 +25,9 @@ class ActionUpdateWithWorkPath6 extends BaseAction {
if (null == work) {
throw new ExceptionEntityNotExist(id, Work.class);
}
WoControl control = business.getControl(effectivePerson, work, WoControl.class);
if (BooleanUtils.isNotTrue(control.getAllowSave())) {
throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(), work.getId());
if (!business.editable(effectivePerson, work)) {
throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(),
work.getId());
}
/** 先更新title和serial,再更新DataItem,因为旧的DataItem中也有title和serial数据. */
this.updateTitleSerial(business, work, jsonElement);
......
......@@ -25,8 +25,7 @@ class ActionUpdateWithWorkPath7 extends BaseAction {
if (null == work) {
throw new ExceptionEntityNotExist(id, Work.class);
}
WoControl control = business.getControl(effectivePerson, work, WoControl.class);
if (BooleanUtils.isNotTrue(control.getAllowSave())) {
if (!business.editable(effectivePerson, work)) {
throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(),
work.getId());
}
......
......@@ -15,6 +15,7 @@ import com.x.base.core.entity.dataitem.ItemType;
import com.x.base.core.project.gson.XGsonBuilder;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.core.entity.content.Attachment;
import com.x.processplatform.core.entity.content.Data;
import com.x.processplatform.core.entity.content.Read;
import com.x.processplatform.core.entity.content.ReadCompleted;
......@@ -27,9 +28,7 @@ import com.x.query.core.entity.Item;
abstract class BaseAction extends StandardJaxrsAction {
private static final String title_path = "title";
private static final String subject_path = "subject";
private static final String serial_path = "serial";
protected Gson gson = XGsonBuilder.instance();
......@@ -43,11 +42,11 @@ abstract class BaseAction extends StandardJaxrsAction {
/** 将data中的Title 和 serial 字段同步到work中 */
void updateTitleSerial(Business business, Work work, JsonElement jsonElement) throws Exception {
String title = XGsonBuilder.extractString(jsonElement, title_path);
String title = XGsonBuilder.extractString(jsonElement, Work.title_FIELDNAME);
if (null == title) {
title = XGsonBuilder.extractString(jsonElement, subject_path);
}
String serial = XGsonBuilder.extractString(jsonElement, serial_path);
String serial = XGsonBuilder.extractString(jsonElement, Work.serial_FIELDNAME);
/* 如果有数据就将数据覆盖到work task taskCompleted read readCompleted review 中 */
if (((null != title) && (!Objects.equals(title, work.getTitle())))
|| ((null != serial) && (!Objects.equals(serial, work.getSerial())))) {
......@@ -57,40 +56,55 @@ abstract class BaseAction extends StandardJaxrsAction {
business.entityManagerContainer().beginTransaction(Read.class);
business.entityManagerContainer().beginTransaction(ReadCompleted.class);
business.entityManagerContainer().beginTransaction(Review.class);
business.entityManagerContainer().beginTransaction(Item.class);
List<Task> tasks = business.entityManagerContainer().listEqual(Task.class, Task.job_FIELDNAME,
work.getJob());
List<TaskCompleted> taskCompleteds = business.entityManagerContainer().listEqual(TaskCompleted.class,
TaskCompleted.job_FIELDNAME, work.getJob());
List<Read> reads = business.entityManagerContainer().listEqual(Read.class, Read.job_FIELDNAME,
work.getJob());
List<ReadCompleted> readCompleteds = business.entityManagerContainer().listEqual(ReadCompleted.class,
ReadCompleted.job_FIELDNAME, work.getJob());
List<Review> reviews = business.entityManagerContainer().listEqual(Review.class, Review.job_FIELDNAME,
work.getJob());
if ((null != title) && (!Objects.equals(title, work.getTitle()))) {
work.setTitle(title);
for (Task o : tasks) {
o.setTitle(title);
}
for (TaskCompleted o : taskCompleteds) {
o.setTitle(title);
}
for (Read o : reads) {
o.setTitle(title);
}
for (ReadCompleted o : readCompleteds) {
o.setTitle(title);
}
for (Review o : reviews) {
o.setTitle(title);
}
}
if ((null != serial) && (!Objects.equals(serial, work.getSerial()))) {
work.setSerial(serial);
for (Task o : tasks) {
o.setSerial(serial);
}
for (TaskCompleted o : taskCompleteds) {
o.setSerial(serial);
}
for (Read o : reads) {
o.setSerial(serial);
}
for (ReadCompleted o : readCompleteds) {
o.setSerial(serial);
}
for (Review o : reviews) {
o.setSerial(serial);
}
}
for (Task o : business.entityManagerContainer().list(Task.class, business.task().listWithWork(work))) {
o.setTitle(work.getTitle());
o.setSerial(work.getSerial());
}
for (TaskCompleted o : business.entityManagerContainer().list(TaskCompleted.class,
business.taskCompleted().listWithWork(work))) {
o.setTitle(work.getTitle());
o.setSerial(work.getSerial());
}
for (Read o : business.entityManagerContainer().list(Read.class, business.read().listWithWork(work))) {
o.setTitle(work.getTitle());
o.setSerial(work.getSerial());
}
for (ReadCompleted o : business.entityManagerContainer().list(ReadCompleted.class,
business.readCompleted().listWithWork(work))) {
o.setTitle(work.getTitle());
o.setSerial(work.getSerial());
}
for (Review o : business.entityManagerContainer().list(Review.class,
business.review().listWithWork(work))) {
o.setTitle(work.getTitle());
o.setSerial(work.getSerial());
}
// for (Item o : business.item().listWithJobWithPath(work.getJob())) {
// o.setTitle(work.getTitle());
// o.setSerial(work.getSerial());
// }
/** 这里必须先提交掉,不然后面的获取会得到不一致的状态 */
/**
* <openjpa-2.4.3-SNAPSHOT-r422266:1777109 nonfatal user error>
......@@ -104,12 +118,11 @@ abstract class BaseAction extends StandardJaxrsAction {
void updateData(Business business, Work work, JsonElement jsonElement, String... paths) throws Exception {
if (jsonElement.isJsonObject()) {
JsonObject jsonObject = jsonElement.getAsJsonObject();
if (jsonObject.has(Data.WORK_PROPERTY)) {
jsonObject.remove(Data.WORK_PROPERTY);
}
if (jsonObject.has(Data.ATTACHMENTLIST_PROPERTY)) {
jsonObject.remove(Data.ATTACHMENTLIST_PROPERTY);
}
jsonObject.add(Data.WORK_PROPERTY, gson.toJsonTree(Data.DataWork.workCopier.copy(work)));
jsonObject.add(Data.ATTACHMENTLIST_PROPERTY,
gson.toJsonTree(this.listDataAttachment(business, work.getJob())));
jsonElement = jsonObject;
}
DataItemConverter<Item> converter = new DataItemConverter<>(Item.class);
......@@ -138,12 +151,11 @@ abstract class BaseAction extends StandardJaxrsAction {
throws Exception {
if (jsonElement.isJsonObject()) {
JsonObject jsonObject = jsonElement.getAsJsonObject();
if (jsonObject.has(Data.WORK_PROPERTY)) {
jsonObject.remove(Data.WORK_PROPERTY);
}
if (jsonObject.has(Data.ATTACHMENTLIST_PROPERTY)) {
jsonObject.remove(Data.ATTACHMENTLIST_PROPERTY);
}
jsonObject.add(Data.WORK_PROPERTY, gson.toJsonTree(Data.DataWork.workCompletedCopier.copy(workCompleted)));
jsonObject.add(Data.ATTACHMENTLIST_PROPERTY,
gson.toJsonTree(this.listDataAttachment(business, workCompleted.getJob())));
jsonElement = jsonObject;
}
DataItemConverter<Item> converter = new DataItemConverter<>(Item.class);
......@@ -170,12 +182,11 @@ abstract class BaseAction extends StandardJaxrsAction {
void createData(Business business, Work work, JsonElement jsonElement, String... paths) throws Exception {
if (jsonElement.isJsonObject()) {
JsonObject jsonObject = jsonElement.getAsJsonObject();
if (jsonObject.has(Data.WORK_PROPERTY)) {
jsonObject.remove(Data.WORK_PROPERTY);
}
if (jsonObject.has(Data.ATTACHMENTLIST_PROPERTY)) {
jsonObject.remove(Data.ATTACHMENTLIST_PROPERTY);
}
jsonObject.add(Data.WORK_PROPERTY, gson.toJsonTree(Data.DataWork.workCopier.copy(work)));
jsonObject.add(Data.ATTACHMENTLIST_PROPERTY,
gson.toJsonTree(this.listDataAttachment(business, work.getJob())));
jsonElement = jsonObject;
}
String[] parentPaths = new String[] { "", "", "", "", "", "", "", "" };
......@@ -235,7 +246,7 @@ abstract class BaseAction extends StandardJaxrsAction {
business.entityManagerContainer().remove(o);
}
if (paths.length > 0) {
if (NumberUtils.isNumber(paths[paths.length - 1])) {
if (NumberUtils.isCreatable(paths[paths.length - 1])) {
int position = paths.length - 1;
for (Item o : business.item().listWithJobWithPathWithAfterLocation(work.getJob(),
NumberUtils.toInt(paths[position]), paths)) {
......@@ -261,4 +272,9 @@ abstract class BaseAction extends StandardJaxrsAction {
o.setBundle(workCompleted.getJob());
o.setItemCategory(ItemCategory.pp);
}
private List<Data.DataAttachment> listDataAttachment(Business business, String job) throws Exception {
return business.entityManagerContainer().fetchEqual(Attachment.class, Data.DataAttachment.copier,
Attachment.job_FIELDNAME, job);
}
}
\ No newline at end of file
......@@ -25,7 +25,6 @@ import com.x.processplatform.core.entity.content.WorkLog;
import com.x.processplatform.core.entity.element.ActivityType;
import com.x.processplatform.core.entity.element.Manual;
import com.x.processplatform.core.entity.element.util.WorkLogTree;
import com.x.processplatform.core.entity.element.util.WorkLogTree.Node;
class ActionAddSplit extends BaseAction {
......@@ -48,36 +47,19 @@ class ActionAddSplit extends BaseAction {
|| (!BooleanUtils.isTrue(work.getSplitting()))) {
throw new ExceptionCannotAddSplit(work.getId());
}
List<WorkLog> workLogs = emc.listEqual(WorkLog.class, WorkLog.job_FIELDNAME, work.getJob());
WorkLog currentWorkLog = workLogs.stream()
.filter(o -> StringUtils.equals(o.getFromActivityToken(), work.getActivityToken())).findFirst()
.orElse(null);
if (null == currentWorkLog) {
throw new ExceptionCurrentWorkLogNotFound(work.getId());
}
WorkLogTree tree = new WorkLogTree(workLogs);
WorkLogTree.Node currentNode = tree.find(currentWorkLog);
WorkLogTree.Nodes upManualNodes = currentNode.upTo(ActivityType.manual, ActivityType.agent,
ActivityType.choice, ActivityType.delay, ActivityType.delay, ActivityType.embed,
ActivityType.invoke, ActivityType.message, ActivityType.parallel, ActivityType.service,
ActivityType.split);
if (upManualNodes.isEmpty()) {
throw new ExceptionUpManualNotFound(work.getId());
}
List<WorkLog> workLogs = this.listWorkLog(business, work);
for (WorkLogTree.Node o : upManualNodes) {
WorkLogTree tree = new WorkLogTree(workLogs);
if (emc.countEqualAndEqual(TaskCompleted.class, TaskCompleted.person_FIELDNAME,
effectivePerson.getDistinguishedName(), TaskCompleted.activityToken_FIELDNAME,
o.getWorkLog().getFromActivityToken()) > 0) {
break;
}
WorkLog workLog = workLogs.stream().filter(o -> StringUtils.equals(o.getId(), wi.getWorkLog())).findFirst()
.orElse(null);
throw new ExceptionAccessDenied(effectivePerson);
if (null == workLog) {
throw new ExceptionEntityNotExist(wi.getWorkLog(), WorkLog.class);
}
Wo wo = ThisApplication.context().applications().putQuery(x_processplatform_service_processing.class,
Applications.joinQueryUri("work", work.getId(), "add", "split"), wi).getData(Wo.class);
......@@ -87,11 +69,18 @@ class ActionAddSplit extends BaseAction {
}
}
private List<WorkLog> listWorkLog(Business business, Work work) throws Exception {
return business.entityManagerContainer().listEqual(WorkLog.class, WorkLog.job_FIELDNAME, work.getJob());
}
public static class Wi extends GsonPropertyObject {
@FieldDescribe("添加的拆分值.")
private String splitValue;
@FieldDescribe("拆分日志.")
private String workLog;
public String getSplitValue() {
return splitValue;
}
......@@ -100,6 +89,14 @@ class ActionAddSplit extends BaseAction {
this.splitValue = splitValue;
}
public String getWorkLog() {
return workLog;
}
public void setWorkLog(String workLog) {
this.workLog = workLog;
}
}
public static class Wo extends WoId {
......
package com.x.processplatform.assemble.surface.jaxrs.work;
import com.x.base.core.project.exception.PromptException;
class ExceptionCurrentWorkLogNotFound extends PromptException {
private static final long serialVersionUID = -7038279889683420366L;
ExceptionCurrentWorkLogNotFound(String id) {
super("无法找到工作:{}, 的当前工作日志.", id);
}
}
package com.x.processplatform.assemble.surface.jaxrs.workcompleted;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.exception.ExceptionAccessDenied;
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.WrapOutMap;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.assemble.surface.WorkCompletedControl;
import com.x.processplatform.core.entity.content.Read;
import com.x.processplatform.core.entity.content.ReadCompleted;
import com.x.processplatform.core.entity.content.ReadCompleted_;
import com.x.processplatform.core.entity.content.Read_;
import com.x.processplatform.core.entity.content.Review;
import com.x.processplatform.core.entity.content.Review_;
import com.x.processplatform.core.entity.content.TaskCompleted;
import com.x.processplatform.core.entity.content.TaskCompleted_;
import com.x.processplatform.core.entity.content.WorkCompleted;
import com.x.processplatform.core.entity.element.Application;
import com.x.processplatform.core.entity.element.Process;
/**
*
* 在管理界面下获取相关联的所有信息,需要control权限,同时需要添加一个permission
*/
class ActionManageGetAssignment2 extends BaseAction {
ActionResult<WrapOutMap> execute(EffectivePerson effectivePerson, String id) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<WrapOutMap> result = new ActionResult<>();
WrapOutMap wrap = new WrapOutMap();
Business business = new Business(emc);
WorkCompleted workCompleted = emc.find(id, WorkCompleted.class);
Process process = business.process().pick(workCompleted.getProcess());
Application application = business.application().pick(workCompleted.getApplication());
// 需要对这个应用的管理权限
if (!business.canManageApplicationOrProcess(effectivePerson, application, process)) {
throw new ExceptionAccessDenied(effectivePerson);
}
wrap.put("taskCompletedList", this.listTaskCompleted(business, workCompleted));
wrap.put("readList", this.listRead(business, workCompleted));
wrap.put("readCompletedList", this.listReadCompleted(business, workCompleted));
wrap.put("reviewList", this.listReview(business, workCompleted));
WoControl control = business.getControl(effectivePerson, workCompleted, WoControl.class);
wrap.put("control", control);
result.setData(wrap);
return result;
}
}
private List<WoTaskCompleted> listTaskCompleted(Business business, WorkCompleted workCompleted) throws Exception {
EntityManager em = business.entityManagerContainer().get(TaskCompleted.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<TaskCompleted> cq = cb.createQuery(TaskCompleted.class);
Root<TaskCompleted> root = cq.from(TaskCompleted.class);
Predicate p = cb.equal(root.get(TaskCompleted_.workCompleted), workCompleted.getId());
cq.select(root).where(p);
List<TaskCompleted> os = em.createQuery(cq).getResultList();
List<WoTaskCompleted> wos = WoTaskCompleted.copier.copy(os);
wos = business.taskCompleted().sort(wos);
return wos;
}
private List<WoRead> listRead(Business business, WorkCompleted workCompleted) throws Exception {
EntityManager em = business.entityManagerContainer().get(Read.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Read> cq = cb.createQuery(Read.class);
Root<Read> root = cq.from(Read.class);
Predicate p = cb.equal(root.get(Read_.workCompleted), workCompleted.getId());
cq.select(root).where(p);
List<Read> os = em.createQuery(cq).getResultList();
List<WoRead> wos = WoRead.copier.copy(os);
wos = business.read().sort(wos);
return wos;
}
private List<WoReadCompleted> listReadCompleted(Business business, WorkCompleted workCompleted) throws Exception {
EntityManager em = business.entityManagerContainer().get(ReadCompleted.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<ReadCompleted> cq = cb.createQuery(ReadCompleted.class);
Root<ReadCompleted> root = cq.from(ReadCompleted.class);
Predicate p = cb.equal(root.get(ReadCompleted_.workCompleted), workCompleted.getId());
cq.select(root).where(p);
List<ReadCompleted> os = em.createQuery(cq).getResultList();
List<WoReadCompleted> wos = WoReadCompleted.copier.copy(os);
wos = business.readCompleted().sort(wos);
return wos;
}
List<WoReview> listReview(Business business, WorkCompleted workCompleted) throws Exception {
EntityManager em = business.entityManagerContainer().get(Review.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Review> cq = cb.createQuery(Review.class);
Root<Review> root = cq.from(Review.class);
Predicate p = cb.equal(root.get(Review_.workCompleted), workCompleted.getId());
cq.select(root).where(p);
List<Review> os = em.createQuery(cq).getResultList();
List<WoReview> wos = WoReview.copier.copy(os);
wos = business.review().sort(wos);
return wos;
}
public static class Wo extends GsonPropertyObject {
private List<WoTaskCompleted> taskCompletedList = new ArrayList<>();
private List<WoRead> readList = new ArrayList<>();
private List<WoReadCompleted> readCompletedList = new ArrayList<>();
private List<WoReview> reviewList = new ArrayList<>();
private WoControl control;
public List<WoTaskCompleted> getTaskCompletedList() {
return taskCompletedList;
}
public void setTaskCompletedList(List<WoTaskCompleted> taskCompletedList) {
this.taskCompletedList = taskCompletedList;
}
public List<WoRead> getReadList() {
return readList;
}
public void setReadList(List<WoRead> readList) {
this.readList = readList;
}
public List<WoReadCompleted> getReadCompletedList() {
return readCompletedList;
}
public void setReadCompletedList(List<WoReadCompleted> readCompletedList) {
this.readCompletedList = readCompletedList;
}
public List<WoReview> getReviewList() {
return reviewList;
}
public void setReviewList(List<WoReview> reviewList) {
this.reviewList = reviewList;
}
public WoControl getControl() {
return control;
}
public void setControl(WoControl control) {
this.control = control;
}
}
public static class WoTaskCompleted extends TaskCompleted {
private static final long serialVersionUID = -5707845125641375013L;
static WrapCopier<TaskCompleted, WoTaskCompleted> copier = WrapCopierFactory.wo(TaskCompleted.class,
WoTaskCompleted.class, null, JpaObject.FieldsInvisible);
}
public static class WoRead extends Read {
private static final long serialVersionUID = -5258254759835923175L;
static WrapCopier<Read, WoRead> copier = WrapCopierFactory.wo(Read.class, WoRead.class, null,
JpaObject.FieldsInvisible);
}
public static class WoReadCompleted extends ReadCompleted {
private static final long serialVersionUID = 8123512298634072415L;
static WrapCopier<ReadCompleted, WoReadCompleted> copier = WrapCopierFactory.wo(ReadCompleted.class,
WoReadCompleted.class, null, JpaObject.FieldsInvisible);
}
public static class WoReview extends Review {
private static final long serialVersionUID = -452279135320456110L;
static WrapCopier<Review, WoReview> copier = WrapCopierFactory.wo(Review.class, WoReview.class, null,
JpaObject.FieldsInvisible);
}
public static class WoControl extends WorkCompletedControl {
}
}
\ No newline at end of file
package com.x.processplatform.assemble.surface.jaxrs.worklog;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Stream;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.exception.ExceptionAccessDenied;
import com.x.base.core.project.exception.ExceptionEntityNotExist;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.core.entity.content.TaskCompleted;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.content.WorkLog;
import com.x.processplatform.core.entity.element.ActivityType;
import com.x.processplatform.core.entity.element.util.WorkLogTree;
import com.x.processplatform.core.entity.element.util.WorkLogTree.Node;
class ActionListAddSplitWithWork extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionListAddSplitWithWork.class);
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String workId) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<List<Wo>> result = new ActionResult<>();
Business business = new Business(emc);
if (!business.readableWithWork(effectivePerson, workId, new ExceptionEntityNotExist(workId, Work.class))) {
throw new ExceptionAccessDenied(effectivePerson);
}
Work work = emc.find(workId, Work.class);
List<WorkLog> workLogs = emc.listEqual(WorkLog.class, Work.job_FIELDNAME, work.getJob());
WorkLogTree tree = new WorkLogTree(workLogs);
WorkLogTree.Node current = tree.location(work);
WorkLogTree.Nodes nodes = tree.up(current);
List<Wo> wos = new ArrayList<>();
List<WorkLog> os = new ArrayList<>();
Stream<Node> splitNodes = nodes.stream().filter(o -> {
return Objects.equals(o.getWorkLog().getFromActivityType(), ActivityType.split)
&& StringUtils.startsWith(StringUtils.join(work.getSplitTokenList(), ","),
StringUtils.join(o.getWorkLog().getSplitTokenList(), ","));
});
if (business.canManageApplicationOrProcess(effectivePerson, work.getApplication(), work.getProcess())) {
splitNodes.forEach(o -> {
o.upTo(ActivityType.manual, ActivityType.split, ActivityType.agent, ActivityType.choice,
ActivityType.delay, ActivityType.embed, ActivityType.invoke, ActivityType.message)
.forEach(n -> {
try {
os.add(o.getWorkLog());
} catch (Exception e) {
logger.error(e);
}
});
});
} else {
splitNodes.forEach(o -> {
o.upTo(ActivityType.manual, ActivityType.split, ActivityType.agent, ActivityType.choice,
ActivityType.delay, ActivityType.embed, ActivityType.invoke, ActivityType.message)
.forEach(n -> {
try {
Long count = emc.countEqualAndEqual(TaskCompleted.class,
TaskCompleted.person_FIELDNAME, effectivePerson.getDistinguishedName(),
TaskCompleted.activityToken_FIELDNAME,
n.getWorkLog().getFromActivityToken());
if (count > 0) {
os.add(o.getWorkLog());
}
} catch (Exception e) {
logger.error(e);
}
});
});
}
wos = Wo.copier.copy(os);
result.setData(wos);
return result;
}
}
public static class Wo extends WorkLog {
private static final long serialVersionUID = -7666329770246726197L;
static WrapCopier<WorkLog, Wo> copier = WrapCopierFactory.wo(WorkLog.class, Wo.class, null,
JpaObject.FieldsInvisible);
private List<WoTaskCompleted> taskCompletedList;
public List<WoTaskCompleted> getTaskCompletedList() {
return taskCompletedList;
}
public void setTaskCompletedList(List<WoTaskCompleted> taskCompletedList) {
this.taskCompletedList = taskCompletedList;
}
}
public static class WoTaskCompleted extends TaskCompleted {
private static final long serialVersionUID = 4533878650515451989L;
static WrapCopier<TaskCompleted, WoTaskCompleted> copier = WrapCopierFactory.wo(TaskCompleted.class,
WoTaskCompleted.class, null, JpaObject.FieldsInvisible);
}
}
\ No newline at end of file
......@@ -223,14 +223,14 @@ class ActionListWithWorkOrWorkCompleted extends BaseAction {
public static class WoTaskCompleted extends TaskCompleted {
private static final long serialVersionUID = -4432508672641778924L;
static WrapCopier<TaskCompleted, WoTaskCompleted> copier = WrapCopierFactory.wo(TaskCompleted.class,
WoTaskCompleted.class,
ListTools.toList(TaskCompleted.id_FIELDNAME, TaskCompleted.person_FIELDNAME,
TaskCompleted.unit_FIELDNAME, TaskCompleted.routeName_FIELDNAME,
TaskCompleted.opinion_FIELDNAME, TaskCompleted.startTime_FIELDNAME,
TaskCompleted.activityName_FIELDNAME, TaskCompleted.completedTime_FIELDNAME,
Task.activityToken_FIELDNAME),
TaskCompleted.activityToken_FIELDNAME, TaskCompleted.mediaOpinion_FIELDNAME),
null);
}
......@@ -240,7 +240,7 @@ class ActionListWithWorkOrWorkCompleted extends BaseAction {
static WrapCopier<Read, WoRead> copier = WrapCopierFactory.wo(Read.class, WoRead.class,
ListTools.toList(Read.id_FIELDNAME, Read.person_FIELDNAME, Read.unit_FIELDNAME, Read.opinion_FIELDNAME,
Read.startTime_FIELDNAME, Read.activityName_FIELDNAME, Task.activityToken_FIELDNAME),
Read.startTime_FIELDNAME, Read.activityName_FIELDNAME, Read.activityToken_FIELDNAME),
null);
}
......@@ -253,7 +253,7 @@ class ActionListWithWorkOrWorkCompleted extends BaseAction {
ListTools.toList(ReadCompleted.id_FIELDNAME, ReadCompleted.person_FIELDNAME,
ReadCompleted.unit_FIELDNAME, ReadCompleted.opinion_FIELDNAME,
ReadCompleted.startTime_FIELDNAME, ReadCompleted.activityName_FIELDNAME,
ReadCompleted.completedTime_FIELDNAME, Task.activityToken_FIELDNAME),
ReadCompleted.completedTime_FIELDNAME, ReadCompleted.activityToken_FIELDNAME),
null);
}
......
......@@ -86,4 +86,22 @@ public class WorkLogAction extends StandardJaxrsAction {
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
@JaxrsMethodDescribe(value = "获取工作或完成工作可回滚的工作日志.", action = ActionListAddSplitWithWork.class)
@GET
@Path("list/add/split/work/{workId}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listAddSplitWithWork(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("工作标识") @PathParam("workId") String workId) {
ActionResult<List<ActionListAddSplitWithWork.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionListAddSplitWithWork().execute(effectivePerson, workId);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
}
\ No newline at end of file
......@@ -9,6 +9,8 @@ import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.collections4.map.ListOrderedMap;
import org.apache.commons.lang3.StringUtils;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
......@@ -23,16 +25,33 @@ public class Data extends ListOrderedMap<String, Object> {
private static final long serialVersionUID = 8339934499479910171L;
public void setWork(Work work) throws Exception {
public static void removeWork(JsonElement jsonElement) {
if (null != jsonElement && jsonElement.isJsonObject()) {
}
JsonObject o = jsonElement.getAsJsonObject();
if (o.has(Data.WORK_PROPERTY)) {
o.remove(Data.WORK_PROPERTY);
}
}
public Data setWork(Work work) throws Exception {
DataWork dataWork = new DataWork();
if (null != work) {
DataWork.workCopier.copy(work, dataWork);
}
dataWork.setWorkId(work.getId());
this.put(WORK_PROPERTY, dataWork);
return this;
}
public Data removeWork() {
if (this.containsKey(WORK_PROPERTY)) {
this.remove(WORK_PROPERTY);
}
return this;
}
public void setWork(WorkCompleted workCompleted) throws Exception {
public Data setWork(WorkCompleted workCompleted) throws Exception {
DataWork dataWork = new DataWork();
if (null != workCompleted) {
DataWork.workCompletedCopier.copy(workCompleted, dataWork);
......@@ -41,14 +60,23 @@ public class Data extends ListOrderedMap<String, Object> {
dataWork.setWorkCompletedId(workCompleted.getId());
dataWork.setCompleted(true);
this.put(WORK_PROPERTY, dataWork);
return this;
}
public void setAttachmentList(List<Attachment> attachmentList) throws Exception {
public Data setAttachmentList(List<Attachment> attachmentList) throws Exception {
List<DataAttachment> list = new ArrayList<>();
if (ListTools.isEmpty(attachmentList)) {
DataAttachment.copier.copy(attachmentList, list);
}
this.put(ATTACHMENTLIST_PROPERTY, list);
return this;
}
public Data removeAttachmentList() {
if (this.containsKey(ATTACHMENTLIST_PROPERTY)) {
this.remove(ATTACHMENTLIST_PROPERTY);
}
return this;
}
public List<String> extractDistinguishedName(String path) throws Exception {
......@@ -101,10 +129,10 @@ public class Data extends ListOrderedMap<String, Object> {
public static class DataWork extends GsonPropertyObject {
private static WrapCopier<Work, DataWork> workCopier = WrapCopierFactory.wo(Work.class, DataWork.class, null,
public static WrapCopier<Work, DataWork> workCopier = WrapCopierFactory.wo(Work.class, DataWork.class, null,
JpaObject.FieldsInvisible);
private static WrapCopier<WorkCompleted, DataWork> workCompletedCopier = WrapCopierFactory
public static WrapCopier<WorkCompleted, DataWork> workCompletedCopier = WrapCopierFactory
.wo(WorkCompleted.class, DataWork.class, null, JpaObject.FieldsInvisible);
private String job;
......@@ -312,7 +340,7 @@ public class Data extends ListOrderedMap<String, Object> {
public static class DataAttachment extends GsonPropertyObject {
static WrapCopier<Attachment, DataAttachment> copier = WrapCopierFactory.wo(Attachment.class,
public static WrapCopier<Attachment, DataAttachment> copier = WrapCopierFactory.wo(Attachment.class,
DataAttachment.class, null, JpaObject.FieldsInvisible);
private String name;
......
......@@ -27,7 +27,6 @@ import org.apache.openjpa.persistence.jdbc.ContainerTable;
import org.apache.openjpa.persistence.jdbc.ElementColumn;
import org.apache.openjpa.persistence.jdbc.Index;
import com.x.base.core.entity.AbstractPersistenceProperties;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.entity.SliceJpaObject;
import com.x.base.core.entity.annotation.CheckPersist;
......
......@@ -19,6 +19,7 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.openjpa.persistence.PersistentCollection;
import org.apache.openjpa.persistence.jdbc.ContainerTable;
......@@ -33,6 +34,7 @@ import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.gson.XGsonBuilder;
import com.x.base.core.project.tools.DateTools;
import com.x.base.core.project.tools.ListTools;
import com.x.base.core.project.tools.StringTools;
import com.x.processplatform.core.entity.PersistenceProperties;
import com.x.processplatform.core.entity.element.ActivityType;
......@@ -396,161 +398,6 @@ public class Work extends SliceJpaObject {
@CheckPersist(allowEmpty = true)
private String embedTargetWork;
// public static final String extensionString01_FIELDNAME = "extensionString01";
// @FieldDescribe("扩充文本字段01.")
// @Column(length = length_255B, name = ColumnNamePrefix +
// extensionString01_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + extensionString01_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private String extensionString01;
//
// public static final String extensionString02_FIELDNAME = "extensionString02";
// @FieldDescribe("扩充文本字段02.")
// @Column(length = length_255B, name = ColumnNamePrefix +
// extensionString02_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + extensionString02_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private String extensionString02;
//
// public static final String extensionString03_FIELDNAME = "extensionString03";
// @FieldDescribe("扩充文本字段03.")
// @Column(length = length_255B, name = ColumnNamePrefix +
// extensionString03_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + extensionString03_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private String extensionString03;
//
// public static final String extensionString04_FIELDNAME = "extensionString04";
// @FieldDescribe("扩充文本字段04.")
// @Column(length = length_255B, name = ColumnNamePrefix +
// extensionString04_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + extensionString04_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private String extensionString04;
//
// public static final String extensionString05_FIELDNAME = "extensionString05";
// @FieldDescribe("扩充文本字段05.")
// @Column(length = length_255B, name = ColumnNamePrefix +
// extensionString05_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + extensionString05_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private String extensionString05;
//
// public static final String extensionString06_FIELDNAME = "extensionString06";
// @FieldDescribe("扩充文本字段06.")
// @Column(length = length_255B, name = ColumnNamePrefix +
// extensionString06_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + extensionString06_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private String extensionString06;
//
// public static final String extensionString07_FIELDNAME = "extensionString07";
// @FieldDescribe("扩充文本字段07.")
// @Column(length = length_255B, name = ColumnNamePrefix +
// extensionString07_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + extensionString07_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private String extensionString07;
//
// public static final String extensionString08_FIELDNAME = "extensionString08";
// @FieldDescribe("扩充文本字段08.")
// @Column(length = length_255B, name = ColumnNamePrefix +
// extensionString08_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + extensionString08_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private String extensionString08;
//
// public static final String extensionString09_FIELDNAME = "extensionString09";
// @FieldDescribe("扩充文本字段09.")
// @Column(length = length_255B, name = ColumnNamePrefix +
// extensionString09_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + extensionString09_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private String extensionString09;
//
// public static final String extensionString10_FIELDNAME = "extensionString10";
// @FieldDescribe("扩充文本字段10.")
// @Column(length = length_255B, name = ColumnNamePrefix +
// extensionString10_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + extensionString10_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private String extensionString10;
//
// public static final String extensionDouble01_FIELDNAME = "extensionDouble01";
// @FieldDescribe("扩充数字字段01.")
// @Column(name = ColumnNamePrefix + extensionDouble01_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + extensionDouble01_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private Double extensionDouble01;
//
// public static final String extensionDouble02_FIELDNAME = "extensionDouble02";
// @FieldDescribe("扩充数字字段02.")
// @Column(name = ColumnNamePrefix + extensionDouble02_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + extensionDouble02_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private Double extensionDouble02;
//
// public static final String extensionDouble03_FIELDNAME = "extensionDouble03";
// @FieldDescribe("扩充数字字段03.")
// @Column(name = ColumnNamePrefix + extensionDouble03_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + extensionDouble03_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private Double extensionDouble03;
//
// public static final String extensionDouble04_FIELDNAME = "extensionDouble04";
// @FieldDescribe("扩充数字字段04.")
// @Column(name = ColumnNamePrefix + extensionDouble04_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + extensionDouble04_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private Double extensionDouble04;
//
// public static final String extensionDouble05_FIELDNAME = "extensionDouble05";
// @FieldDescribe("扩充数字字段05.")
// @Column(name = ColumnNamePrefix + extensionDouble05_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + extensionDouble05_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private Double extensionDouble05;
//
// public static final String extensionBoolean01_FIELDNAME =
// "extensionBoolean01";
// @FieldDescribe("扩充布尔字段01.")
// @Column(name = ColumnNamePrefix + extensionBoolean01_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + extensionBoolean01_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private Boolean extensionBoolean01;
//
// public static final String extensionBoolean02_FIELDNAME =
// "extensionBoolean02";
// @FieldDescribe("扩充布尔字段02.")
// @Column(name = ColumnNamePrefix + extensionBoolean02_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + extensionBoolean02_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private Boolean extensionBoolean02;
//
// public static final String extensionBoolean03_FIELDNAME =
// "extensionBoolean03";
// @FieldDescribe("扩充布尔字段03.")
// @Column(name = ColumnNamePrefix + extensionBoolean03_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + extensionBoolean03_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private Boolean extensionBoolean03;
//
// public static final String extensionBoolean04_FIELDNAME =
// "extensionBoolean04";
// @FieldDescribe("扩充布尔字段04.")
// @Column(name = ColumnNamePrefix + extensionBoolean04_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + extensionBoolean04_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private Boolean extensionBoolean04;
//
// public static final String extensionBoolean05_FIELDNAME =
// "extensionBoolean05";
// @FieldDescribe("扩充布尔字段05.")
// @Column(name = ColumnNamePrefix + extensionBoolean05_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + extensionBoolean05_FIELDNAME)
// @CheckPersist(allowEmpty = true)
// private Boolean extensionBoolean05;
public String getTitle() {
return title;
}
......
package com.x.processplatform.core.entity.content;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
......@@ -15,6 +16,7 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.openjpa.persistence.jdbc.Index;
......@@ -25,6 +27,7 @@ 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.ListTools;
import com.x.processplatform.core.entity.PersistenceProperties;
@Entity
......
......@@ -285,6 +285,13 @@ public class WorkLog extends SliceJpaObject {
@CheckPersist(allowEmpty = true)
private String splitValue;
public static final String splitWork_FIELDNAME = "splitWork";
@FieldDescribe("拆分自工作")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + splitWork_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + splitWork_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String splitWork;
/** 不需要索引 */
public static final String splitTokenList_FIELDNAME = "splitTokenList";
@FieldDescribe("拆分工作产生的Token")
......@@ -536,4 +543,12 @@ public class WorkLog extends SliceJpaObject {
this.arrivedActivityAlias = arrivedActivityAlias;
}
public String getSplitWork() {
return splitWork;
}
public void setSplitWork(String splitWork) {
this.splitWork = splitWork;
}
}
\ No newline at end of file
......@@ -155,7 +155,6 @@ public class Processing extends BaseProcessing {
break;
}
/** 在内层的方法中进行提交,这里不需要再次进行提交,在内层提交是因为比如发送待办等要在提交后运行 */
// this.entityManagerContainer.f
return id;
} catch (Exception e) {
throw new Exception("processing arrive failure.", e);
......
......@@ -4,9 +4,9 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils;
import com.google.gson.Gson;
import com.x.base.core.entity.annotation.CheckPersistType;
......@@ -74,68 +74,6 @@ public class WorkContext {
return gson.toJson(this.activity);
}
public String getTaskList() throws Exception {
try {
List<Task> list = new ArrayList<>();
if (null != this.aeiObjects) {
list.addAll(aeiObjects.getTasks());
list.addAll(aeiObjects.getCreateTasks());
}
return gson.toJson(list);
} catch (Exception e) {
throw new Exception("getTaskList error.", e);
}
}
public String getTaskCompletedList() throws Exception {
try {
List<TaskCompleted> list = new ArrayList<>();
if (null != this.aeiObjects) {
list.addAll(aeiObjects.getTaskCompleteds());
list.addAll(aeiObjects.getCreateTaskCompleteds());
}
return gson.toJson(list);
} catch (Exception e) {
throw new Exception("getTaskCompletedList error.", e);
}
}
public String getTaskOrTaskCompleted() {
if (null != task) {
return gson.toJson(task);
}
if (null != taskCompleted) {
return gson.toJson(taskCompleted);
}
return "";
}
public String getReadList() throws Exception {
try {
List<Read> list = new ArrayList<>();
if (null != this.aeiObjects) {
list.addAll(aeiObjects.getReads());
list.addAll(aeiObjects.getCreateReads());
}
return gson.toJson(list);
} catch (Exception e) {
throw new Exception("getReadList error.", e);
}
}
public String getReadCompletedList() throws Exception {
try {
List<ReadCompleted> list = new ArrayList<>();
if (null != this.aeiObjects) {
list.addAll(aeiObjects.getReadCompleteds());
list.addAll(aeiObjects.getCreateReadCompleteds());
}
return gson.toJson(list);
} catch (Exception e) {
throw new Exception("getReadCompletedList error.", e);
}
}
public String getReviewList() throws Exception {
try {
List<Review> list = business.entityManagerContainer().listEqual(Review.class, Review.work_FIELDNAME,
......@@ -249,4 +187,130 @@ public class WorkContext {
}
}
public String getJobTaskList() throws Exception {
try {
List<Task> list = new ArrayList<>();
if (null != this.aeiObjects) {
list.addAll(aeiObjects.getTasks());
list.addAll(aeiObjects.getCreateTasks());
}
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
System.out.println(gson.toJson(list));
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
return gson.toJson(list);
} catch (Exception e) {
throw new Exception("getJobTaskList error.", e);
}
}
public String getJobTaskCompletedList() throws Exception {
try {
List<TaskCompleted> list = new ArrayList<>();
if (null != this.aeiObjects) {
list.addAll(aeiObjects.getTaskCompleteds());
list.addAll(aeiObjects.getCreateTaskCompleteds());
}
return gson.toJson(list);
} catch (Exception e) {
throw new Exception("getJobTaskCompletedList error.", e);
}
}
public String getJobReadList() throws Exception {
try {
List<Read> list = new ArrayList<>();
if (null != this.aeiObjects) {
list.addAll(aeiObjects.getReads());
list.addAll(aeiObjects.getCreateReads());
}
return gson.toJson(list);
} catch (Exception e) {
throw new Exception("getJobReadList error.", e);
}
}
public String getJobReadCompletedList() throws Exception {
try {
List<ReadCompleted> list = new ArrayList<>();
if (null != this.aeiObjects) {
list.addAll(aeiObjects.getReadCompleteds());
list.addAll(aeiObjects.getCreateReadCompleteds());
}
return gson.toJson(list);
} catch (Exception e) {
throw new Exception("getJobReadCompletedList error.", e);
}
}
public String getTaskList() throws Exception {
try {
List<Task> list = new ArrayList<>();
if (null != this.aeiObjects) {
list.addAll(aeiObjects.getTasks());
list.addAll(aeiObjects.getCreateTasks());
}
return gson.toJson(
list.stream().filter(o -> StringUtils.equals(o.getWork(), this.aeiObjects.getWork().getId()))
.collect(Collectors.toList()));
} catch (Exception e) {
throw new Exception("getTaskList error.", e);
}
}
public String getTaskCompletedList() throws Exception {
try {
List<TaskCompleted> list = new ArrayList<>();
if (null != this.aeiObjects) {
list.addAll(aeiObjects.getTaskCompleteds());
list.addAll(aeiObjects.getCreateTaskCompleteds());
}
return gson.toJson(
list.stream().filter(o -> StringUtils.equals(o.getWork(), this.aeiObjects.getWork().getId()))
.collect(Collectors.toList()));
} catch (Exception e) {
throw new Exception("getTaskCompletedList error.", e);
}
}
public String getTaskOrTaskCompleted() {
if (null != task) {
return gson.toJson(task);
}
if (null != taskCompleted) {
return gson.toJson(taskCompleted);
}
return "";
}
public String getReadList() throws Exception {
try {
List<Read> list = new ArrayList<>();
if (null != this.aeiObjects) {
list.addAll(aeiObjects.getReads());
list.addAll(aeiObjects.getCreateReads());
}
return gson.toJson(
list.stream().filter(o -> StringUtils.equals(o.getWork(), this.aeiObjects.getWork().getId()))
.collect(Collectors.toList()));
} catch (Exception e) {
throw new Exception("getReadList error.", e);
}
}
public String getReadCompletedList() throws Exception {
try {
List<ReadCompleted> list = new ArrayList<>();
if (null != this.aeiObjects) {
list.addAll(aeiObjects.getReadCompleteds());
list.addAll(aeiObjects.getCreateReadCompleteds());
}
return gson.toJson(
list.stream().filter(o -> StringUtils.equals(o.getWork(), this.aeiObjects.getWork().getId()))
.collect(Collectors.toList()));
} catch (Exception e) {
throw new Exception("getReadCompletedList error.", e);
}
}
}
package com.x.processplatform.service.processing.jaxrs.work;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import com.google.gson.JsonElement;
......@@ -14,6 +17,8 @@ import com.x.base.core.project.jaxrs.WoId;
import com.x.base.core.project.tools.StringTools;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.content.WorkLog;
import com.x.processplatform.core.entity.element.Activity;
import com.x.processplatform.core.entity.element.util.WorkLogTree;
import com.x.processplatform.service.processing.Business;
import com.x.processplatform.service.processing.Processing;
import com.x.processplatform.service.processing.ProcessingAttributes;
......@@ -23,57 +28,98 @@ class ActionAddSplit extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson, String id, JsonElement jsonElement) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
Business business = new Business(emc);
ActionResult<Wo> result = new ActionResult<>();
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
/* 校验work是否存在 */
Work work = emc.find(id, Work.class);
if (null == work) {
throw new ExceptionEntityNotExist(id, Work.class);
}
if (!work.getSplitting()) {
throw new ExceptionNotSplit(work.getId());
}
if (StringUtils.isEmpty(wi.getSplitValue())) {
throw new ExceptionEmptySplitValue(work.getId());
}
WorkLog arrived = this.getWorkLogArrived(business, work);
List<WorkLog> workLogs = emc.listEqual(WorkLog.class, WorkLog.job_FIELDNAME, work.getJob());
WorkLogTree tree = new WorkLogTree(workLogs);
WorkLog arrived = workLogs.stream().filter(o -> {
return StringUtils.equals(o.getId(), wi.getWorkLog());
}).findFirst().orElse(null);
WorkLog from = tree.children(arrived).stream().findFirst().orElse(null);
if (null == arrived) {
throw new ExceptionInvalidArrivedWorkLog(work.getActivityToken());
throw new ExceptionInvalidArrivedWorkLog(wi.getWorkLog());
}
WorkLog from = this.getWorkLogFrom(business, work);
if (null == from) {
throw new ExceptionInvalidFromWorkLog(work.getActivityToken());
throw new ExceptionInvalidFromWorkLog(wi.getWorkLog());
}
Activity activity = business.element().getActivity(from.getFromActivity());
emc.beginTransaction(Work.class);
emc.beginTransaction(WorkLog.class);
Work workCopy = new Work(work);
workCopy.setActivity(activity.getId());
workCopy.setActivityAlias(activity.getAlias());
workCopy.setActivityArrivedTime(new Date());
workCopy.setActivityDescription(activity.getDescription());
workCopy.setActivityName(activity.getName());
workCopy.setActivityToken(StringTools.uniqueToken());
workCopy.setActivityType(activity.getActivityType());
workCopy.setSplitTokenList(arrived.getSplitTokenList());
workCopy.setSplitToken(arrived.getSplitToken());
workCopy.setSplitting(from.getSplitting());
workCopy.getManualTaskIdentityList().clear();
workCopy.setSplitValue(wi.getSplitValue());
workCopy.getManualTaskIdentityList().clear();
workCopy.setBeforeExecuted(false);
workCopy.setDestinationActivity(null);
workCopy.setDestinationActivityType(null);
workCopy.setDestinationRoute(null);
workCopy.setDestinationRouteName(null);
WorkLog arrivedCopy = new WorkLog(arrived);
arrivedCopy.setArrivedActivity(activity.getId());
arrivedCopy.setArrivedActivityAlias(activity.getAlias());
arrivedCopy.setArrivedActivityName(activity.getName());
arrivedCopy.setArrivedActivityToken(workCopy.getActivityToken());
arrivedCopy.setArrivedActivityType(activity.getActivityType());
arrivedCopy.setWork(workCopy.getId());
arrivedCopy.setArrivedTime(workCopy.getActivityArrivedTime());
arrivedCopy.setSplitValue(workCopy.getSplitValue());
WorkLog fromCopy = new WorkLog(from);
/* 设置work */
arrivedCopy.setWork(workCopy.getId());
fromCopy.setConnected(false);
fromCopy.setFromActivity(activity.getId());
fromCopy.setFromActivityAlias(activity.getAlias());
fromCopy.setFromActivityName(activity.getName());
fromCopy.setFromActivityType(activity.getActivityType());
fromCopy.setFromActivityToken(workCopy.getActivityToken());
fromCopy.setFromTime(workCopy.getActivityArrivedTime());
fromCopy.setWork(workCopy.getId());
arrivedCopy.setSplitValue(workCopy.getSplitValue());
fromCopy.setArrivedActivity("");
fromCopy.setArrivedActivityAlias("");
fromCopy.setArrivedActivityName("");
fromCopy.setArrivedActivityToken("");
fromCopy.setArrivedActivityType(null);
fromCopy.setArrivedTime(null);
workCopy.setSplitValue(wi.getSplitValue());
arrivedCopy.setSplitValue(wi.getSplitValue());
fromCopy.setSplitValue(wi.getSplitValue());
/* 重置到达值 */
String activityToken = StringTools.uniqueToken();
workCopy.setActivityToken(activityToken);
arrivedCopy.setArrivedActivityToken(activityToken);
fromCopy.setFromActivityToken(activityToken);
/* 清空处理人会导致重新计算当前环节处理人 */
workCopy.getManualTaskIdentityList().clear();
emc.persist(workCopy, CheckPersistType.all);
emc.persist(arrivedCopy, CheckPersistType.all);
emc.persist(fromCopy, CheckPersistType.all);
......@@ -87,23 +133,14 @@ class ActionAddSplit extends BaseAction {
}
}
private WorkLog getWorkLogArrived(Business business, Work work) throws Exception {
return business.entityManagerContainer()
.listEqual(WorkLog.class, WorkLog.arrivedActivityToken_FIELDNAME, work.getActivityToken()).stream()
.findFirst().orElse(null);
}
private WorkLog getWorkLogFrom(Business business, Work work) throws Exception {
return business.entityManagerContainer()
.listEqual(WorkLog.class, WorkLog.fromActivityToken_FIELDNAME, work.getActivityToken()).stream()
.findFirst().orElse(null);
}
public static class Wi extends ProcessingAttributes {
@FieldDescribe("增加的拆分值")
private String splitValue;
@FieldDescribe("拆分到的日志")
private String workLog;
public String getSplitValue() {
return splitValue;
}
......@@ -112,6 +149,14 @@ class ActionAddSplit extends BaseAction {
this.splitValue = splitValue;
}
public String getWorkLog() {
return workLog;
}
public void setWorkLog(String workLog) {
this.workLog = workLog;
}
}
public static class Wo extends WoId {
......
......@@ -77,6 +77,8 @@ class ActionAssignCreate extends BaseAction {
work.setCreatorIdentity(identityDn);
work.setCreatorPerson(business.organization().person().getWithIdentity(identityDn));
work.setCreatorUnit(business.organization().unit().getWithIdentity(identityDn));
/* 通过赋值调用的是不能被作为草稿删除的 */
work.setDataChanged(true);
if (ListTools.isNotEmpty(wi.getAttachmentList())) {
emc.beginTransaction(Attachment.class);
/** 这个attachmentList要手动初始化 */
......
......@@ -3,9 +3,11 @@ package com.x.processplatform.service.processing.jaxrs.work;
import java.util.Date;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.annotation.CheckPersistType;
import com.x.base.core.project.gson.XGsonBuilder;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoId;
......@@ -37,11 +39,14 @@ class ActionCreate extends BaseAction {
Begin begin = business.element().getBeginWithProcess(process.getId());
Work work = this.create(application, process, begin);
emc.beginTransaction(Work.class);
emc.persist(work, CheckPersistType.all);
if ((null != jsonElement) && jsonElement.isJsonObject()) {
WorkDataHelper workDataHelper = new WorkDataHelper(emc, work);
workDataHelper.update(jsonElement);
// if (XGsonBuilder.extract(jsonElement, Work.dataChanged_FIELDNAME, Boolean.class, false)) {
// work.setDataChanged(true);
// }
}
emc.persist(work, CheckPersistType.all);
emc.commit();
Wo wo = new Wo();
wo.setId(work.getId());
......
......@@ -5,6 +5,7 @@ import java.util.Comparator;
import java.util.Date;
import java.util.List;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.container.EntityManagerContainer;
......@@ -451,7 +452,8 @@ public class AeiObjects extends GsonPropertyObject {
this.commitReview();
this.commitHint();
this.commitAttachment();
this.getWorkDataHelper().update(this.getData());
// this.getWorkDataHelper().update(this.getData());
this.commitData();
this.entityManagerContainer().commit();
}
......@@ -794,6 +796,13 @@ public class AeiObjects extends GsonPropertyObject {
}
}
private void commitData() throws Exception {
List<Attachment> os = ListUtils.subtract(this.getAttachments(), this.getDeleteAttachments());
os = ListUtils.sum(os, this.getCreateAttachments());
this.getWorkDataHelper()
.update(this.getData().removeWork().removeAttachmentList().setWork(this.work).setAttachmentList(os));
}
public List<Work> getUpdateWorks() {
return updateWorks;
}
......
......@@ -31,18 +31,18 @@ public class TranslateReviewPersonTools {
private static Logger logger = LoggerFactory.getLogger(TranslateReviewPersonTools.class);
/* 计算manual节点中所有的待办,全部翻译成Identity */
/* 计算参阅人,全部翻译成Identity,最终全部转换为person */
public static List<String> translate(AeiObjects aeiObjects) throws Exception {
List<String> identities = new ArrayList<>();
List<String> units = new ArrayList<>();
List<String> groups = new ArrayList<>();
ClassifyDistinguishedName classifyDistinguishedName = null;
/* 指定的身份 */
if (ListTools.isNotEmpty(aeiObjects.getActivity().getReviewIdentityList())) {
identities.addAll(aeiObjects.getActivity().getReviewIdentityList());
}
/* 选择了职务 */
identities.addAll(duty(aeiObjects));
ClassifyDistinguishedName classifyDistinguishedName = null;
/* 指定data数据路径值 */
classifyDistinguishedName = aeiObjects.business().organization().classifyDistinguishedNames(
data(aeiObjects.business(), aeiObjects.getData(), aeiObjects.getActivity()));
......@@ -63,12 +63,12 @@ public class TranslateReviewPersonTools {
groups.addAll(aeiObjects.getActivity().getReviewGroupList());
}
identities.addAll(aeiObjects.business().organization().identity().listWithGroup(groups));
identities.addAll(aeiObjects.business().organization().identity().listWithUnitSubDirect(units));
identities.addAll(aeiObjects.business().organization().identity().listWithUnitSubNested(units));
identities = ListTools.trim(identities, true, true);
logger.debug("work title:{}, id:{}, activity name:{}, id:{}, translate review identity: {}",
aeiObjects.getWork().getTitle(), aeiObjects.getWork().getId(), aeiObjects.getActivity().getName(),
aeiObjects.getActivity().getId(), XGsonBuilder.toJson(identities));
List<String> os = aeiObjects.business().organization().identity().list(identities);
List<String> os = aeiObjects.business().organization().person().listWithIdentity(identities);
if (os.size() != identities.size()) {
logger.warn(
"work title:{}, id:{}, activity name:{}, id:{}, translate review identity: {}, result not with same length: {}.",
......@@ -120,15 +120,6 @@ public class TranslateReviewPersonTools {
return list;
}
/* 取得指定部门的identity */
private static List<String> unit(Business business, Activity activity) throws Exception {
List<String> list = new ArrayList<>();
if (ListTools.isNotEmpty(activity.getReviewUnitList())) {
list.addAll(business.organization().identity().listWithUnitSubDirect(activity.getReviewUnitList()));
}
return list;
}
private static List<String> data(Business business, Data data, Activity activity) throws Exception {
List<String> list = new ArrayList<>();
if (ListTools.isNotEmpty(activity.getReviewDataPathList())) {
......@@ -141,21 +132,4 @@ public class TranslateReviewPersonTools {
return list;
}
private static List<String> identity(Activity activity) throws Exception {
List<String> list = new ArrayList<>();
if (ListTools.isNotEmpty(activity.getReviewIdentityList())) {
list.addAll(activity.getReviewIdentityList());
}
return list;
}
/** 指定的身份 */
private static List<String> group(Business business, Activity activity) throws Exception {
List<String> list = new ArrayList<>();
if (ListTools.isNotEmpty(activity.getReviewGroupList())) {
list.addAll(business.organization().identity().listWithGroup(activity.getReviewGroupList()));
}
return list;
}
}
......@@ -6,7 +6,6 @@ import java.util.List;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.ListTools;
......@@ -56,7 +55,7 @@ public class SplitProcessor extends AbstractSplitProcessor {
.filter(o -> StringUtils.equals(aeiObjects.getWork().getActivityToken(), o.getFromActivityToken()))
.findFirst().orElse(null);
mainWorkLog.setSplitting(true);
mainWorkLog.setSplitToken(StringTools.uniqueToken());
mainWorkLog.setSplitToken(aeiObjects.getWork().getSplitToken());
mainWorkLog.getSplitTokenList().add(aeiObjects.getWork().getSplitToken());
mainWorkLog.setSplitValue(splitValues.get(0));
aeiObjects.getUpdateWorkLogs().add(mainWorkLog);
......@@ -64,14 +63,11 @@ public class SplitProcessor extends AbstractSplitProcessor {
for (int i = 1; i < splitValues.size(); i++) {
Work splitWork = new Work(aeiObjects.getWork());
/* 将文档存放在一起 */
// aeiObjects.getWork().copyTo(splitWork, JpaObject.id_FIELDNAME);
splitWork.setSplitValue(splitValues.get(i));
aeiObjects.getCreateWorks().add(splitWork);
WorkLog splitWorkLog = new WorkLog(mainWorkLog);
splitWorkLog.setSplitWork(aeiObjects.getWork().getId());
splitWorkLog.setWork(splitWork.getId());
//splitWork.setActivityToken(StringTools.uniqueToken());
// mainWorkLog.copyTo(splitWorkLog, JpaObject.id_FIELDNAME);
// splitWorkLog.setFromActivityToken(activityToken);
splitWorkLog.setSplitValue(splitValues.get(i));
aeiObjects.getCreateWorkLogs().add(splitWorkLog);
results.add(splitWork);
......
package com.x.processplatform.core.processing.test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.x.base.core.project.gson.XGsonBuilder;
public class TestClient {
@Test
public void test() throws Exception {
......@@ -28,5 +34,18 @@ public class TestClient {
b.add("44");
System.out.println(ListUtils.sum(a,b));
}
@Test
public void test2() throws Exception {
Map<String,String> a = new HashMap<>();
a.put("aaaa", "a1");
a.put("bbbb", "b1");
a.put("cccc", "c1");
JsonElement je = XGsonBuilder.instance().toJsonTree(a);
JsonObject jo = je.getAsJsonObject();
jo.addProperty("bbbb", "xxxxx");
jo.addProperty("ddddd", "xxxxx");
System.out.println(jo);
}
}
package com.x.program.center.jaxrs.config;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.config.Config;
import com.x.base.core.project.config.Dingding;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
class ActionGetDingding extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wo wo = Wo.copier.copy(Config.dingding());
result.setData(wo);
return result;
}
public static class Wo extends Dingding {
static WrapCopier<Dingding, Wo> copier = WrapCopierFactory.wo(Dingding.class, Wo.class, null, null);
}
}
\ No newline at end of file
package com.x.program.center.jaxrs.config;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.config.Config;
import com.x.base.core.project.config.Qiyeweixin;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
class ActionGetQiyeweixin extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wo wo = Wo.copier.copy(Config.qiyeweixin());
result.setData(wo);
return result;
}
public static class Wo extends Qiyeweixin {
static WrapCopier<Qiyeweixin, Wo> copier = WrapCopierFactory.wo(Qiyeweixin.class, Wo.class, null, null);
}
}
\ No newline at end of file
......@@ -3,6 +3,8 @@ package com.x.program.center.jaxrs.config;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.config.Config;
import com.x.base.core.project.config.Dingding;
import com.x.base.core.project.config.Qiyeweixin;
import com.x.base.core.project.config.Token;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
......@@ -12,6 +14,8 @@ class ActionGetToken extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wo wo = Wo.copier.copy(Config.token());
wo.setDingding(WoDingding.copier.copy(Config.dingding()));
wo.setQiyeweixin(WoQiyeweixin.copier.copy(Config.qiyeweixin()));
result.setData(wo);
return result;
}
......@@ -20,5 +24,39 @@ class ActionGetToken extends BaseAction {
static WrapCopier<Token, Wo> copier = WrapCopierFactory.wo(Token.class, Wo.class, null, null);
private WoDingding dingding;
private WoQiyeweixin qiyeweixin;
public WoDingding getDingding() {
return dingding;
}
public void setDingding(WoDingding dingding) {
this.dingding = dingding;
}
public WoQiyeweixin getQiyeweixin() {
return qiyeweixin;
}
public void setQiyeweixin(WoQiyeweixin qiyeweixin) {
this.qiyeweixin = qiyeweixin;
}
}
public static class WoDingding extends Dingding {
static WrapCopier<Dingding, WoDingding> copier = WrapCopierFactory.wo(Dingding.class, WoDingding.class, null,
null);
}
public static class WoQiyeweixin extends Qiyeweixin {
static WrapCopier<Qiyeweixin, WoQiyeweixin> copier = WrapCopierFactory.wo(Qiyeweixin.class, WoQiyeweixin.class,
null, null);
}
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import com.google.gson.JsonElement;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.config.CenterServer;
import com.x.base.core.project.config.Config;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WrapBoolean;
......@@ -13,7 +14,8 @@ public class ActionSetCenterServer extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
wi.save();
Wi.copier.copy(wi, Config.centerServer());
Config.centerServer().save();
this.configFlush(effectivePerson);
Wo wo = new Wo();
wo.setValue(true);
......
......@@ -14,7 +14,8 @@ public class ActionSetCollect extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
wi.save();
Wi.copier.copy(wi, Config.collect());
Config.collect().save();
this.configFlush(effectivePerson);
Wo wo = new Wo();
wo.setValue(true);
......
package com.x.program.center.jaxrs.config;
import java.io.StringReader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Map.Entry;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.h2.tools.RunScript;
import com.google.gson.JsonElement;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.config.Config;
import com.x.base.core.project.config.DataServer;
import com.x.base.core.project.config.Dingding;
import com.x.base.core.project.config.Token;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WrapBoolean;
import com.x.program.center.jaxrs.config.ActionGetCollect.Wo;
import com.x.program.center.jaxrs.config.ActionSetCollect.Wi;
public class ActionSetDingding extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
wi.save();
this.configFlush(effectivePerson);
Wo wo = new Wo();
wo.setValue(true);
result.setData(wo);
return result;
}
public static class Wi extends Dingding {
static WrapCopier<Wi, Dingding> copier = WrapCopierFactory.wi(Wi.class, Dingding.class, null, null);
}
public static class Wo extends WrapBoolean {
}
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package com.x.program.center.jaxrs.config;
import com.google.gson.JsonElement;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.config.Config;
import com.x.base.core.project.config.Person;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
......@@ -13,7 +14,8 @@ public class ActionSetPerson extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
wi.save();
Wi.copier.copy(wi, Config.person());
Config.person().save();
this.configFlush(effectivePerson);
Wo wo = new Wo();
wo.setValue(true);
......
package com.x.program.center.jaxrs.config;
import com.google.gson.JsonElement;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.config.Qiyeweixin;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WrapBoolean;
public class ActionSetQiyeweixin extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
wi.save();
this.configFlush(effectivePerson);
Wo wo = new Wo();
wo.setValue(true);
result.setData(wo);
return result;
}
public static class Wi extends Qiyeweixin {
static WrapCopier<Wi, Qiyeweixin> copier = WrapCopierFactory.wi(Wi.class, Qiyeweixin.class, null, null);
}
public static class Wo extends WrapBoolean {
}
}
\ No newline at end of file
......@@ -14,6 +14,8 @@ import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.config.Config;
import com.x.base.core.project.config.DataServer;
import com.x.base.core.project.config.Dingding;
import com.x.base.core.project.config.Qiyeweixin;
import com.x.base.core.project.config.Token;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
......@@ -28,7 +30,16 @@ public class ActionSetToken extends BaseAction {
if (!StringUtils.equals(wi.getPassword(), Config.token().getPassword())) {
this.changeInternalDataServerPassword(Config.token().getPassword(), wi.getPassword());
}
wi.save();
Wi.copier.copy(wi, Config.token());
Config.token().save();
if (null != wi.getDingding()) {
WiDingding.copier.copy(wi.getDingding(), Config.dingding());
Config.dingding().save();
}
if (null != wi.getQiyeweixin()) {
WiQiyeweixin.copier.copy(wi.getQiyeweixin(), Config.qiyeweixin());
Config.qiyeweixin().save();
}
this.configFlush(effectivePerson);
Wo wo = new Wo();
wo.setValue(true);
......@@ -56,6 +67,40 @@ public class ActionSetToken extends BaseAction {
static WrapCopier<Wi, Token> copier = WrapCopierFactory.wi(Wi.class, Token.class, null, null);
private WiDingding dingding;
private WiQiyeweixin qiyeweixin;
public WiDingding getDingding() {
return dingding;
}
public void setDingding(WiDingding dingding) {
this.dingding = dingding;
}
public WiQiyeweixin getQiyeweixin() {
return qiyeweixin;
}
public void setQiyeweixin(WiQiyeweixin qiyeweixin) {
this.qiyeweixin = qiyeweixin;
}
}
public static class WiDingding extends Dingding {
static WrapCopier<WiDingding, Dingding> copier = WrapCopierFactory.wi(WiDingding.class, Dingding.class, null,
null);
}
public static class WiQiyeweixin extends Qiyeweixin {
static WrapCopier<WiQiyeweixin, Qiyeweixin> copier = WrapCopierFactory.wi(WiQiyeweixin.class, Qiyeweixin.class,
null, null);
}
public static class Wo extends WrapBoolean {
......
......@@ -219,73 +219,4 @@ public class ConfigAction extends StandardJaxrsAction {
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
@JaxrsMethodDescribe(value = "获取钉钉配置.", action = ActionGetDingding.class)
@GET
@Path("dingding")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void getDingding(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
ActionResult<ActionGetDingding.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionGetDingding().execute(effectivePerson);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
@JaxrsMethodDescribe(value = "更新钉钉配置.", action = ActionSetDingding.class)
@PUT
@Path("dingding")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void setDingding(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
JsonElement jsonElement) {
ActionResult<ActionSetDingding.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionSetDingding().execute(effectivePerson, jsonElement);
} catch (Exception e) {
logger.error(e, effectivePerson, request, jsonElement);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
@JaxrsMethodDescribe(value = "获取企业微信配置.", action = ActionGetQiyeweixin.class)
@GET
@Path("qiyeweixin")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void getQiyeweixin(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
ActionResult<ActionGetQiyeweixin.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionGetQiyeweixin().execute(effectivePerson);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
@JaxrsMethodDescribe(value = "更新企业微信配置.", action = ActionSetQiyeweixin.class)
@PUT
@Path("qiyeweixin")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void setQiyeweixin(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
JsonElement jsonElement) {
ActionResult<ActionSetQiyeweixin.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionSetQiyeweixin().execute(effectivePerson, jsonElement);
} catch (Exception e) {
logger.error(e, effectivePerson, request, jsonElement);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
}
\ No newline at end of file
......@@ -13,6 +13,8 @@ import com.x.organization.core.express.Organization;
import com.x.query.assemble.designer.factory.QueryFactory;
import com.x.query.assemble.designer.factory.RevealFactory;
import com.x.query.assemble.designer.factory.StatFactory;
import com.x.query.assemble.designer.factory.StatementFactory;
import com.x.query.assemble.designer.factory.TableFactory;
import com.x.query.assemble.designer.factory.ViewFactory;
import com.x.query.core.entity.Query;
import com.x.query.core.entity.schema.Statement;
......@@ -57,6 +59,24 @@ public class Business {
return view;
}
private TableFactory table;
public TableFactory table() throws Exception {
if (null == this.table) {
this.table = new TableFactory(this);
}
return table;
}
private StatementFactory statement;
public StatementFactory statement() throws Exception {
if (null == this.statement) {
this.statement = new StatementFactory(this);
}
return statement;
}
private StatFactory stat;
public StatFactory stat() throws Exception {
......
package com.x.query.assemble.designer.factory;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import com.x.base.core.project.tools.StringTools;
import com.x.query.assemble.designer.AbstractFactory;
import com.x.query.assemble.designer.Business;
import com.x.query.core.entity.schema.Statement;
public class StatementFactory extends AbstractFactory {
public StatementFactory(Business business) throws Exception {
super(business);
}
public <T extends Statement> List<T> sort(List<T> list) {
if (null == list) {
return null;
}
list = list.stream()
.sorted(Comparator.comparing(Statement::getAlias, StringTools.emptyLastComparator())
.thenComparing(Comparator.comparing(Statement::getName, StringTools.emptyLastComparator())))
.collect(Collectors.toList());
return list;
}
}
\ No newline at end of file
package com.x.query.assemble.designer.factory;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import com.x.base.core.project.tools.StringTools;
import com.x.query.assemble.designer.AbstractFactory;
import com.x.query.assemble.designer.Business;
import com.x.query.core.entity.schema.Table;
public class TableFactory extends AbstractFactory {
public TableFactory(Business business) throws Exception {
super(business);
}
public <T extends Table> List<T> sort(List<T> list) {
if (null == list) {
return null;
}
list = list.stream()
.sorted(Comparator.comparing(Table::getAlias, StringTools.emptyLastComparator())
.thenComparing(Comparator.comparing(Table::getName, StringTools.emptyLastComparator())))
.collect(Collectors.toList());
return list;
}
}
\ No newline at end of file
package com.x.query.assemble.designer.jaxrs.statement;
import java.util.List;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.exception.ExceptionAccessDenied;
import com.x.base.core.project.exception.ExceptionEntityNotExist;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.query.assemble.designer.Business;
import com.x.query.core.entity.Query;
import com.x.query.core.entity.schema.Statement;
import com.x.query.core.entity.schema.Table;
class ActionListWithQuery extends BaseAction {
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String flag) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<List<Wo>> result = new ActionResult<>();
Business business = new Business(emc);
Query query = emc.flag(flag, Query.class);
if (null == query) {
throw new ExceptionEntityNotExist(flag);
}
if (!business.editable(effectivePerson, query)) {
throw new ExceptionAccessDenied(effectivePerson.getDistinguishedName());
}
List<Wo> wos = emc.fetchEqual(Statement.class, Wo.copier, Statement.query_FIELDNAME, query.getId());
wos = business.statement().sort(wos);
result.setData(wos);
return result;
}
}
public static class Wo extends Statement {
private static final long serialVersionUID = -5755898083219447939L;
static WrapCopier<Statement, Wo> copier = WrapCopierFactory.wo(Statement.class, Wo.class,
JpaObject.singularAttributeField(Statement.class, true, true), JpaObject.FieldsInvisible);
}
}
......@@ -34,6 +34,24 @@ public class StatementAction extends StandardJaxrsAction {
private static Logger logger = LoggerFactory.getLogger(StatementAction.class);
@JaxrsMethodDescribe(value = "根据query列示statement对象.", action = ActionListWithQuery.class)
@GET
@Path("list/query/{flag}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listWithQuery(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("查询标识") @PathParam("flag") String flag) {
ActionResult<List<ActionListWithQuery.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionListWithQuery().execute(effectivePerson, flag);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
@JaxrsMethodDescribe(value = "根据标识获取语句.", action = ActionGet.class)
@GET
@Path("{flag}")
......
......@@ -53,7 +53,7 @@ class ActionBuildAll extends BaseAction {
File target = Config.dir_local_temp_dynamic_target(true);
FileUtils.cleanDirectory(src);
FileUtils.cleanDirectory(target);
List<Table> tables = emc.listAll(Table.class);
List<Table> tables = emc.listEqual(Table.class, Table.status_FIELDNAME, Table.STATUS_build);
for (Table table : tables) {
DynamicEntity dynamicEntity = XGsonBuilder.instance().fromJson(table.getData(), DynamicEntity.class);
dynamicEntity.setName(table.getName());
......
......@@ -46,6 +46,7 @@ class ActionCreate extends BaseAction {
table.setCreatorPerson(effectivePerson.getDistinguishedName());
table.setLastUpdatePerson(effectivePerson.getDistinguishedName());
table.setLastUpdateTime(new Date());
table.setStatus(Table.STATUS_draft);
emc.persist(table, CheckPersistType.all);
emc.commit();
ApplicationCache.notify(Table.class);
......@@ -66,7 +67,8 @@ class ActionCreate extends BaseAction {
static WrapCopier<Wi, Table> copier = WrapCopierFactory.wi(Wi.class, Table.class, null,
ListTools.toList(JpaObject.FieldsUnmodify, Table.creatorPerson_FIELDNAME,
Table.lastUpdatePerson_FIELDNAME, Table.lastUpdateTime_FIELDNAME));
Table.lastUpdatePerson_FIELDNAME, Table.lastUpdateTime_FIELDNAME, Table.data_FIELDNAME,
Table.status_FIELDNAME));
}
}
\ No newline at end of file
......@@ -50,6 +50,7 @@ class ActionEdit extends BaseAction {
XGsonBuilder.instance().fromJson(table.getData(), DynamicEntity.class);
table.setLastUpdatePerson(effectivePerson.getDistinguishedName());
table.setLastUpdateTime(new Date());
table.setStatus(Table.STATUS_draft);
emc.check(table, CheckPersistType.all);
emc.commit();
ApplicationCache.notify(Table.class);
......@@ -71,6 +72,7 @@ class ActionEdit extends BaseAction {
static WrapCopier<Wi, Table> copier = WrapCopierFactory.wi(Wi.class, Table.class, null,
ListTools.toList(JpaObject.FieldsUnmodify, Table.creatorPerson_FIELDNAME,
Table.lastUpdatePerson_FIELDNAME, Table.lastUpdateTime_FIELDNAME));
Table.lastUpdatePerson_FIELDNAME, Table.lastUpdateTime_FIELDNAME, Table.data_FIELDNAME,
Table.status_FIELDNAME));
}
}
\ No newline at end of file
package com.x.query.assemble.designer.jaxrs.table;
import java.util.List;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.exception.ExceptionAccessDenied;
import com.x.base.core.project.exception.ExceptionEntityNotExist;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.query.assemble.designer.Business;
import com.x.query.core.entity.Query;
import com.x.query.core.entity.schema.Table;
class ActionListWithQuery extends BaseAction {
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String flag) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<List<Wo>> result = new ActionResult<>();
Business business = new Business(emc);
Query query = emc.flag(flag, Query.class);
if (null == query) {
throw new ExceptionEntityNotExist(flag);
}
if (!business.editable(effectivePerson, query)) {
throw new ExceptionAccessDenied(effectivePerson.getDistinguishedName());
}
List<Wo> wos = emc.fetchEqual(Table.class, Wo.copier, Table.query_FIELDNAME, query.getId());
wos = business.table().sort(wos);
result.setData(wos);
return result;
}
}
public static class Wo extends Table {
private static final long serialVersionUID = -5755898083219447939L;
static WrapCopier<Table, Wo> copier = WrapCopierFactory.wo(Table.class, Wo.class,
JpaObject.singularAttributeField(Table.class, true, true), JpaObject.FieldsInvisible);
}
}
package com.x.query.assemble.designer.jaxrs.table;
import com.alibaba.druid.util.StringUtils;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.exception.ExceptionAccessDenied;
import com.x.base.core.project.exception.ExceptionEntityNotExist;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoId;
import com.x.query.assemble.designer.Business;
import com.x.query.core.entity.schema.Statement;
import com.x.query.core.entity.schema.Table;
class ActionStatusBuild extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson, String flag) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
Table table = emc.flag(flag, Table.class);
if (null == table) {
throw new ExceptionEntityNotExist(flag, Table.class);
}
Business business = new Business(emc);
if (!business.editable(effectivePerson, table)) {
throw new ExceptionAccessDenied(effectivePerson, table);
}
if (StringUtils.isEmpty(table.getDraftData())) {
throw new ExceptionEmptyDraftData(flag);
}
emc.beginTransaction(Table.class);
table.setData(table.getDraftData());
table.setStatus(Table.STATUS_build);
emc.commit();
ApplicationCache.notify(Table.class);
ApplicationCache.notify(Statement.class);
Wo wo = new Wo();
wo.setId(table.getId());
result.setData(wo);
return result;
}
}
public static class Wo extends WoId {
}
}
\ No newline at end of file
package com.x.query.assemble.designer.jaxrs.table;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.exception.ExceptionAccessDenied;
import com.x.base.core.project.exception.ExceptionEntityNotExist;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoId;
import com.x.query.assemble.designer.Business;
import com.x.query.core.entity.schema.Statement;
import com.x.query.core.entity.schema.Table;
class ActionStatusDraft extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson, String flag) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
Table table = emc.flag(flag, Table.class);
if (null == table) {
throw new ExceptionEntityNotExist(flag, Table.class);
}
Business business = new Business(emc);
if (!business.editable(effectivePerson, table)) {
throw new ExceptionAccessDenied(effectivePerson, table);
}
emc.beginTransaction(Table.class);
table.setStatus(Table.STATUS_draft);
emc.commit();
ApplicationCache.notify(Table.class);
ApplicationCache.notify(Statement.class);
Wo wo = new Wo();
wo.setId(table.getId());
result.setData(wo);
return result;
}
}
public static class Wo extends WoId {
}
}
\ No newline at end of file
package com.x.query.assemble.designer.jaxrs.table;
import com.x.base.core.project.exception.PromptException;
class ExceptionEmptyDraftData extends PromptException {
private static final long serialVersionUID = -9089355008820123519L;
ExceptionEmptyDraftData(String flag) {
super("表: {}, 的设计结构为空.", flag);
}
}
......@@ -35,6 +35,24 @@ public class TableAction extends StandardJaxrsAction {
private static Logger logger = LoggerFactory.getLogger(TableAction.class);
@JaxrsMethodDescribe(value = "根据query列示table对象.", action = ActionListWithQuery.class)
@GET
@Path("list/query/{flag}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listWithQuery(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("查询标识") @PathParam("flag") String flag) {
ActionResult<List<ActionListWithQuery.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionListWithQuery().execute(effectivePerson, flag);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
@JaxrsMethodDescribe(value = "编译表对象生成实体类进行数据库建表,执行后需要重新启动.", action = ActionBuildAll.class)
@GET
@Path("build/all")
......@@ -70,6 +88,42 @@ public class TableAction extends StandardJaxrsAction {
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
@JaxrsMethodDescribe(value = "标识表状态为草稿.", action = ActionStatusDraft.class)
@GET
@Path("{flag}/status/draft")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void statusDraft(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("标识") @PathParam("flag") String flag) {
ActionResult<ActionStatusDraft.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionStatusDraft().execute(effectivePerson, flag);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
@JaxrsMethodDescribe(value = "标识表状态为编译.", action = ActionStatusBuild.class)
@GET
@Path("{flag}/status/build")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void statusBuild(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("标识") @PathParam("flag") String flag) {
ActionResult<ActionStatusBuild.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionStatusBuild().execute(effectivePerson, flag);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
@JaxrsMethodDescribe(value = "列示表对象,下一页.", action = ActionListNext.class)
@GET
@Path("list/{id}/next/{count}")
......
......@@ -7,6 +7,8 @@ import com.x.base.core.project.exception.ExceptionAccessDenied;
import com.x.base.core.project.exception.ExceptionEntityNotExist;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.query.assemble.surface.Business;
import com.x.query.core.entity.Query;
import com.x.query.core.entity.View;
......@@ -15,8 +17,12 @@ import com.x.query.core.express.plan.Runtime;
class ActionExecute extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionExecute.class);
ActionResult<Plan> execute(EffectivePerson effectivePerson, String id, JsonElement jsonElement) throws Exception {
logger.debug("jsonElement:{}.", jsonElement);
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Plan> result = new ActionResult<>();
Business business = new Business(emc);
View view = business.pick(id, View.class);
......
......@@ -96,7 +96,8 @@ public class Stat extends SliceJpaObject {
public static final String query_FIELDNAME = "query";
@FieldDescribe("所属查询.")
@Column(length = length_id, name = ColumnNamePrefix + query_FIELDNAME)
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + query_FIELDNAME)
@Index(name = TABLE + ColumnNamePrefix + query_FIELDNAME)
@CheckPersist(allowEmpty = false, citationExists = { @CitationExist(type = Query.class) })
private String query;
......@@ -120,7 +121,7 @@ public class Stat extends SliceJpaObject {
@ContainerTable(name = TABLE + ContainerTableNameMiddle
+ availableIdentityList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle
+ availableIdentityList_FIELDNAME + JoinIndexNameSuffix))
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ElementColumn(length = length_255B, name = ColumnNamePrefix + availableIdentityList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + availableIdentityList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true)
......@@ -132,7 +133,7 @@ public class Stat extends SliceJpaObject {
@ContainerTable(name = TABLE + ContainerTableNameMiddle
+ availableUnitList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle
+ availableUnitList_FIELDNAME + JoinIndexNameSuffix))
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ElementColumn(length = length_255B, name = ColumnNamePrefix + availableUnitList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + availableUnitList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true)
......
......@@ -105,7 +105,7 @@ public class View extends SliceJpaObject {
public static final String query_FIELDNAME = "query";
@FieldDescribe("所属查询.")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + query_FIELDNAME)
@Index(name = TABLE + "_query")
@Index(name = TABLE + ColumnNamePrefix + query_FIELDNAME)
@CheckPersist(allowEmpty = false, citationExists = { @CitationExist(type = Query.class) })
private String query;
......
......@@ -29,6 +29,7 @@ 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.query.core.entity.PersistenceProperties;
import com.x.query.core.entity.Query;
@Entity
@ContainerEntity
......@@ -91,6 +92,13 @@ public class Statement extends SliceJpaObject {
@CheckPersist(allowEmpty = true)
private String description;
public static final String query_FIELDNAME = "query";
@FieldDescribe("所属查询.")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + query_FIELDNAME)
@Index(name = TABLE + ColumnNamePrefix + query_FIELDNAME)
@CheckPersist(allowEmpty = false, citationExists = { @CitationExist(type = Query.class) })
private String query;
public static final String type_FIELDNAME = "type";
@FieldDescribe("语句类型,insert,delete,update,select")
@Column(length = length_16B, name = ColumnNamePrefix + type_FIELDNAME)
......@@ -274,4 +282,12 @@ public class Statement extends SliceJpaObject {
this.type = type;
}
public String getQuery() {
return query;
}
public void setQuery(String query) {
this.query = query;
}
}
\ No newline at end of file
......@@ -12,8 +12,6 @@ import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Lob;
import javax.persistence.OrderColumn;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.commons.lang3.StringUtils;
......@@ -23,16 +21,17 @@ import org.apache.openjpa.persistence.jdbc.ElementColumn;
import org.apache.openjpa.persistence.jdbc.ElementIndex;
import org.apache.openjpa.persistence.jdbc.Index;
import com.x.base.core.entity.AbstractPersistenceProperties;
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.CheckRemove;
import com.x.base.core.entity.annotation.CitationExist;
import com.x.base.core.entity.annotation.CitationNotExist;
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.query.core.entity.PersistenceProperties;
import com.x.query.core.entity.Query;
@Entity
@ContainerEntity
......@@ -47,6 +46,10 @@ public class Table extends SliceJpaObject {
private static final String TABLE = PersistenceProperties.Schema.Table.table;
public static final String STATUS_build = "build";
public static final String STATUS_draft = "draft";
public String getId() {
return id;
}
......@@ -96,12 +99,19 @@ public class Table extends SliceJpaObject {
@CheckPersist(allowEmpty = true)
private String description;
public static final String query_FIELDNAME = "query";
@FieldDescribe("所属查询.")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + query_FIELDNAME)
@Index(name = TABLE + ColumnNamePrefix + query_FIELDNAME)
@CheckPersist(allowEmpty = false, citationExists = { @CitationExist(type = Query.class) })
private String query;
public static final String readPersonList_FIELDNAME = "readPersonList";
@FieldDescribe("可以访问数据的用户.")
@PersistentCollection(fetch = FetchType.EAGER)
@ContainerTable(name = TABLE + ContainerTableNameMiddle + readPersonList_FIELDNAME, joinIndex = @Index(name = TABLE
+ IndexNameMiddle + readPersonList_FIELDNAME + JoinIndexNameSuffix))
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ElementColumn(length = length_255B, name = ColumnNamePrefix + readPersonList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + readPersonList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true)
......@@ -112,7 +122,7 @@ public class Table extends SliceJpaObject {
@PersistentCollection(fetch = FetchType.EAGER)
@ContainerTable(name = TABLE + ContainerTableNameMiddle + readUnitList_FIELDNAME, joinIndex = @Index(name = TABLE
+ IndexNameMiddle + readUnitList_FIELDNAME + JoinIndexNameSuffix))
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ElementColumn(length = length_255B, name = ColumnNamePrefix + readUnitList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + readUnitList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true)
......@@ -123,7 +133,7 @@ public class Table extends SliceJpaObject {
@PersistentCollection(fetch = FetchType.EAGER)
@ContainerTable(name = TABLE + ContainerTableNameMiddle + editPersonList_FIELDNAME, joinIndex = @Index(name = TABLE
+ IndexNameMiddle + editPersonList_FIELDNAME + JoinIndexNameSuffix))
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ElementColumn(length = length_255B, name = ColumnNamePrefix + editPersonList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + editPersonList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true)
......@@ -134,7 +144,7 @@ public class Table extends SliceJpaObject {
@PersistentCollection(fetch = FetchType.EAGER)
@ContainerTable(name = TABLE + ContainerTableNameMiddle + editUnitList_FIELDNAME, joinIndex = @Index(name = TABLE
+ IndexNameMiddle + editUnitList_FIELDNAME + JoinIndexNameSuffix))
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ElementColumn(length = length_255B, name = ColumnNamePrefix + editUnitList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + editUnitList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true)
......@@ -166,6 +176,20 @@ public class Table extends SliceJpaObject {
@CheckPersist(allowEmpty = true)
private String data;
public static final String draftData_FIELDNAME = "draftData";
@FieldDescribe("草稿表结构方案.")
@Lob
@Basic(fetch = FetchType.EAGER)
@Column(length = JpaObject.length_10M, name = ColumnNamePrefix + draftData_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String draftData;
public static final String status_FIELDNAME = "status";
@FieldDescribe("状态")
@CheckPersist(allowEmpty = false)
@Column(length = length_32B, name = ColumnNamePrefix + status_FIELDNAME)
private String status;
public String getName() {
return name;
}
......@@ -254,4 +278,28 @@ public class Table extends SliceJpaObject {
this.alias = alias;
}
public String getQuery() {
return query;
}
public void setQuery(String query) {
this.query = query;
}
public String getDraftData() {
return draftData;
}
public void setDraftData(String draftData) {
this.draftData = draftData;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
......@@ -193,6 +193,7 @@ public class ProcessPlatformPlan extends Plan {
List<List<String>> batch_jobs = ListTools.batch(jobs, SQL_STATEMENT_IN_BATCH);
for (int i = 0; i < filterEntries.size(); i++) {
FilterEntry f = filterEntries.get(i);
logger.debug("listBundle_filterEntry:{}.", f);
List<String> os = new TreeList<>();
List<CompletableFuture<List<String>>> futures = new TreeList<>();
for (List<String> _batch : batch_jobs) {
......@@ -203,6 +204,7 @@ public class ProcessPlatformPlan extends Plan {
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Item> root = cq.from(Item.class);
Predicate p = f.toPredicate(cb, root, this.runtime, ItemCategory.pp);
logger.debug("predicate:{}.", p);
p = cb.and(p, cb.isMember(root.get(Item_.bundle), cb.literal(_batch)));
cq.select(root.get(Item_.bundle)).where(p);
return em.createQuery(cq).getResultList();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册