提交 156c55d5 编写于 作者: Z zhourui

添加entity列表

上级 00706bc0
......@@ -26,7 +26,7 @@ public abstract class TokenFilter implements Filter {
if (Objects.isNull(refererPattern)) {
synchronized (TokenFilter.class) {
if (StringUtils.isNotBlank(Config.general().getRefererHeadCheckRegular())) {
refererPattern = Optional.of(Pattern.compile(Config.general().getRefererHeadCheckRegular()));
refererPattern = Optional.of(Pattern.compile(Config.general().getRefererHeadCheckRegular(),Pattern.CASE_INSENSITIVE));
} else {
refererPattern = Optional.empty();
}
......
......@@ -35,6 +35,9 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.cms.core.entity.AppInfo;
import com.x.cms.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "AppDictItem", description = "内容管理字典条目.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Element.AppDictItem.table, uniqueConstraints = {
......
......@@ -32,12 +32,15 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.cms.core.entity.AppInfo;
import com.x.cms.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 资源文件
*
* @author O2LEE
*
*/
@Schema(name = "File", description = "内容管理文件.")
@Entity
@ContainerEntity(dumpSize = 5, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Element.File.table, uniqueConstraints = {
......
......@@ -26,6 +26,9 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.cms.core.entity.AppInfo;
import com.x.cms.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Form", description = "内容管理表单.")
@Entity
@ContainerEntity(dumpSize = 5, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Element.Form.table, uniqueConstraints = {
......
......@@ -20,6 +20,9 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.cms.core.entity.AppInfo;
import com.x.cms.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "FormField", description = "内容管理表单字段.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Element.FormField.table, uniqueConstraints = {
......
......@@ -32,6 +32,9 @@ import com.x.base.core.entity.annotation.Flag;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.cms.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "QueryView", description = "内容管理查询视图.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Element.QueryView.table, uniqueConstraints = {
......@@ -254,8 +257,9 @@ public class QueryView extends SliceJpaObject {
@FieldDescribe("栏目管理者。")
@PersistentCollection(fetch = FetchType.EAGER)
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ContainerTable(name = TABLE + ContainerTableNameMiddle + controllerList_FIELDNAME, joinIndex = @Index(name = TABLE
+ IndexNameMiddle + controllerList_FIELDNAME + JoinIndexNameSuffix))
@ContainerTable(name = TABLE + ContainerTableNameMiddle
+ controllerList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle + controllerList_FIELDNAME
+ JoinIndexNameSuffix))
@ElementColumn(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix
+ controllerList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + controllerList_FIELDNAME + ElementIndexNameSuffix)
......
......@@ -35,6 +35,9 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.cms.core.entity.AppInfo;
import com.x.cms.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "v", description = "内容管理脚本.")
@Entity
@ContainerEntity(dumpSize = 5, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Element.Script.table, uniqueConstraints = {
......
......@@ -23,6 +23,9 @@ import com.x.base.core.entity.annotation.Flag;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.cms.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "TemplateForm", description = "内容管理表单模板.")
@Entity
@ContainerEntity(dumpSize = 5, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Element.TemplateForm.table, uniqueConstraints = {
......
......@@ -33,6 +33,9 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.cms.core.entity.AppInfo;
import com.x.cms.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "View", description = "内容管理视图.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Element.View.table, uniqueConstraints = {
......
......@@ -19,6 +19,9 @@ import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.cms.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "ViewCategory", description = "内容管理视图分类.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Element.ViewCategory.table, uniqueConstraints = {
......
......@@ -19,6 +19,9 @@ import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.cms.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "ViewFieldConfig", description = "内容管理视图字段配置.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Element.ViewFieldConfig.table, uniqueConstraints = {
......
......@@ -29,6 +29,7 @@ import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Component", description = "组件内容.")
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.Component.table, uniqueConstraints = {
......
......@@ -29,6 +29,8 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.DateTools;
import com.x.file.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
/**
*
* 有两个可能性创建File:<br/>
......@@ -36,6 +38,7 @@ import com.x.file.core.entity.PersistenceProperties;
* 2.通过Attachment转储<br/>
*
*/
@Schema(name = "File", description = "云文件存储文件.")
@Entity
@ContainerEntity(dumpSize = 10, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Open.File.table, uniqueConstraints = {
......
......@@ -21,10 +21,13 @@ import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.file.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 云文件系统配置
* @author sword
*/
@Schema(name = "FileConfig", description = "云文件配置.")
@ContainerEntity(dumpSize = 100, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.Open.FileConfig.table, uniqueConstraints = {
......
......@@ -26,6 +26,9 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.DateTools;
import com.x.file.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "OriginFile", description = "云文件原始文件.")
@ContainerEntity(dumpSize = 10, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.Open.OriginFile.table, uniqueConstraints = {
......
......@@ -36,6 +36,9 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.DateTools;
import com.x.file.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Attachment", description = "云文件个人文件.")
@ContainerEntity(dumpSize = 5, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.Personal.Attachment.table, uniqueConstraints = {
......
......@@ -25,6 +25,9 @@ import com.x.file.core.entity.PersistenceProperties;
import com.x.file.core.entity.open.FileStatus;
import com.x.file.core.entity.open.FileType;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Attachment2", description = "云文件新个人文件.")
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.Personal.Attachment2.table, uniqueConstraints = {
......
......@@ -21,6 +21,9 @@ import com.x.base.core.entity.annotation.Equal;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.file.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Folder", description = "云文件个人文件夹.")
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.Personal.Folder.table, uniqueConstraints = {
......
......@@ -23,6 +23,9 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.file.core.entity.PersistenceProperties;
import com.x.file.core.entity.open.FileStatus;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Folder2", description = "云文件个人新文件夹.")
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.Personal.Folder2.table, uniqueConstraints = {
......
......@@ -23,10 +23,13 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.DateTools;
import com.x.file.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 回收站
* @author sword
*/
@Schema(name = "Recycle", description = "云文件个人回收站.")
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.Personal.Recycle.table, uniqueConstraints = {
......
......@@ -30,6 +30,9 @@ import com.x.base.core.entity.annotation.Equal;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.file.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Share", description = "云文件个人分享文件.")
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.Personal.Share.table, uniqueConstraints = {
......
......@@ -24,6 +24,9 @@ import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.DateTools;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "GeneralFile", description = "通用文件.")
@ContainerEntity(dumpSize = 10, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.GeneralFile.table, uniqueConstraints = {
......
......@@ -17,6 +17,9 @@ import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.general.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "District", description = "通用区域.")
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.element, reference = ContainerEntity.Reference.soft)
@Entity
@Table(name = PersistenceProperties.Area.District.table, uniqueConstraints = {
......
......@@ -16,11 +16,14 @@ import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 热图信息(热点图片信息)表
*
* @author O2LEE
*/
@Schema(name = "HotPictureInfo", description = "热点图片信息.")
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.HotPictureInfo.table, uniqueConstraints = {
......
package com.x.jpush.assemble.control;
import com.x.base.core.container.EntityManagerContainer;
import com.x.jpush.assemble.control.factory.SampleEntityClassNameFactory;
import com.x.jpush.assemble.control.factory.PushDeviceFactory;
import com.x.organization.core.express.Organization;
public class Business {
private EntityManagerContainer emc;
public Business(EntityManagerContainer emc) throws Exception {
this.emc = emc;
}
......@@ -18,18 +16,17 @@ public class Business {
return this.emc;
}
//组织架构管理相关的工厂服务类
// 组织架构管理相关的工厂服务类
private Organization organization;
//示例数据表工厂服务类
private SampleEntityClassNameFactory sampleEntityClassNameFactory;
public SampleEntityClassNameFactory sampleEntityClassNameFactory() throws Exception {
if (null == this.sampleEntityClassNameFactory) {
this.sampleEntityClassNameFactory = new SampleEntityClassNameFactory( this );
// 示例数据表工厂服务类
private PushDeviceFactory pushDeviceFactory;
public PushDeviceFactory pushDeviceFactory() throws Exception {
if (null == this.pushDeviceFactory) {
this.pushDeviceFactory = new PushDeviceFactory(this);
}
return sampleEntityClassNameFactory;
return pushDeviceFactory;
}
public Organization organization() throws Exception {
......@@ -39,7 +36,4 @@ public class Business {
return organization;
}
}
......@@ -8,66 +8,23 @@ import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import com.x.base.core.project.exception.ExceptionWhen;
import com.x.jpush.assemble.control.AbstractFactory;
import com.x.jpush.assemble.control.Business;
import com.x.jpush.core.entity.PushDevice;
import com.x.jpush.core.entity.PushDevice_;
import com.x.jpush.core.entity.SampleEntityClassName;
import com.x.jpush.core.entity.SampleEntityClassName_;
/**
* 示例数据表基础功能服务类
*/
public class SampleEntityClassNameFactory extends AbstractFactory {
public SampleEntityClassNameFactory( Business business) throws Exception {
super(business);
}
/**
* 获取指定Id的SampleEntityClassName信息对象
* @param id
* @return
* @throws Exception
*/
public SampleEntityClassName get( String id ) throws Exception {
return this.entityManagerContainer().find(id, SampleEntityClassName.class, ExceptionWhen.none);
}
/**
* 根据ID列示指定的SampleEntityClassName信息列表
* @param ids
* @return
* @throws Exception
*/
public List<SampleEntityClassName> list( List<String> ids, Integer maxCount ) throws Exception {
EntityManager em = this.entityManagerContainer().get(SampleEntityClassName.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<SampleEntityClassName> cq = cb.createQuery(SampleEntityClassName.class);
Root<SampleEntityClassName> root = cq.from( SampleEntityClassName.class);
Predicate p = root.get(SampleEntityClassName_.id).in(ids);
return em.createQuery(cq.where(p)).setMaxResults(maxCount).getResultList();
}
public class PushDeviceFactory extends AbstractFactory {
/**
* 列示全部的SampleEntityClassName信息列表
* @param maxCount 返回的最大条目数
* @return
* @throws Exception
*/
public List<SampleEntityClassName> listAll( Integer maxCount ) throws Exception {
EntityManager em = this.entityManagerContainer().get(SampleEntityClassName.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<SampleEntityClassName> cq = cb.createQuery(SampleEntityClassName.class);
Root<SampleEntityClassName> root = cq.from( SampleEntityClassName.class);
//根据数据更新时间降序
cq.orderBy( cb.desc( root.get( SampleEntityClassName_.updateTime ) ) );
return em.createQuery(cq).setMaxResults(maxCount).getResultList();
public PushDeviceFactory(Business business) throws Exception {
super(business);
}
/**
* 根据unique 查询设备
*
* @param unique
* @return
* @throws Exception
......@@ -86,9 +43,9 @@ public class SampleEntityClassNameFactory extends AbstractFactory {
return null;
}
/**
* 设备是否存在
*
* @param unique md5(deviceType+deviceId+pushType+person)
* @return
* @throws Exception
......@@ -107,9 +64,9 @@ public class SampleEntityClassNameFactory extends AbstractFactory {
return false;
}
/**
* 查询用户的极光推送的设备列表
*
* @param person
* @return
* @throws Exception
......@@ -120,6 +77,7 @@ public class SampleEntityClassNameFactory extends AbstractFactory {
/**
* 查询用户的华为推送的设备列表
*
* @param person
* @return
* @throws Exception
......@@ -139,5 +97,4 @@ public class SampleEntityClassNameFactory extends AbstractFactory {
return em.createQuery(query).getResultList();
}
}
\ No newline at end of file
......@@ -7,7 +7,6 @@ import javax.ws.rs.ApplicationPath;
import com.x.base.core.project.jaxrs.AbstractActionApplication;
import com.x.jpush.assemble.control.jaxrs.device.DeviceAction;
import com.x.jpush.assemble.control.jaxrs.message.MessageAction;
import com.x.jpush.assemble.control.jaxrs.sample.SampleEntityClassNameAction;
/**
* Jaxrs服务注册类,在此类中注册的Action会向外提供服务
......@@ -18,7 +17,6 @@ public class ActionApplication extends AbstractActionApplication {
public Set<Class<?>> getClasses() {
//提供服务的Action类需要在这里注册,不然无法向外提供服务
this.classes.add( SampleEntityClassNameAction.class);
this.classes.add(DeviceAction.class);
this.classes.add(MessageAction.class);
......
......@@ -7,10 +7,6 @@ import com.x.base.core.project.jaxrs.ManagerUserJaxrsFilter;
/**
* web服务过滤器,将指定的URL定义为需要用户认证的服务,如果用户未登录,则无法访问该服务
*/
@WebFilter(urlPatterns = {
"/servlet/*",
"/jaxrs/sample/*",
"/jaxrs/device/*"
}, asyncSupported = true )
@WebFilter(urlPatterns = "/jaxrs/device/*", asyncSupported = true)
public class JaxrsServicePathFilter extends ManagerUserJaxrsFilter {
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package com.x.jpush.assemble.control.jaxrs.device;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.apache.sis.coverage.grid.IllegalGridGeometryException;
import com.google.gson.JsonElement;
import com.x.base.core.container.EntityManagerContainer;
......@@ -15,52 +16,51 @@ import com.x.base.core.project.jaxrs.WrapBoolean;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.jpush.assemble.control.Business;
import com.x.jpush.assemble.control.jaxrs.sample.BaseAction;
import com.x.jpush.assemble.control.jaxrs.sample.ExceptionSampleEntityClassFind;
import com.x.jpush.core.entity.PushDevice;
public class ActionBind extends BaseAction {
private Logger logger = LoggerFactory.getLogger( ActionBind.class );
protected ActionResult<Wo> execute(HttpServletRequest request, EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
logger.info("execute action 'ActionBind'......");
ActionResult<Wo> result = new ActionResult<>();
Wo wraps = new Wo();
if (jsonElement == null) {
throw new ExceptionDeviceParameterEmpty();
}
Wi wi = convertToWrapIn(jsonElement, Wi.class);
if (StringUtils.isEmpty(wi.getDeviceName()) || StringUtils.isEmpty(wi.getDeviceType()) ) {
throw new ExceptionDeviceParameterEmpty();
}
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
String pushType = wi.getPushType();
if (StringUtils.isEmpty(pushType)) {
pushType = PushDevice.PUSH_TYPE_JPUSH; //默认极光推送
}
String person = effectivePerson.getDistinguishedName();
String unique = deviceUnique(wi.getDeviceType(), wi.getDeviceName(), pushType, person);
if (business.sampleEntityClassNameFactory().existDeviceUnique(unique)) {
wraps.setValue(true);
result.setMessage("当前设备已存在!");
} else {
PushDevice pushDevice = new PushDevice();
pushDevice.setDeviceId(wi.getDeviceName());
pushDevice.setDeviceType(wi.getDeviceType());
pushDevice.setPerson(person);
pushDevice.setPushType(pushType);
pushDevice.setUnique(unique);
emc.beginTransaction(PushDevice.class);
emc.persist(pushDevice, CheckPersistType.all);
emc.commit();
wraps.setValue(true);
}
// 以前存放在个人属性中, 现在切换到数据库
private Logger logger = LoggerFactory.getLogger(ActionBind.class);
protected ActionResult<Wo> execute(HttpServletRequest request, EffectivePerson effectivePerson,
JsonElement jsonElement) throws Exception {
logger.info("execute action 'ActionBind'......");
ActionResult<Wo> result = new ActionResult<>();
Wo wraps = new Wo();
if (jsonElement == null) {
throw new ExceptionDeviceParameterEmpty();
}
Wi wi = convertToWrapIn(jsonElement, Wi.class);
if (StringUtils.isEmpty(wi.getDeviceName()) || StringUtils.isEmpty(wi.getDeviceType())) {
throw new ExceptionDeviceParameterEmpty();
}
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
String pushType = wi.getPushType();
if (StringUtils.isEmpty(pushType)) {
pushType = PushDevice.PUSH_TYPE_JPUSH; // 默认极光推送
}
String person = effectivePerson.getDistinguishedName();
String unique = deviceUnique(wi.getDeviceType(), wi.getDeviceName(), pushType, person);
if (business.pushDeviceFactory().existDeviceUnique(unique)) {
wraps.setValue(true);
result.setMessage("当前设备已存在!");
} else {
PushDevice pushDevice = new PushDevice();
pushDevice.setDeviceId(wi.getDeviceName());
pushDevice.setDeviceType(wi.getDeviceType());
pushDevice.setPerson(person);
pushDevice.setPushType(pushType);
pushDevice.setUnique(unique);
emc.beginTransaction(PushDevice.class);
emc.persist(pushDevice, CheckPersistType.all);
emc.commit();
wraps.setValue(true);
}
// 以前存放在个人属性中, 现在切换到数据库
// List<String> deviceList = business.organization().personAttribute()
// .listAttributeWithPersonWithName(effectivePerson.getDistinguishedName(), ActionListAll.DEVICE_PERSON_ATTR_KEY);
// String device = wi.getDeviceName()+"_"+wi.getDeviceType().toLowerCase();
......@@ -79,52 +79,50 @@ public class ActionBind extends BaseAction {
// wraps.setValue(business.organization().personAttribute()
// .setWithPersonWithName(effectivePerson.getDistinguishedName(), ActionListAll.DEVICE_PERSON_ATTR_KEY, deviceList));
// }
result.setData(wraps);
} catch (Exception e) {
logger.error(e);
throw new ExceptionSampleEntityClassFind( e, "系统在绑定设备时发生异常!" );
}
logger.info("action 'ActionBind' execute completed!");
return result;
}
public static class Wi {
@FieldDescribe("设备号deviceName")
private String deviceName;
@FieldDescribe("设备类型deviceType:ios|android")
private String deviceType;
@FieldDescribe("推送通道类型:jpush|huawei")
private String pushType;
public String getPushType() {
return pushType;
}
public void setPushType(String pushType) {
this.pushType = pushType;
}
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceType() {
return deviceType;
}
public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}
}
public static class Wo extends WrapBoolean {
}
result.setData(wraps);
} catch (Exception e) {
logger.error(e);
throw new IllegalGridGeometryException("系统在绑定设备时发生异常!", e);
}
logger.info("action 'ActionBind' execute completed!");
return result;
}
public static class Wi {
@FieldDescribe("设备号deviceName")
private String deviceName;
@FieldDescribe("设备类型deviceType:ios|android")
private String deviceType;
@FieldDescribe("推送通道类型:jpush|huawei")
private String pushType;
public String getPushType() {
return pushType;
}
public void setPushType(String pushType) {
this.pushType = pushType;
}
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceType() {
return deviceType;
}
public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}
}
public static class Wo extends WrapBoolean {
}
}
......@@ -12,30 +12,29 @@ import com.x.base.core.project.jaxrs.WrapBoolean;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.jpush.assemble.control.Business;
import com.x.jpush.assemble.control.jaxrs.sample.BaseAction;
import com.x.jpush.assemble.control.jaxrs.sample.ExceptionSampleEntityClassFind;
public class ActionCheck extends BaseAction {
private Logger logger = LoggerFactory.getLogger( ActionCheck.class );
protected ActionResult<Wo> execute(HttpServletRequest request, EffectivePerson effectivePerson, String deviceName, String deviceType, String pushType) throws Exception {
logger.info("execute action 'ActionCheck'......");
ActionResult<Wo> result = new ActionResult<>();
Wo wraps = new Wo();
if (StringUtils.isEmpty(deviceName) || StringUtils.isEmpty(deviceType) || StringUtils.isEmpty(pushType)) {
throw new ExceptionDeviceParameterEmpty();
}
deviceType = deviceType.toLowerCase();
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
String unique = deviceUnique(deviceType, deviceName, pushType, effectivePerson.getDistinguishedName());
if (business.sampleEntityClassNameFactory().existDeviceUnique(unique)) {
wraps.setValue(true);
}else {
wraps.setValue(false);
}
private Logger logger = LoggerFactory.getLogger(ActionCheck.class);
protected ActionResult<Wo> execute(HttpServletRequest request, EffectivePerson effectivePerson, String deviceName,
String deviceType, String pushType) throws Exception {
logger.info("execute action 'ActionCheck'......");
ActionResult<Wo> result = new ActionResult<>();
Wo wraps = new Wo();
if (StringUtils.isEmpty(deviceName) || StringUtils.isEmpty(deviceType) || StringUtils.isEmpty(pushType)) {
throw new ExceptionDeviceParameterEmpty();
}
deviceType = deviceType.toLowerCase();
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
String unique = deviceUnique(deviceType, deviceName, pushType, effectivePerson.getDistinguishedName());
if (business.pushDeviceFactory().existDeviceUnique(unique)) {
wraps.setValue(true);
} else {
wraps.setValue(false);
}
// List<String> deviceList = business.organization().personAttribute()
// .listAttributeWithPersonWithName(effectivePerson.getDistinguishedName(), ActionListAll.DEVICE_PERSON_ATTR_KEY);
// if( ListTools.isNotEmpty( deviceList ) ){
......@@ -44,19 +43,17 @@ public class ActionCheck extends BaseAction {
// }else {
// wraps.setValue(false);
// }
result.setData(wraps);
} catch (Exception e) {
logger.error(e);
throw new ExceptionSampleEntityClassFind( e, "系统在检查绑定设备是否存在时发生异常!" );
}
result.setData(wraps);
} catch (Exception e) {
logger.error(e);
throw new IllegalArgumentException("系统在检查绑定设备是否存在时发生异常!", e);
}
logger.info("action 'ActionCheck' execute completed!");
return result;
}
logger.info("action 'ActionCheck' execute completed!");
return result;
}
public static class Wo extends WrapBoolean {
public static class Wo extends WrapBoolean {
}
}
}
......@@ -10,7 +10,6 @@ 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.jpush.assemble.control.jaxrs.sample.BaseAction;
import com.x.jpush.core.entity.PushDevice;
/**
......
......@@ -16,38 +16,38 @@ import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.ListTools;
import com.x.jpush.assemble.control.Business;
import com.x.jpush.assemble.control.jaxrs.sample.BaseAction;
import com.x.jpush.assemble.control.jaxrs.sample.ExceptionSampleEntityClassFind;
import com.x.jpush.core.entity.PushDevice;
public class ActionListAll extends BaseAction {
private Logger logger = LoggerFactory.getLogger( ActionListAll.class );
public static final String DEVICE_PERSON_ATTR_KEY = "appBindDeviceList";
protected ActionResult<List<Wo>> execute(HttpServletRequest request, EffectivePerson effectivePerson, String pushType) throws Exception {
logger.info("execute action 'ActionListAll'......");
ActionResult<List<Wo>> result = new ActionResult<>();
if (StringUtils.isEmpty(pushType)) {
throw new ExceptionDevicePushTypeError();
}
if (!pushType.equals(PushDevice.PUSH_TYPE_JPUSH) && !pushType.equals(PushDevice.PUSH_TYPE_HUAWEI)) {
throw new ExceptionDevicePushTypeError();
}
List<Wo> wraps = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
if (pushType.equals(PushDevice.PUSH_TYPE_JPUSH)) {
List<PushDevice> list = business.sampleEntityClassNameFactory().listJpushDevice(effectivePerson.getDistinguishedName());
wraps = Wo.copyFromPushDeviceList(list);
result.setData(wraps);
result.setCount(Long.parseLong(wraps.size()+""));
} else {
List<PushDevice> list = business.sampleEntityClassNameFactory().listHuaweiDevice(effectivePerson.getDistinguishedName());
wraps = Wo.copyFromPushDeviceList(list);
result.setData(wraps);
result.setCount(Long.parseLong(wraps.size()+""));
}
private Logger logger = LoggerFactory.getLogger(ActionListAll.class);
public static final String DEVICE_PERSON_ATTR_KEY = "appBindDeviceList";
protected ActionResult<List<Wo>> execute(HttpServletRequest request, EffectivePerson effectivePerson,
String pushType) throws Exception {
logger.info("execute action 'ActionListAll'......");
ActionResult<List<Wo>> result = new ActionResult<>();
if (StringUtils.isEmpty(pushType)) {
throw new ExceptionDevicePushTypeError();
}
if (!pushType.equals(PushDevice.PUSH_TYPE_JPUSH) && !pushType.equals(PushDevice.PUSH_TYPE_HUAWEI)) {
throw new ExceptionDevicePushTypeError();
}
List<Wo> wraps = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
if (pushType.equals(PushDevice.PUSH_TYPE_JPUSH)) {
List<PushDevice> list = business.pushDeviceFactory()
.listJpushDevice(effectivePerson.getDistinguishedName());
wraps = Wo.copyFromPushDeviceList(list);
result.setData(wraps);
result.setCount(Long.parseLong(wraps.size() + ""));
} else {
List<PushDevice> list = business.pushDeviceFactory()
.listHuaweiDevice(effectivePerson.getDistinguishedName());
wraps = Wo.copyFromPushDeviceList(list);
result.setData(wraps);
result.setCount(Long.parseLong(wraps.size() + ""));
}
//
//
// List<String> deviceList = business.organization().personAttribute()
......@@ -57,75 +57,69 @@ public class ActionListAll extends BaseAction {
// result.setCount(Long.parseLong( wraps.size() + "") );
// result.setData( wraps );
// }
} catch (Exception e) {
logger.error(e);
throw new ExceptionSampleEntityClassFind( e, "系统在查询绑定设备时发生异常!" );
}
logger.info("action 'ActionListAll' execute completed!");
return result;
}
/**
*
* 向外输出的结果对象包装类
*
*/
public static class Wo extends GsonPropertyObject {
private String deviceName;
private String deviceType;
public static List<Wo> copyFromPushDeviceList(List<PushDevice> list) {
List<Wo> ret = new ArrayList<>();
if (list!=null && !list.isEmpty()) {
for (int i = 0; i < list.size(); i++) {
PushDevice pushDevice = list.get(i);
Wo wo = new Wo();
wo.setDeviceName(pushDevice.getDeviceId());
wo.setDeviceType(pushDevice.getDeviceType());
ret.add(wo);
}
}
return ret;
}
public static List<Wo> copyFromAttributes(List<String> attributes) {
List<Wo> ret = new ArrayList<>();
if (ListTools.isNotEmpty(attributes)) {
for (int i = 0; i < attributes.size(); i++) {
String[] device = attributes.get(i).split("_");
if (device.length == 2) {
Wo wo = new Wo();
wo.setDeviceName(device[0]);
wo.setDeviceType(device[1]);
ret.add(wo);
}
}
}
return ret;
}
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceType() {
return deviceType;
}
public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}
}
} catch (Exception e) {
logger.error(e);
throw new IllegalArgumentException("系统在查询绑定设备时发生异常!", e);
}
logger.info("action 'ActionListAll' execute completed!");
return result;
}
/**
*
* 向外输出的结果对象包装类
*
*/
public static class Wo extends GsonPropertyObject {
private String deviceName;
private String deviceType;
public static List<Wo> copyFromPushDeviceList(List<PushDevice> list) {
List<Wo> ret = new ArrayList<>();
if (list != null && !list.isEmpty()) {
for (int i = 0; i < list.size(); i++) {
PushDevice pushDevice = list.get(i);
Wo wo = new Wo();
wo.setDeviceName(pushDevice.getDeviceId());
wo.setDeviceType(pushDevice.getDeviceType());
ret.add(wo);
}
}
return ret;
}
public static List<Wo> copyFromAttributes(List<String> attributes) {
List<Wo> ret = new ArrayList<>();
if (ListTools.isNotEmpty(attributes)) {
for (int i = 0; i < attributes.size(); i++) {
String[] device = attributes.get(i).split("_");
if (device.length == 2) {
Wo wo = new Wo();
wo.setDeviceName(device[0]);
wo.setDeviceType(device[1]);
ret.add(wo);
}
}
}
return ret;
}
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceType() {
return deviceType;
}
public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}
}
}
......@@ -13,54 +13,49 @@ import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.ListTools;
import com.x.jpush.assemble.control.Business;
import com.x.jpush.assemble.control.jaxrs.sample.BaseAction;
import com.x.jpush.assemble.control.jaxrs.sample.ExceptionSampleEntityClassFind;
public class ActionRemoveBind extends BaseAction {
private Logger logger = LoggerFactory.getLogger( ActionRemoveBind.class );
protected ActionResult<Wo> execute(HttpServletRequest request, EffectivePerson effectivePerson, String deviceName, String deviceType) throws Exception {
logger.info("execute action 'ActionRemoveBind'......");
ActionResult<Wo> result = new ActionResult<>();
Wo wraps = new Wo();
if (deviceName == null || deviceType == null || deviceName.equals("") || deviceType.equals("")) {
throw new ExceptionDeviceParameterEmpty();
}
deviceType = deviceType.toLowerCase();
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
List<String> deviceList = business.organization().personAttribute()
.listAttributeWithPersonWithName(effectivePerson.getDistinguishedName(), ActionListAll.DEVICE_PERSON_ATTR_KEY);
String device = deviceName+"_"+deviceType.toLowerCase();
if(ListTools.isNotEmpty( deviceList ) ){
if (deviceList.contains(device)) {
deviceList.remove(device);
wraps.setValue(business.organization().personAttribute()
.setWithPersonWithName(effectivePerson.getDistinguishedName(), ActionListAll.DEVICE_PERSON_ATTR_KEY, deviceList));
}else {
wraps.setValue(true);
result.setMessage("当前设备不存在,无需解绑!");
}
}else {
wraps.setValue(true);
result.setMessage("当前设备不存在,无需解绑!");
}
result.setData(wraps);
logger.info("action 'ActionRemoveBind' execute completed!");
return result;
} catch (Exception e) {
logger.error(e);
throw new ExceptionSampleEntityClassFind( e, "系统在设备解除绑定时发生异常!" );
}
}
public static class Wo extends WrapBoolean {
}
private Logger logger = LoggerFactory.getLogger(ActionRemoveBind.class);
protected ActionResult<Wo> execute(HttpServletRequest request, EffectivePerson effectivePerson, String deviceName,
String deviceType) throws Exception {
logger.info("execute action 'ActionRemoveBind'......");
ActionResult<Wo> result = new ActionResult<>();
Wo wraps = new Wo();
if (deviceName == null || deviceType == null || deviceName.equals("") || deviceType.equals("")) {
throw new ExceptionDeviceParameterEmpty();
}
deviceType = deviceType.toLowerCase();
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
List<String> deviceList = business.organization().personAttribute().listAttributeWithPersonWithName(
effectivePerson.getDistinguishedName(), ActionListAll.DEVICE_PERSON_ATTR_KEY);
String device = deviceName + "_" + deviceType.toLowerCase();
if (ListTools.isNotEmpty(deviceList)) {
if (deviceList.contains(device)) {
deviceList.remove(device);
wraps.setValue(business.organization().personAttribute().setWithPersonWithName(
effectivePerson.getDistinguishedName(), ActionListAll.DEVICE_PERSON_ATTR_KEY, deviceList));
} else {
wraps.setValue(true);
result.setMessage("当前设备不存在,无需解绑!");
}
} else {
wraps.setValue(true);
result.setMessage("当前设备不存在,无需解绑!");
}
result.setData(wraps);
logger.info("action 'ActionRemoveBind' execute completed!");
return result;
} catch (Exception e) {
logger.error(e);
throw new IllegalArgumentException("系统在设备解除绑定时发生异常!", e);
}
}
public static class Wo extends WrapBoolean {
}
}
......@@ -13,44 +13,43 @@ import com.x.base.core.project.jaxrs.WrapBoolean;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.jpush.assemble.control.Business;
import com.x.jpush.assemble.control.jaxrs.sample.BaseAction;
import com.x.jpush.assemble.control.jaxrs.sample.ExceptionSampleEntityClassFind;
import com.x.jpush.core.entity.PushDevice;
public class ActionRemoveBindNew extends BaseAction {
private Logger logger = LoggerFactory.getLogger( ActionRemoveBindNew.class );
private Logger logger = LoggerFactory.getLogger(ActionRemoveBindNew.class);
protected ActionResult<Wo> execute(HttpServletRequest request, EffectivePerson effectivePerson, String deviceName, String deviceType, String pushType) throws Exception {
logger.info("execute action 'ActionRemoveBindNew'......");
ActionResult<Wo> result = new ActionResult<>();
Wo wraps = new Wo();
if (StringUtils.isEmpty(deviceName) || StringUtils.isEmpty(deviceType)) {
throw new ExceptionDeviceParameterEmpty();
}
if (!deviceType.equals(PushDevice.DEVICE_TYPE_ANDROID) && !deviceType.equals(PushDevice.DEVICE_TYPE_IOS)) {
throw new ExceptionDevicePushTypeError();
}
if (StringUtils.isEmpty(pushType)) {
throw new ExceptionDevicePushTypeError();
}
if (!pushType.equals(PushDevice.PUSH_TYPE_JPUSH) && !pushType.equals(PushDevice.PUSH_TYPE_HUAWEI)) {
throw new ExceptionDevicePushTypeError();
}
protected ActionResult<Wo> execute(HttpServletRequest request, EffectivePerson effectivePerson, String deviceName,
String deviceType, String pushType) throws Exception {
logger.info("execute action 'ActionRemoveBindNew'......");
ActionResult<Wo> result = new ActionResult<>();
Wo wraps = new Wo();
if (StringUtils.isEmpty(deviceName) || StringUtils.isEmpty(deviceType)) {
throw new ExceptionDeviceParameterEmpty();
}
if (!deviceType.equals(PushDevice.DEVICE_TYPE_ANDROID) && !deviceType.equals(PushDevice.DEVICE_TYPE_IOS)) {
throw new ExceptionDevicePushTypeError();
}
if (StringUtils.isEmpty(pushType)) {
throw new ExceptionDevicePushTypeError();
}
if (!pushType.equals(PushDevice.PUSH_TYPE_JPUSH) && !pushType.equals(PushDevice.PUSH_TYPE_HUAWEI)) {
throw new ExceptionDevicePushTypeError();
}
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
String unique = deviceUnique(deviceType, deviceName, pushType, effectivePerson.getDistinguishedName());
PushDevice pushDevice = business.sampleEntityClassNameFactory().findDeviceByUnique(unique);
if (pushDevice != null) {
EntityManager m = emc.beginTransaction(PushDevice.class);
emc.delete(PushDevice.class, pushDevice.getId());
m.getTransaction().commit();
wraps.setValue(true);
} else {
wraps.setValue(true);
result.setMessage("当前设备不存在,无需解绑!");
}
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
String unique = deviceUnique(deviceType, deviceName, pushType, effectivePerson.getDistinguishedName());
PushDevice pushDevice = business.pushDeviceFactory().findDeviceByUnique(unique);
if (pushDevice != null) {
EntityManager m = emc.beginTransaction(PushDevice.class);
emc.delete(PushDevice.class, pushDevice.getId());
m.getTransaction().commit();
wraps.setValue(true);
} else {
wraps.setValue(true);
result.setMessage("当前设备不存在,无需解绑!");
}
// List<String> deviceList = business.organization().personAttribute()
// .listAttributeWithPersonWithName(effectivePerson.getDistinguishedName(), ActionListAll.DEVICE_PERSON_ATTR_KEY);
// String device = deviceName+"_"+deviceType.toLowerCase();
......@@ -67,20 +66,17 @@ public class ActionRemoveBindNew extends BaseAction {
// wraps.setValue(true);
// result.setMessage("当前设备不存在,无需解绑!");
// }
result.setData(wraps);
} catch (Exception e) {
logger.error(e);
throw new ExceptionSampleEntityClassFind( e, "系统在设备解除绑定时发生异常!" );
}
result.setData(wraps);
} catch (Exception e) {
logger.error(e);
throw new IllegalArgumentException("系统在设备解除绑定时发生异常!", e);
}
logger.info("action 'ActionRemoveBindNew' execute completed!");
return result;
}
logger.info("action 'ActionRemoveBindNew' execute completed!");
return result;
}
public static class Wo extends WrapBoolean {
public static class Wo extends WrapBoolean {
}
}
}
package com.x.jpush.assemble.control.jaxrs.sample;
package com.x.jpush.assemble.control.jaxrs.device;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.base.core.project.tools.MD5Tool;
......
......@@ -25,7 +25,6 @@ import com.x.base.core.project.jaxrs.ResponseFactory;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.jpush.assemble.control.jaxrs.sample.ExceptionSampleEntityClassFind;
@Path("device")
@JaxrsDescribe("极光推送设备服务模块")
......@@ -38,13 +37,13 @@ public class DeviceAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listAllByPushType(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("推送通道类型:jpush|huawei") @PathParam("pushType") String pushType) {
@JaxrsParameterDescribe("推送通道类型:jpush|huawei") @PathParam("pushType") String pushType) {
ActionResult<List<ActionListAll.Wo>> result = new ActionResult<>();
try {
result = new ActionListAll().execute(request, this.effectivePerson(request), pushType);
} catch (Exception e) {
result = new ActionResult<>();
Exception exception = new ExceptionSampleEntityClassFind(e, "获取当前用户所有绑定设备时发生异常!");
Exception exception = new IllegalArgumentException("获取当前用户所有绑定设备时发生异常!", e);
result.error(exception);
logger.error(e, this.effectivePerson(request), request, null);
}
......@@ -59,14 +58,15 @@ public class DeviceAction extends StandardJaxrsAction {
public void checkBind(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("设备号") @PathParam("deviceName") String deviceName,
@JaxrsParameterDescribe("设备类型:android|ios") @PathParam("deviceType") String deviceType,
@JaxrsParameterDescribe("推送通道类型:jpush|huawei") @PathParam("pushType") String pushType) {
@JaxrsParameterDescribe("推送通道类型:jpush|huawei") @PathParam("pushType") String pushType) {
ActionResult<ActionCheck.Wo> result = new ActionResult<>();
try {
result = new ActionCheck().execute(request, this.effectivePerson(request), deviceName, deviceType, pushType);
result = new ActionCheck().execute(request, this.effectivePerson(request), deviceName, deviceType,
pushType);
} catch (Exception e) {
result = new ActionResult<>();
Exception exception = new ExceptionSampleEntityClassFind(e, "检查设备是否已经绑定时发生异常!");
Exception exception = new IllegalArgumentException("检查设备是否已经绑定时发生异常!", e);
result.error(exception);
logger.error(e, this.effectivePerson(request), request, null);
}
......@@ -86,7 +86,7 @@ public class DeviceAction extends StandardJaxrsAction {
result = new ActionBind().execute(request, this.effectivePerson(request), jsonElement);
} catch (Exception e) {
result = new ActionResult<>();
Exception exception = new ExceptionSampleEntityClassFind(e, "绑定设备时发生异常!");
Exception exception = new IllegalArgumentException("绑定设备时发生异常!", e);
result.error(exception);
logger.error(e, this.effectivePerson(request), request, null);
}
......@@ -107,7 +107,7 @@ public class DeviceAction extends StandardJaxrsAction {
result = new ActionRemoveBind().execute(request, this.effectivePerson(request), deviceName, deviceType);
} catch (Exception e) {
result = new ActionResult<>();
Exception exception = new ExceptionSampleEntityClassFind(e, "设备解除绑定时发生异常!");
Exception exception = new IllegalArgumentException("设备解除绑定时发生异常!", e);
result.error(exception);
logger.error(e, this.effectivePerson(request), request, null);
}
......@@ -120,23 +120,23 @@ public class DeviceAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void removeBindNew(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("设备号") @PathParam("deviceName") String deviceName,
@JaxrsParameterDescribe("设备类型:android|ios") @PathParam("deviceType") String deviceType,
@JaxrsParameterDescribe("推送通道类型:jpush|huawei") @PathParam("pushType") String pushType) {
@JaxrsParameterDescribe("设备号") @PathParam("deviceName") String deviceName,
@JaxrsParameterDescribe("设备类型:android|ios") @PathParam("deviceType") String deviceType,
@JaxrsParameterDescribe("推送通道类型:jpush|huawei") @PathParam("pushType") String pushType) {
ActionResult<ActionRemoveBindNew.Wo> result = new ActionResult<>();
try {
result = new ActionRemoveBindNew().execute(request, this.effectivePerson(request), deviceName, deviceType, pushType);
result = new ActionRemoveBindNew().execute(request, this.effectivePerson(request), deviceName, deviceType,
pushType);
} catch (Exception e) {
result = new ActionResult<>();
Exception exception = new ExceptionSampleEntityClassFind(e, "设备解除绑定时发生异常!");
Exception exception = new IllegalArgumentException("设备解除绑定时发生异常!", e);
result.error(exception);
logger.error(e, this.effectivePerson(request), request, null);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "查询推送通道类型,jpush|huawei", action = ActionConfigPushType.class)
@GET
@Path("config/push/type")
......@@ -149,13 +149,11 @@ public class DeviceAction extends StandardJaxrsAction {
result = new ActionConfigPushType().execute(request, this.effectivePerson(request));
} catch (Exception e) {
result = new ActionResult<>();
Exception exception = new ExceptionSampleEntityClassFind(e, "查询推送通道类型发生异常!");
Exception exception = new IllegalArgumentException("查询推送通道类型发生异常!", e);
result.error(exception);
logger.error(e, this.effectivePerson(request), request, null);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
}
......@@ -74,7 +74,7 @@ public class ActionSendMessageTest extends StandardJaxrsAction {
.setAudience(Audience.registrationId(jiguangDeviceList))
.setNotification(Notification.alert(wi.getMessage()))
.setOptions(Options.newBuilder().setApnsProduction(true).build()).build();
PushResult pushResult = business.sampleEntityClassNameFactory().jpushClient().sendPush(pushPayload);
PushResult pushResult = business.pushDeviceFactory().jpushClient().sendPush(pushPayload);
logger.info("发送结果:{}.", pushResult);
wraps.setValue(true);
result.setData(wraps);
......
package com.x.jpush.assemble.control.jaxrs.sample;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.annotation.CheckRemoveType;
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.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.jpush.core.entity.SampleEntityClassName;
/**
* 信息数据删除服务
*
*/
public class ActionDelete extends BaseAction {
private static Logger logger = LoggerFactory.getLogger( ActionDelete.class );
protected ActionResult<Wo> execute( HttpServletRequest request, EffectivePerson effectivePerson, String id ) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
SampleEntityClassName sampleEntityClassName = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
sampleEntityClassName = emc.find( id, SampleEntityClassName.class );
if( sampleEntityClassName == null ){
Exception exception = new ExceptionSampleEntityClassNameNotExists( id );
result.error( exception );
}
} catch (Exception e) {
Exception exception = new ExceptionSampleEntityClassFind( e, "系统在根据ID查询指定示例数据记录时发生异常!ID=" + id );
result.error( exception );
logger.error(e);
}
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
//启动事务
emc.beginTransaction( SampleEntityClassName.class );
//删除对象
emc.remove( sampleEntityClassName, CheckRemoveType.all );
//提交事务
emc.commit();
result.setData( new Wo( id ));
} catch (Exception e) {
Exception exception = new ExceptionSampleEntityClassFind( e, "系统在根据ID查询指定示例数据记录时发生异常!ID=" + id );
result.error( exception );
logger.error(e);
}
return result;
}
public static class Wo extends WoId {
public Wo( String id ) {
setId( id );
}
}
}
\ No newline at end of file
package com.x.jpush.assemble.control.jaxrs.sample;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
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.jpush.core.entity.SampleEntityClassName;
public class ActionGet extends BaseAction {
private Logger logger = LoggerFactory.getLogger( ActionGet.class );
protected ActionResult<Wo> execute( HttpServletRequest request, EffectivePerson effectivePerson, String id ) throws Exception {
logger.info("execute action 'ActionGet'......");
ActionResult<Wo> result = new ActionResult<>();
Wo wrap = null;
//与数据库交互示例, 根据ID查询单条记录
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
SampleEntityClassName sampleEntityClassName = emc.find( id, SampleEntityClassName.class );
if( sampleEntityClassName != null ){
wrap = Wo.copier.copy( sampleEntityClassName );
result.setCount(1L);
result.setData( wrap );
}else {
Exception exception = new ExceptionSampleEntityClassNameNotExists( id );
result.error( exception );
}
} catch (Exception e) {
Exception exception = new ExceptionSampleEntityClassFind( e, "系统在根据ID查询指定示例数据记录时发生异常!ID=" + id );
result.error( exception );
logger.error(e);
}
logger.info("action 'ActionGet' execute completed!");
return result;
}
public static class Wo extends SampleEntityClassName {
private static final long serialVersionUID = -5076990764713538973L;
public static List<String> Excludes = new ArrayList<String>();
public static WrapCopier<SampleEntityClassName, Wo> copier = WrapCopierFactory.wo( SampleEntityClassName.class, Wo.class, null,Wo.Excludes);
}
}
\ No newline at end of file
package com.x.jpush.assemble.control.jaxrs.sample;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
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.base.core.project.tools.ListTools;
import com.x.jpush.assemble.control.Business;
import com.x.jpush.core.entity.SampleEntityClassName;
public class ActionListAll extends BaseAction {
private Logger logger = LoggerFactory.getLogger( ActionListAll.class );
protected ActionResult<List<Wo>> execute( HttpServletRequest request, EffectivePerson effectivePerson ) throws Exception {
logger.info("execute action 'ActionListAll'......");
ActionResult<List<Wo>> result = new ActionResult<>();
List<Wo> wraps = null;
//与数据库交互示例, 根据ID查询单条记录
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
//查询所有的数据,最大返回1000条,并且按数据更新时间倒序
List<SampleEntityClassName> allEntity = business.sampleEntityClassNameFactory().listAll( 1000 );
if( ListTools.isNotEmpty( allEntity ) ){
wraps = Wo.copier.copy( allEntity );
result.setCount(Long.parseLong( wraps.size() + "") );
result.setData( wraps );
}
} catch (Exception e) {
Exception exception = new ExceptionSampleEntityClassFind( e, "系统在查询所有示例数据记录时发生异常!" );
result.error( exception );
logger.error(e);
}
logger.info("action 'ActionListAll' execute completed!");
return result;
}
/**
*
* 向外输出的结果对象包装类
*
*/
public static class Wo extends SampleEntityClassName {
private static final long serialVersionUID = -5076990764713538973L;
public static List<String> Excludes = new ArrayList<String>();
public static WrapCopier<SampleEntityClassName, Wo> copier = WrapCopierFactory.wo( SampleEntityClassName.class, Wo.class, null,Wo.Excludes);
}
}
\ No newline at end of file
package com.x.jpush.assemble.control.jaxrs.sample;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import com.google.gson.JsonElement;
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.entity.annotation.CheckPersistType;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
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.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.jpush.core.entity.SampleEntityClassName;
/**
* 示例数据信息保存服务
*/
public class ActionSave extends BaseAction {
private static Logger logger = LoggerFactory.getLogger( ActionSave.class );
protected ActionResult<Wo> execute( HttpServletRequest request, EffectivePerson effectivePerson, JsonElement jsonElement ) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wi wi = null;
SampleEntityClassName sampleEntityClassName = null;
Boolean check = true;
try {
wi = this.convertToWrapIn( jsonElement, Wi.class );
} catch (Exception e) {
check = false;
Exception exception = new ExceptionSampleEntityClassProcess(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString());
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
if (check) {
if( StringUtils.isNotEmpty( wi.getName() )) {
check = false;
Exception exception = new ExceptionSampleEntityClassNameEmpty();
result.error(exception);
}
}
if (check) {
sampleEntityClassName = Wi.copier.copy( wi );
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
//启动事务
emc.beginTransaction( SampleEntityClassName.class );
//保存对象
emc.persist( sampleEntityClassName, CheckPersistType.all );
//提交事务
emc.commit();
} catch (Exception e) {
Exception exception = new ExceptionSampleEntityClassProcess( e, "系统在保存数据记录时发生异常!" );
result.error( exception );
logger.error(e);
}
}
return result;
}
/**
* 用于接受前端传入的对象型参数的帮助类
*
*/
public static class Wi {
public static WrapCopier<Wi, SampleEntityClassName> copier = WrapCopierFactory.wi( Wi.class, SampleEntityClassName.class, null, JpaObject.FieldsUnmodifyExcludeId );
@FieldDescribe("数据库主键,自动生成.")
private String id;
public void onPersist() throws Exception {
}
@FieldDescribe("示例字符串field")
private String name;
@FieldDescribe("示例时间field")
private Date date;
@FieldDescribe("示例整型数字field")
private Integer orderNumber;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public Integer getOrderNumber() {
return orderNumber;
}
public void setOrderNumber(Integer orderNumber) {
this.orderNumber = orderNumber;
}
}
/**
* 用于输出响应内容的帮助类
*
*/
public static class Wo extends WoId {
public Wo( String id ) {
setId( id );
}
}
}
\ No newline at end of file
package com.x.jpush.assemble.control.jaxrs.sample;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import com.google.gson.JsonElement;
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.entity.annotation.CheckPersistType;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
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.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.jpush.core.entity.SampleEntityClassName;
/**
* 示例数据信息更新服务
*/
public class ActionUpdate extends BaseAction {
private static Logger logger = LoggerFactory.getLogger( ActionUpdate.class );
protected ActionResult<Wo> execute( HttpServletRequest request, EffectivePerson effectivePerson, String id, JsonElement jsonElement ) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wi wi = null;
SampleEntityClassName sampleEntityClassName = null;
Boolean check = true;
//与数据库交互示例, 根据ID查询单条记录
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
sampleEntityClassName = emc.find( id, SampleEntityClassName.class );
if( sampleEntityClassName == null ){
Exception exception = new ExceptionSampleEntityClassNameNotExists( id );
result.error( exception );
}
} catch (Exception e) {
Exception exception = new ExceptionSampleEntityClassFind( e, "系统在根据ID查询指定示例数据记录时发生异常!ID=" + id );
result.error( exception );
logger.error(e);
}
try {
wi = this.convertToWrapIn( jsonElement, Wi.class );
} catch (Exception e) {
check = false;
Exception exception = new ExceptionSampleEntityClassProcess(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString());
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
if (check) {
if( StringUtils.isNotEmpty( wi.getName() )) {
check = false;
Exception exception = new ExceptionSampleEntityClassNameEmpty();
result.error(exception);
}
}
if (check) {
Wi.copier.copy( wi ).copyTo( sampleEntityClassName, JpaObject.FieldsUnmodify );
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
//启动事务
emc.beginTransaction( SampleEntityClassName.class );
//保存对象
emc.check( sampleEntityClassName, CheckPersistType.all );
//提交事务
emc.commit();
} catch (Exception e) {
Exception exception = new ExceptionSampleEntityClassProcess( e, "系统在保存数据记录时发生异常!" );
result.error( exception );
logger.error(e);
}
}
return result;
}
/**
* 用于接受前端传入的对象型参数的帮助类
*
*/
public static class Wi {
public static WrapCopier<Wi, SampleEntityClassName> copier = WrapCopierFactory.wi( Wi.class, SampleEntityClassName.class, null, JpaObject.FieldsUnmodifyExcludeId );
@FieldDescribe("数据库主键,自动生成.")
private String id;
public void onPersist() throws Exception {
}
@FieldDescribe("示例字符串field")
private String name;
@FieldDescribe("示例时间field")
private Date date;
@FieldDescribe("示例整型数字field")
private Integer orderNumber;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public Integer getOrderNumber() {
return orderNumber;
}
public void setOrderNumber(Integer orderNumber) {
this.orderNumber = orderNumber;
}
}
/**
* 用于输出响应内容的帮助类
*
*/
public static class Wo extends WoId {
public Wo( String id ) {
setId( id );
}
}
}
\ No newline at end of file
package com.x.jpush.assemble.control.jaxrs.sample;
import com.x.base.core.project.exception.PromptException;
public class ExceptionSampleEntityClassFind extends PromptException {
private static final long serialVersionUID = 1859164370743532895L;
public ExceptionSampleEntityClassFind( Throwable e, String message ) {
super("用户在进行设置信息处理时发生异常!message:" + message, e );
}
}
package com.x.jpush.assemble.control.jaxrs.sample;
import com.x.base.core.project.exception.PromptException;
public class ExceptionSampleEntityClassNameEmpty extends PromptException {
private static final long serialVersionUID = 1859164370743532895L;
public ExceptionSampleEntityClassNameEmpty() {
super("保存操作传入的参数name为空,无法进行保存操作.");
}
}
package com.x.jpush.assemble.control.jaxrs.sample;
import com.x.base.core.project.exception.PromptException;
public class ExceptionSampleEntityClassNameNotExists extends PromptException {
private static final long serialVersionUID = 1859164370743532895L;
public ExceptionSampleEntityClassNameNotExists( String id ) {
super("指定的示例信息不存在.ID:" + id );
}
}
package com.x.jpush.assemble.control.jaxrs.sample;
import com.x.base.core.project.exception.PromptException;
public class ExceptionSampleEntityClassProcess extends PromptException {
private static final long serialVersionUID = 1859164370743532895L;
public ExceptionSampleEntityClassProcess( Throwable e, String message ) {
super("用户在进行设置信息处理时发生异常!message:" + message, e );
}
}
package com.x.jpush.assemble.control.jaxrs.sample;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.container.AsyncResponse;
import javax.ws.rs.container.Suspended;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import com.google.gson.JsonElement;
import com.x.base.core.project.annotation.JaxrsDescribe;
import com.x.base.core.project.annotation.JaxrsMethodDescribe;
import com.x.base.core.project.annotation.JaxrsParameterDescribe;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.HttpMediaType;
import com.x.base.core.project.jaxrs.ResponseFactory;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
@Path("sample")
@JaxrsDescribe("示例-信息管理服务")
public class SampleEntityClassNameAction extends StandardJaxrsAction {
private static Logger logger = LoggerFactory.getLogger(SampleEntityClassNameAction.class);
@JaxrsMethodDescribe(value = "根据ID获取示例-信息", action = ActionGet.class)
@GET
@Path("{id}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("示例-信息ID") @PathParam("id") String id) {
ActionResult<ActionGet.Wo> result = new ActionResult<>();
try {
result = new ActionGet().execute(request, this.effectivePerson(request), id);
} catch (Exception e) {
result = new ActionResult<>();
Exception exception = new ExceptionSampleEntityClassFind(e, "根据ID获取示例-信息时发生异常!");
result.error(exception);
logger.error(e, this.effectivePerson(request), request, null);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "获取所有的示例-信息", action = ActionListAll.class)
@GET
@Path("all")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listAll(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
ActionResult<List<ActionListAll.Wo>> result = new ActionResult<>();
Boolean check = true;
if (check) {
try {
result = new ActionListAll().execute(request, this.effectivePerson(request));
} catch (Exception e) {
result = new ActionResult<>();
Exception exception = new ExceptionSampleEntityClassFind(e, "根据ID获取示例-信息时发生异常!");
result.error(exception);
logger.error(e, this.effectivePerson(request), request, null);
}
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "更新新示例-信息", action = ActionUpdate.class)
@PUT
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void save(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("需要更新的-信息ID") @PathParam("id") String id,
@JaxrsParameterDescribe("需要更新的信息") JsonElement jsonElement) {
ActionResult<ActionUpdate.Wo> result = new ActionResult<>();
Boolean check = true;
if (check) {
try {
result = new ActionUpdate().execute(request, this.effectivePerson(request), id, jsonElement);
} catch (Exception e) {
result = new ActionResult<>();
Exception exception = new ExceptionSampleEntityClassFind(e, "新建或者更新示例-信息时发生异常!");
result.error(exception);
logger.error(e, this.effectivePerson(request), request, null);
}
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "创建新示例-信息", action = ActionSave.class)
@POST
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void save(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("需要保存的信息") JsonElement jsonElement) {
ActionResult<ActionSave.Wo> result = new ActionResult<>();
Boolean check = true;
if (check) {
try {
result = new ActionSave().execute(request, this.effectivePerson(request), jsonElement);
} catch (Exception e) {
result = new ActionResult<>();
Exception exception = new ExceptionSampleEntityClassFind(e, "新建或者更新示例-信息时发生异常!");
result.error(exception);
logger.error(e, this.effectivePerson(request), request, null);
}
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "根据标识ID删除信息.", action = ActionDelete.class)
@DELETE
@Path("{id}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void delete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("需要删除的数据ID") @PathParam("id") String id) {
ActionResult<ActionDelete.Wo> result = new ActionResult<>();
try {
result = new ActionDelete().execute(request, this.effectivePerson(request), id);
} catch (Exception e) {
logger.error(e, this.effectivePerson(request), request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
}
\ No newline at end of file
......@@ -3,10 +3,6 @@ package com.x.jpush.core.entity;
import com.x.base.core.entity.AbstractPersistenceProperties;
public final class PersistenceProperties extends AbstractPersistenceProperties {
public static class SampleEntityClassName {
public static final String table = "SAMPLE_JPUSH_TABLENAME";
}
public static class PushDevice {
public static final String table = "JPUSH_DEVICE";
......
......@@ -16,12 +16,14 @@ import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* Created by fancyLou on 9/13/21.
* Copyright © 2021 O2. All rights reserved.
*/
@Schema(name = "PushDevice", description = "消息推送设备.")
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.PushDevice.table, uniqueConstraints = {
......
package com.x.jpush.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.Temporal;
import javax.persistence.TemporalType;
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;
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.SampleEntityClassName.table, uniqueConstraints = {
@UniqueConstraint(name = PersistenceProperties.SampleEntityClassName.table + JpaObject.IndexNameMiddle
+ JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN,
JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) })
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class SampleEntityClassName extends SliceJpaObject {
private static final long serialVersionUID = 1325197931747463979L;
private static final String TABLE = PersistenceProperties.SampleEntityClassName.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 默认字段
* =============================================================================
* =====
*/
/*
* =============================================================================
* ===== 以下为具体不同的业务及数据表字段要求
* =============================================================================
* =====
*/
@FieldDescribe("示例字符串field")
@Index(name = TABLE + "_name")
@Column(name = "xname", length = JpaObject.length_255B)
@CheckPersist(allowEmpty = false)
private String name;
@FieldDescribe("示例时间field")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "xdate")
private Date date;
@FieldDescribe("示例整型数字field")
@Column(name = "xorderNumber")
@CheckPersist(allowEmpty = false)
private Integer orderNumber;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public Integer getOrderNumber() {
return orderNumber;
}
public void setOrderNumber(Integer orderNumber) {
this.orderNumber = orderNumber;
}
}
\ No newline at end of file
......@@ -23,6 +23,9 @@ import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Attachment", description = "会议管理附件.")
@ContainerEntity(dumpSize = 5, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.Attachment.table, uniqueConstraints = {
......
......@@ -20,6 +20,9 @@ import com.x.base.core.entity.annotation.CitationNotExist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Building", description = "会议管理建筑.")
@Entity
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Building.table, uniqueConstraints = {
......
......@@ -37,6 +37,9 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.annotation.FieldTypeDescribe;
import com.x.base.core.project.tools.ListTools;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Meeting", description = "会议管理会议.")
@Entity
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Meeting.table, uniqueConstraints = {
......
......@@ -23,6 +23,9 @@ import com.x.base.core.entity.annotation.CitationNotExist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Room", description = "会议管理会议室.")
@Entity
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Room.table, uniqueConstraints = {
......
......@@ -27,10 +27,13 @@ import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 聊天 会话对象
*/
@Schema(name = "IMConversation", description = "消息聊天.")
@Entity
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.IMConversation.table, uniqueConstraints = {
......
......@@ -16,10 +16,13 @@ import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 会话的扩展对象 每个人一个,保存当前用户的会话扩展属性
*/
@Schema(name = "IMConversation", description = "消息会话扩展.")
@Entity
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.IMConversationExt.table, uniqueConstraints = {
......
......@@ -17,9 +17,12 @@ import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 会话消息
*/
@Schema(name = "IMMsg", description = "消息会话消息.")
@Entity
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.IMMsg.table, uniqueConstraints = {
......
......@@ -22,12 +22,14 @@ import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.DateTools;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* Created by fancyLou on 2020-06-15.
* Copyright © 2020 O2. All rights reserved.
*/
@Schema(name = "IMMsgFile", description = "消息会话文件.")
@ContainerEntity(dumpSize = 5, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.IMMsgFile.table, uniqueConstraints = {
......
......@@ -26,6 +26,9 @@ import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Instant", description = "消息实例.")
@Entity
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.log, reference = ContainerEntity.Reference.soft)
@Table(name = PersistenceProperties.Instant.table, uniqueConstraints = {
......
......@@ -26,6 +26,9 @@ import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Mass", description = "消息群发.")
@Entity
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Mass.table, uniqueConstraints = {
......
......@@ -17,10 +17,13 @@ import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.openjpa.persistence.Persistent;
import org.apache.openjpa.persistence.jdbc.Index;
import org.apache.openjpa.persistence.jdbc.Strategy;
@Schema(name = "Message", description = "消息消息对象.")
@Entity
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.log, reference = ContainerEntity.Reference.soft)
@Table(name = PersistenceProperties.Message.table, uniqueConstraints = {
......
......@@ -17,6 +17,9 @@ import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Org", description = "消息组织.")
@Entity
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Org.table, uniqueConstraints = {
......@@ -24,20 +27,18 @@ import com.x.base.core.project.annotation.FieldDescribe;
+ JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN,
JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) })
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Org extends SliceJpaObject{
public class Org extends SliceJpaObject {
/**
*
*/
private static final long serialVersionUID = -5626959472585823064L;
private static final String TABLE = PersistenceProperties.Org.table;
@FieldDescribe("数据库主键,自动生成.")
@Id
@Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME)
private String id = createId();
@Override
public void onPersist() throws Exception {
// TODO Auto-generated method stub
......@@ -53,57 +54,56 @@ public class Org extends SliceJpaObject{
this.id = id;
}
/* 以上为 JpaObject 默认字段 */
public static final String operType_FIELDNAME = "operType";
@FieldDescribe("操作类型(add|modify|delete)")
@Column(length = length_32B, name = ColumnNamePrefix + operType_FIELDNAME)
//@Index(name = TABLE + IndexNameMiddle + operType_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + operType_FIELDNAME)
@CheckPersist(allowEmpty = false)
private String operType;
public static final String orgType_FIELDNAME = "orgType";
@FieldDescribe("数据类型(person(个人)|unit(部门)|group(群组)|identity(身份)|role(角色)|duty(职务))")
@Column(length = length_32B, name = ColumnNamePrefix + orgType_FIELDNAME)
//@Index(name = TABLE + IndexNameMiddle + orgType_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + orgType_FIELDNAME)
@CheckPersist(allowEmpty = false)
private String orgType;
private String orgType;
public static final String operUerId_FIELDNAME = "operUerId";
@FieldDescribe("数据操作者")
@Column(length = length_96B, name = ColumnNamePrefix + operUerId_FIELDNAME)
//@Index(name = TABLE + IndexNameMiddle + operUerId_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + operUerId_FIELDNAME)
@CheckPersist(allowEmpty = false)
private String operUerId;
private String operUerId;
public static final String operDataId_FIELDNAME = "operDataId";
@FieldDescribe("数据id")
@Column(length = length_96B, name = ColumnNamePrefix + operDataId_FIELDNAME)
//@Index(name = TABLE + IndexNameMiddle + operDataId_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + operDataId_FIELDNAME)
@CheckPersist(allowEmpty = false)
private String operDataId;
public static final String receiveSystem_FIELDNAME = "receiveSystem";
@FieldDescribe("接收系统(authority(权限)|third(第三方系统))")
@Column(length = length_255B, name = ColumnNamePrefix + receiveSystem_FIELDNAME)
//@Index(name = TABLE + IndexNameMiddle + receiveSystem_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + receiveSystem_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String receiveSystem;
public static final String consumed_FIELDNAME = "consumed";
@FieldDescribe("是否消费(true|false)")
@Column( name = ColumnNamePrefix + consumed_FIELDNAME)
//@Index(name = TABLE + IndexNameMiddle + consumed_FIELDNAME)
@Column(name = ColumnNamePrefix + consumed_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + consumed_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Boolean consumed;
public static final String consumedModule_FIELDNAME = "consumedModule";
@FieldDescribe("已消费模块[ CMS|Teamwork|各模块名]")
@Column(length = length_255B, name = ColumnNamePrefix + consumedModule_FIELDNAME)
//@Index(name = TABLE + IndexNameMiddle + consumedModule_FIELDNAME)
// @Index(name = TABLE + IndexNameMiddle + consumedModule_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String consumedModule;
public static final String body_FIELDNAME = "body";
@FieldDescribe("内容.")
@Lob
......@@ -175,6 +175,4 @@ public class Org extends SliceJpaObject{
this.body = body;
}
}
......@@ -28,11 +28,14 @@ import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.DateTools;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 脑图信息表
*
* @author O2LEE
*/
@Schema(name = "MindBaseInfo", description = "脑图信息.")
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.MindBaseInfo.table, uniqueConstraints = {
......
......@@ -17,11 +17,15 @@ import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 脑图内容信息表
*
* @author O2LEE
*/
@Schema(name = "MindContentInfo", description = "脑图内容信息.")
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.MindContentInfo.table, uniqueConstraints = {
......
......@@ -16,11 +16,14 @@ import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 脑图文件夹(分类)信息表
*
* @author O2LEE
*/
@Schema(name = "MindFolderInfo", description = "脑图文件夹.")
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.MindFolderInfo.table, uniqueConstraints = {
......
......@@ -17,11 +17,14 @@ import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 脑图图标信息表
*
* @author O2LEE
*/
@Schema(name = "MindIconInfo", description = "脑图图标信息.")
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.MindIconInfo.table, uniqueConstraints = {
......
......@@ -22,11 +22,14 @@ import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.DateTools;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 脑图回收站信息表
*
* @author O2LEE
*/
@Schema(name = "MindRecycleInfo", description = "脑图回收站信息.")
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.MindRecycleInfo.table, uniqueConstraints = {
......
......@@ -16,11 +16,14 @@ import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 共享文件记录信息表
*
* @author O2LEE
*/
@Schema(name = "MindShareRecord", description = "脑图共享文件记录信息.")
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.MindShareRecord.table, uniqueConstraints = {
......
......@@ -17,11 +17,14 @@ import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 其他版本脑图内容信息表
*
* @author O2LEE
*/
@Schema(name = "MindVersionContent", description = "脑图版本内容信息.")
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.MindVersionContent.table, uniqueConstraints = {
......
......@@ -20,11 +20,14 @@ import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.DateTools;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 脑图版本信息表
*
* @author O2LEE
*/
@Schema(name = "MindVersionInfo", description = "脑图版本信息.")
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.MindVersionInfo.table, uniqueConstraints = {
......
......@@ -16,6 +16,9 @@ import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Bind", description = "组织绑定信息.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Bind.table, uniqueConstraints = {
......
......@@ -22,6 +22,9 @@ 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 io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Definition", description = "组织定义内容.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Definition.table, uniqueConstraints = {
......
......@@ -33,6 +33,9 @@ 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 io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Group", description = "组织群组.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Group.table, uniqueConstraints = {
......@@ -136,8 +139,9 @@ public class Group extends SliceJpaObject {
@FieldDescribe("群组的个人成员.存放个人 ID.")
@PersistentCollection(fetch = FetchType.EAGER)
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ContainerTable(name = TABLE + ContainerTableNameMiddle + personList_FIELDNAME, joinIndex = @Index(name = TABLE
+ IndexNameMiddle + personList_FIELDNAME + JoinIndexNameSuffix))
@ContainerTable(name = TABLE + ContainerTableNameMiddle
+ personList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle + personList_FIELDNAME
+ JoinIndexNameSuffix))
@ElementColumn(length = JpaObject.length_id, name = ColumnNamePrefix + personList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + personList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true, citationExists = @CitationExist(type = Person.class))
......@@ -145,8 +149,9 @@ public class Group extends SliceJpaObject {
public static final String groupList_FIELDNAME = "groupList";
@FieldDescribe("群组的群组成员.存放群组 ID.")
@ContainerTable(name = TABLE + ContainerTableNameMiddle + groupList_FIELDNAME, joinIndex = @Index(name = TABLE
+ IndexNameMiddle + groupList_FIELDNAME + JoinIndexNameSuffix))
@ContainerTable(name = TABLE + ContainerTableNameMiddle
+ groupList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle + groupList_FIELDNAME
+ JoinIndexNameSuffix))
@ElementIndex(name = TABLE + IndexNameMiddle + groupList_FIELDNAME + ElementIndexNameSuffix)
@PersistentCollection(fetch = FetchType.EAGER)
@OrderColumn(name = ORDERCOLUMNCOLUMN)
......@@ -156,8 +161,9 @@ public class Group extends SliceJpaObject {
public static final String unitList_FIELDNAME = "unitList";
@FieldDescribe("群组存放组织成员,存放unit ID.")
@ContainerTable(name = TABLE + ContainerTableNameMiddle + unitList_FIELDNAME, joinIndex = @Index(name = TABLE
+ IndexNameMiddle + unitList_FIELDNAME + JoinIndexNameSuffix))
@ContainerTable(name = TABLE + ContainerTableNameMiddle
+ unitList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle + unitList_FIELDNAME
+ JoinIndexNameSuffix))
@ElementIndex(name = TABLE + IndexNameMiddle + unitList_FIELDNAME + ElementIndexNameSuffix)
@PersistentCollection(fetch = FetchType.EAGER)
@OrderColumn(name = ORDERCOLUMNCOLUMN)
......@@ -167,8 +173,9 @@ public class Group extends SliceJpaObject {
public static final String identityList_FIELDNAME = "identityList";
@FieldDescribe("群组存放身份成员,identity ID.")
@ContainerTable(name = TABLE + ContainerTableNameMiddle + identityList_FIELDNAME, joinIndex = @Index(name = TABLE
+ IndexNameMiddle + identityList_FIELDNAME + JoinIndexNameSuffix))
@ContainerTable(name = TABLE + ContainerTableNameMiddle
+ identityList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle + identityList_FIELDNAME
+ JoinIndexNameSuffix))
@ElementIndex(name = TABLE + IndexNameMiddle + identityList_FIELDNAME + ElementIndexNameSuffix)
@PersistentCollection(fetch = FetchType.EAGER)
@OrderColumn(name = ORDERCOLUMNCOLUMN)
......
......@@ -27,6 +27,9 @@ 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 io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Identity", description = "组织身份.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Identity.table, uniqueConstraints = {
......
......@@ -17,6 +17,9 @@ import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.StringTools;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "OauthCode", description = "组织Oauth码.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.OauthCode.table, uniqueConstraints = {
......
......@@ -25,6 +25,9 @@ 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 io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "PermissionSetting", description = "组织权限设定.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.PermissionSetting.table, uniqueConstraints = {
......
......@@ -44,6 +44,9 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.DateTools;
import com.x.base.core.project.tools.StringTools;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Person", description = "组织人员.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Person.table, uniqueConstraints = {
......
......@@ -32,6 +32,9 @@ 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 io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "PersonAttribute", description = "组织人员属性.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.PersonAttribute.table, uniqueConstraints = {
......
......@@ -25,6 +25,8 @@ import com.x.base.core.entity.type.GenderType;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.DateTools;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "PersonCard", description = "组织人员名片.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.PersonCard.table, uniqueConstraints = {
......
......@@ -34,6 +34,9 @@ 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 io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Unit", description = "组织组织对象.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Unit.table, uniqueConstraints = {
......
......@@ -32,6 +32,9 @@ 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 io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Unit", description = "组织组织对象属性.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.UnitAttribute.table, uniqueConstraints = {
......
......@@ -32,6 +32,9 @@ 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 io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "UnitDuty", description = "组织组织职务.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.UnitDuty.table, uniqueConstraints = {
......
......@@ -22,6 +22,9 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.StringTools;
import com.x.organization.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "EmpowerLog", description = "组织授权日志.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Accredit.EmpowerLog.table, uniqueConstraints = {
......
......@@ -28,6 +28,9 @@ import com.x.base.core.entity.annotation.IdReference;
import com.x.base.core.entity.annotation.RestrictFlag;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "File", description = "门户文件.")
@Entity
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.File.table, uniqueConstraints = {
......
......@@ -27,6 +27,9 @@ import com.x.base.core.entity.annotation.IdReference;
import com.x.base.core.entity.annotation.RestrictFlag;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "File", description = "门户页面.")
@Entity
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Page.table, uniqueConstraints = {
......
......@@ -30,10 +30,13 @@ 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 io.swagger.v3.oas.annotations.media.Schema;
/**
* 门户平台应用
* @author sword
*/
@Schema(name = "Portal", description = "门户门户.")
@Entity
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Portal.table, uniqueConstraints = {
......
......@@ -32,6 +32,9 @@ import com.x.base.core.entity.annotation.IdReference;
import com.x.base.core.entity.annotation.RestrictFlag;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Portal", description = "门户脚本.")
@Entity
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Script.table, uniqueConstraints = {
......
......@@ -28,6 +28,9 @@ import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "TemplatePage", description = "门户页面模板.")
@Entity
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.TemplatePage.table, uniqueConstraints = {
......
......@@ -25,6 +25,10 @@ import com.x.base.core.entity.annotation.IdReference;
import com.x.base.core.entity.annotation.RestrictFlag;
import com.x.base.core.project.annotation.FieldDescribe;
import io.swagger.v3.oas.annotations.media.Schema;
@Deprecated(forRemoval = true)
@Schema(name = "Widget", description = "门户组件.")
@Entity
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Widget.table, uniqueConstraints = {
......
......@@ -38,6 +38,9 @@ import com.x.base.core.project.tools.DateTools;
import com.x.processplatform.core.entity.PersistenceProperties;
import com.x.processplatform.core.entity.element.ActivityType;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Attachment", description = "流程平台附件.")
@ContainerEntity(dumpSize = 5, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.Content.Attachment.table, uniqueConstraints = {
......
......@@ -26,10 +26,14 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.StringTools;
import com.x.processplatform.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 签批信息
* @author sword
*/
@Schema(name = "DocSign", description = "流程平台签名信息.")
@Entity
@ContainerEntity(dumpSize = 5, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Content.DocSign.table, uniqueConstraints = {
......
......@@ -29,11 +29,14 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.DateTools;
import com.x.processplatform.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 签批涂鸦信息
*
* @author sword
*/
@Schema(name = "DocSign", description = "流程平台签名信息.")
@Entity
@ContainerEntity(dumpSize = 5, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Content.DocSignScrawl.table, uniqueConstraints = {
......
......@@ -23,6 +23,9 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.processplatform.core.entity.PersistenceProperties;
import com.x.processplatform.core.entity.element.ActivityType;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "DocSignScrawl", description = "流程平台批注.")
@Entity
@ContainerEntity(dumpSize = 5, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Content.DocumentVersion.table, uniqueConstraints = {
......
......@@ -22,6 +22,9 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.StringTools;
import com.x.processplatform.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Draft", description = "流程平台草稿.")
@Entity
@ContainerEntity(dumpSize = 5, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Content.Draft.table, uniqueConstraints = {
......
......@@ -33,6 +33,9 @@ import com.x.base.core.project.tools.StringTools;
import com.x.processplatform.core.entity.PersistenceProperties;
import com.x.processplatform.core.entity.element.ActivityType;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Read", description = "流程平台待阅.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Content.Read.table, uniqueConstraints = {
......
......@@ -33,12 +33,16 @@ import com.x.base.core.project.tools.StringTools;
import com.x.processplatform.core.entity.PersistenceProperties;
import com.x.processplatform.core.entity.element.ActivityType;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* 没有多值字段
*
* @author zhour
*
*/
@Schema(name = "ReadCompleted", description = "流程平台已阅.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Content.ReadCompleted.table, uniqueConstraints = {
......
......@@ -29,6 +29,9 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.processplatform.core.entity.PersistenceProperties;
import com.x.processplatform.core.entity.element.ActivityType;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Record", description = "流程平台记录.")
@Entity
@ContainerEntity(dumpSize = 100, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Content.Record.table, uniqueConstraints = {
......
......@@ -28,6 +28,9 @@ import com.x.base.core.project.tools.DateTools;
import com.x.base.core.project.tools.StringTools;
import com.x.processplatform.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Record", description = "流程平台参阅.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Content.Review.table, uniqueConstraints = {
......
......@@ -19,6 +19,9 @@ import com.x.base.core.entity.annotation.Equal;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.processplatform.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "SerialNumber", description = "流程平台文号.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Content.SerialNumber.table, uniqueConstraints = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册