mirror of
https://github.com/getrebuild/rebuild.git
synced 2024-09-20 07:25:54 +08:00
lint
This commit is contained in:
parent
7b4ab64306
commit
cd6706b62a
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "rebuild-eslint",
|
||||
"name": "rebuild-lint",
|
||||
"version": "1.0.0",
|
||||
"description": "rebuild js/jsx lint",
|
||||
"author": "rebuild",
|
||||
|
@ -9,7 +9,7 @@
|
|||
"url": "https://github.com/getrebuild/rebuild.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --ext .jsx,.js ./src/main/webapp/assets/js"
|
||||
"lint": "eslint --ext .jsx,.js ./src/main/webapp/assets/js &"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-eslint": "^10.1.0",
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -127,7 +127,7 @@
|
|||
<dependency>
|
||||
<groupId>com.github.devezhao</groupId>
|
||||
<artifactId>persist4j</artifactId>
|
||||
<version>4aec003cc9</version>
|
||||
<version>1f3796ffc6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
|
|
@ -83,6 +83,33 @@ public class EasyMeta implements BaseMeta {
|
|||
return baseMeta.getExtraAttrs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCreatable() {
|
||||
return baseMeta.isCreatable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUpdatable() {
|
||||
if (isField()) {
|
||||
if (!baseMeta.isUpdatable()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Field field = (Field) baseMeta;
|
||||
Set<String> set = RobotTriggerManager.instance.getAutoReadonlyFields(field.getOwnEntity().getName());
|
||||
return !set.contains(field.getName());
|
||||
}
|
||||
|
||||
return baseMeta.isUpdatable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isQueryable() {
|
||||
return baseMeta.isQueryable();
|
||||
}
|
||||
|
||||
// --
|
||||
|
||||
/**
|
||||
* also #getDescription()
|
||||
* @return
|
||||
|
@ -226,24 +253,6 @@ public class EasyMeta implements BaseMeta {
|
|||
return getFieldExtConfig().get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 此方法除了判断元数据,还会判断其他业务规则
|
||||
*
|
||||
* @return
|
||||
* @see Field#isUpdatable()
|
||||
* @see RobotTriggerManager#getAutoReadonlyFields(String)
|
||||
*/
|
||||
public boolean isUpdatable() {
|
||||
Assert.isTrue(isField(), "Field supports only");
|
||||
final Field field = (Field) baseMeta;
|
||||
if (!field.isUpdatable()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Set<String> set = RobotTriggerManager.instance.getAutoReadonlyFields(field.getOwnEntity().getName());
|
||||
return !set.contains(field.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定实体具有和业务实体一样的特性(除权限以外(指定实体无权限字段))。
|
||||
* @return
|
||||
|
|
|
@ -282,7 +282,7 @@ public class Field2Schema {
|
|||
recordOfField = Application.getCommonService().create(recordOfField);
|
||||
tempMetaId.add(recordOfField.getPrimary());
|
||||
|
||||
// 此处会改变一些属性,因为并不想他们同步到数据库 SCHEMA
|
||||
// 此处会改变一些属性,因为并不想他们同步到数据库
|
||||
|
||||
boolean autoValue = EntityHelper.AutoId.equalsIgnoreCase(fieldName);
|
||||
if (EntityHelper.ApprovalState.equalsIgnoreCase(fieldName)) {
|
||||
|
@ -290,16 +290,16 @@ public class Field2Schema {
|
|||
}
|
||||
|
||||
// 系统级字段非空
|
||||
if (MetadataHelper.isCommonsField(fieldName)
|
||||
&& !(MetadataHelper.isApprovalField(fieldName) || fieldName.equalsIgnoreCase(EntityHelper.QuickCode))) {
|
||||
nullable = false;
|
||||
} else {
|
||||
nullable = true;
|
||||
}
|
||||
if (MetadataHelper.isCommonsField(fieldName)
|
||||
&& !(MetadataHelper.isApprovalField(fieldName) || fieldName.equalsIgnoreCase(EntityHelper.QuickCode))) {
|
||||
nullable = false;
|
||||
} else {
|
||||
nullable = true;
|
||||
}
|
||||
|
||||
Field unsafeField = new FieldImpl(
|
||||
fieldName, physicalName, fieldLabel, entity, dt.getFieldType(), CascadeModel.Ignore, maxLength,
|
||||
nullable, creatable, updatable, repeatable, DECIMAL_SCALE, defaultValue, autoValue);
|
||||
Field unsafeField = new FieldImpl(fieldName, physicalName, fieldLabel, null,
|
||||
creatable, updatable, Boolean.TRUE, entity, dt.getFieldType(), maxLength, CascadeModel.Ignore,
|
||||
nullable, repeatable, autoValue, DECIMAL_SCALE, defaultValue);
|
||||
if (entity instanceof UnsafeEntity) {
|
||||
((UnsafeEntity) entity).addField(unsafeField);
|
||||
}
|
||||
|
|
|
@ -29,8 +29,9 @@ import cn.devezhao.persist4j.metadata.impl.EntityImpl;
|
|||
public class UnsafeEntity extends EntityImpl {
|
||||
private static final long serialVersionUID = 2107073554299141281L;
|
||||
|
||||
protected UnsafeEntity(String entityName, String physicalName, String entityLabel, int typeCode, String nameField) {
|
||||
super(entityName, physicalName, entityLabel, typeCode, nameField);
|
||||
protected UnsafeEntity(String entityName, String physicalName, String entityLabel, int typeCode, String nameFieldName) {
|
||||
super(entityName, physicalName, entityLabel, null,
|
||||
Boolean.TRUE, Boolean.TRUE, Boolean.TRUE, typeCode, nameFieldName, Boolean.TRUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue