Browse Source

KERNEL-11531 修改下设计,ColoneCollector中触发clone()

newui
Henry.Wang 2 years ago
parent
commit
3d43b76218
  1. 20
      designer-base/src/main/java/com/fr/design/mainframe/authority/AuthorityTargetObjectCollector.java
  2. 14
      designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java

20
designer-base/src/main/java/com/fr/design/mainframe/authority/AuthorityTargetObjectCollector.java

@ -1,6 +1,11 @@
package com.fr.design.mainframe.authority; package com.fr.design.mainframe.authority;
import com.fr.base.CloneCollector; import com.fr.base.CloneCollector;
import com.fr.base.Formula;
import com.fr.data.impl.NameDatabaseConnection;
import com.fr.data.impl.NameTableData;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.stable.FCloneable;
import java.util.ArrayList; import java.util.ArrayList;
@ -9,12 +14,23 @@ import java.util.List;
public class AuthorityTargetObjectCollector extends CloneCollector { public class AuthorityTargetObjectCollector extends CloneCollector {
List<Object> targetObject = new ArrayList<>(); List<Object> targetObject = new ArrayList<>();
public AuthorityTargetObjectCollector(FCloneable rootObject) {
super(rootObject);
}
@Override @Override
public void collect(Object object) { public void collect(Object object) {
targetObject.add(object); if (object instanceof DSColumn || object instanceof Formula
|| object instanceof NameDatabaseConnection || object instanceof NameTableData) {
targetObject.add(object);
}
} }
public List<Object> getTargetObject() { public List<Object> collectTargetObject() {
CloneCollector.setCollector(this);
this.targetObject = new ArrayList<>();
this.collect();
CloneCollector.clearCollector();
return targetObject; return targetObject;
} }

14
designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java

@ -15,6 +15,7 @@ import com.fr.workspace.WorkContext;
import com.fr.workspace.server.authority.user.UserAuthority; import com.fr.workspace.server.authority.user.UserAuthority;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@ -101,15 +102,14 @@ public class JTemplateAuthorityChecker {
} }
private List<Object> getTargetObjects() { private List<Object> getTargetObjects() {
AuthorityTargetObjectCollector authorityTargetObjectCollector = new AuthorityTargetObjectCollector(); List<Object> targetObjects = new ArrayList<>();
CloneCollector.setCollector(authorityTargetObjectCollector);
try { try {
jTemplate.getTarget().clone(); AuthorityTargetObjectCollector authorityTargetObjectCollector
} catch (Exception ignore) { = new AuthorityTargetObjectCollector(jTemplate.getTarget());
targetObjects = authorityTargetObjectCollector.collectTargetObject();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
} }
List<Object> targetObjects = authorityTargetObjectCollector.getTargetObject();
CloneCollector.clearCollector();
return targetObjects; return targetObjects;
} }

Loading…
Cancel
Save