Compare f82e322 ... +0 ... 199e4af

Coverage Reach
server/service/base/GeneralEntityService.java server/service/base/ApprovalStepService.java server/service/base/QuickCodeReindexTask.java server/service/base/AttachmentAwareObserver.java server/service/base/RecordMerger.java server/service/base/RevisionHistoryObserver.java server/service/base/BulkBacthUpdate.java server/service/base/BulkContext.java server/service/base/BulkShare.java server/service/base/BulkAssign.java server/service/base/BulkOperator.java server/service/base/SeriesReindexTask.java server/service/base/AttachmentFolderService.java server/service/base/RedisQueueObserver.java server/service/base/BulkDelete.java server/service/base/BulkUnshare.java server/service/bizz/privileges/UserStore.java server/service/bizz/privileges/PrivilegesManager.java server/service/bizz/privileges/PrivilegesGuardInterceptor.java server/service/bizz/privileges/RoleBaseQueryFilter.java server/service/bizz/privileges/User.java server/service/bizz/privileges/Department.java server/service/bizz/privileges/ZeroEntry.java server/service/bizz/privileges/ZeroPrivileges.java server/service/bizz/privileges/ZeroPermission.java server/service/bizz/UserService.java server/service/bizz/RoleService.java server/service/bizz/TeamService.java server/service/bizz/DepartmentService.java server/service/bizz/ChangeOwningDeptTask.java server/service/bizz/CurrentCaller.java server/service/query/AdvFilterParser.java server/service/query/ParserTokens.java server/service/query/QueryFactory.java server/service/configuration/ClassificationService.java server/service/configuration/PickListService.java server/service/configuration/ProjectConfigService.java server/service/configuration/RobotApprovalConfigService.java server/service/configuration/ConfigurationService.java server/service/configuration/ProjectPlanConfigService.java server/service/configuration/AutoFillinConfigService.java server/service/configuration/DataReportConfigService.java server/service/configuration/RobotTriggerConfigService.java server/service/configuration/RebuildApiService.java server/service/configuration/AdvFilterService.java server/service/configuration/ChartConfigService.java server/service/configuration/DashboardConfigService.java server/service/configuration/LayoutConfigService.java server/service/notification/NotificationObserver.java server/service/notification/NotificationService.java server/service/notification/MessageBuilder.java server/service/notification/Message.java server/service/notification/NotificationOnce.java server/service/project/ProjectTaskService.java server/service/project/ProjectCommentService.java server/service/project/ProjectHelper.java server/service/project/BaseTaskService.java server/service/feeds/BaseFeedsService.java server/service/feeds/FeedsCommentService.java server/service/feeds/FeedsService.java server/service/ObservableService.java server/service/CommonService.java server/service/OperatingObserver.java server/service/SQLExecutor.java server/service/OperatingContext.java server/service/BaseServiceImpl.java server/service/PerHourJob.java server/service/BaseService.java server/service/TransactionManual.java server/business/charts/ChartData.java server/business/charts/TableBuilder.java server/business/charts/builtin/ApprovalList.java server/business/charts/builtin/FeedsSchedule.java server/business/charts/TreeBuilder.java server/business/charts/TableChart.java server/business/charts/ChartsFactory.java server/business/charts/FunnelChart.java server/business/charts/RadarChart.java server/business/charts/ScatterChart.java server/business/charts/LineChart.java server/business/charts/TreemapChart.java server/business/charts/Dimension.java server/business/charts/Axis.java server/business/charts/Numerical.java server/business/charts/PieChart.java server/business/charts/IndexChart.java server/business/charts/FormatCalc.java server/business/charts/FormatStyle.java server/business/charts/ChartsHelper.java server/business/charts/FormatSort.java server/business/charts/BarChart.java server/business/trigger/impl/FieldAggregation.java server/business/trigger/impl/AggregationEvaluator.java server/business/trigger/impl/CompatibleValueConversion.java server/business/trigger/impl/AutoAssign.java server/business/trigger/impl/SendNotification.java server/business/trigger/impl/FieldWriteback.java server/business/trigger/impl/AutoShare.java server/business/trigger/impl/AutoApproval.java server/business/trigger/RobotTriggerObserver.java server/business/trigger/ActionType.java server/business/trigger/TriggerWhen.java server/business/trigger/ActionContext.java server/business/trigger/ActionFactory.java server/business/trigger/RobotTriggerManual.java server/business/approval/ApprovalProcessor.java server/business/approval/FlowParser.java server/business/approval/FlowNode.java server/business/approval/FlowNodeGroup.java server/business/approval/FlowBranch.java server/business/approval/ApprovalHelper.java server/business/approval/ApprovalState.java server/business/approval/ApprovalFields2Schema.java server/business/approval/FormBuilder.java server/business/dataimport/RecordCheckout.java server/business/dataimport/DataImporter.java server/business/dataimport/DataExporter.java server/business/dataimport/ImportRule.java server/business/dataimport/DataFileParser.java server/business/dataimport/ColumnWidthStrategy.java server/business/rbstore/MetaschemaImporter.java server/business/rbstore/MetaSchemaGenerator.java server/business/rbstore/ClassificationImporter.java server/business/rbstore/ClassificationFileImporter.java server/business/rbstore/RBStore.java server/business/datareport/EasyExcelGenerator.java server/business/datareport/TemplateExtractor.java server/business/datareport/ReportGenerator.java server/business/recyclebin/RecycleRestore.java server/business/recyclebin/RecycleStore.java server/business/recyclebin/RecycleBean.java server/business/recyclebin/RecycleBinCleanerJob.java server/business/recyclebin/RestoreRecordCreator.java server/business/feeds/FeedsHelper.java server/business/feeds/FeedsScheduleJob.java server/business/feeds/FeedsType.java server/business/feeds/FeedsScope.java server/business/series/IncreasingVar.java server/business/series/SeriesGenerator.java server/business/series/SeriesZeroResetJob.java server/business/series/TimeVar.java server/business/series/SeriesGeneratorFactory.java server/business/series/SeriesVar.java server/business/files/FilesHelper.java server/helper/setup/Installer.java server/helper/setup/DatabaseBackup.java server/helper/setup/UpgradeDatabase.java server/helper/setup/UpgradeScriptReader.java server/helper/datalist/QueryParser.java server/helper/datalist/DataListWrapper.java server/helper/datalist/BatchOperatorQuery.java server/helper/datalist/ProtocolFilterParser.java server/helper/datalist/DefaultDataListControl.java server/helper/cache/JedisCacheDriver.java server/helper/cache/RecentlyUsedCache.java server/helper/cache/BaseCacheTemplate.java server/helper/cache/RecordOwningCache.java server/helper/cache/EhcacheDriver.java server/helper/cache/CommonCache.java server/helper/fieldvalue/FieldValueWrapper.java server/helper/fieldvalue/BarCodeGenerator.java server/helper/fieldvalue/ContentWithFieldVars.java server/helper/SMSender.java server/helper/QiniuCloud.java server/helper/language/LanguageBundle.java server/helper/language/Languages.java server/helper/task/HeavyTask.java server/helper/task/TaskExecutors.java server/helper/state/StateManager.java server/helper/state/StateHelper.java server/helper/state/HowtoState.java server/helper/SysConfiguration.java server/helper/AesPreferencesConfigurer.java server/helper/License.java server/helper/KVStorage.java server/helper/ConfigurableItem.java server/helper/VCode.java server/helper/DistributedJobBean.java server/helper/FormDataBuilder.java server/helper/BlackList.java server/helper/SetUser.java server/configuration/portals/FormsBuilder.java server/configuration/portals/NavBuilder.java server/configuration/portals/ShareToManager.java server/configuration/portals/ViewAddonsManager.java server/configuration/portals/PickListManager.java server/configuration/portals/ClassificationManager.java server/configuration/portals/DataListManager.java server/configuration/portals/ChartManager.java server/configuration/portals/BaseLayoutManager.java server/configuration/portals/MultiSelectManager.java server/configuration/portals/NavManager.java server/configuration/portals/FormsManager.java server/configuration/ProjectManager.java server/configuration/RobotTriggerManager.java server/configuration/AutoFillinManager.java server/configuration/RobotApprovalManager.java server/configuration/DataReportManager.java server/configuration/ConfigEntry.java server/configuration/RebuildApiManager.java server/configuration/FlowDefinition.java server/metadata/entity/Field2Schema.java server/metadata/entity/Entity2Schema.java server/metadata/entity/EasyMeta.java server/metadata/entity/DisplayType.java server/metadata/entity/MetaEntityService.java server/metadata/entity/MetaFieldService.java server/metadata/entity/UnsafeEntity.java server/metadata/entity/FieldExtConfigProps.java server/metadata/MetadataHelper.java server/metadata/DynamicMetadataFactory.java server/metadata/DefaultValueHelper.java server/metadata/MetadataSorter.java server/metadata/ExtRecordCreator.java server/metadata/EntityHelper.java server/Application.java server/ServerStatus.java server/ServerListener.java api/general/EntityList.java api/general/EntityGet.java api/general/ApiDataListWrapper.java api/general/EntityCreate.java api/general/EntityUpdate.java api/general/EntityDelete.java api/general/ApiDataListControl.java api/ApiGateway.java api/metadata/ClassificationData.java api/metadata/FieldList.java api/metadata/EntityList.java api/ApiContext.java api/LoginToken.java api/Controll.java api/AuthTokenManager.java api/BaseApi.java api/SystemTime.java utils/AppUtils.java utils/HttpUtils.java utils/CommonsUtils.java utils/MaxBackupIndexDailyRollingFileAppender.java utils/LocationUtils.java utils/AES.java utils/JSONUtils.java utils/ExcelUtils.java utils/RbRecordCodec.java utils/FileFilterByLastModified.java utils/RbDateCodec.java utils/RateLimiters.java utils/MarkdownUtils.java

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -45,7 +45,7 @@
Loading
45 45
46 46
	final private JSON flowDefinition;
47 47
	
48 -
	private Map<String, FlowNode> nodeMap = new HashMap<>();
48 +
	private final Map<String, FlowNode> nodeMap = new HashMap<>();
49 49
	
50 50
	/**
51 51
	 * @param flowDefinition
@@ -128,7 +128,7 @@
Loading
128 128
		next.sort((o1, o2) -> {
129 129
			int p1 = ((FlowBranch) o1).getPriority();
130 130
			int p2 = ((FlowBranch) o2).getPriority();
131 -
			return p1 > p2 ? 1 : (p1 == p2 ? 0 : -1);
131 +
			return Integer.compare(p1, p2);
132 132
		});
133 133
		return next;
134 134
	}
@@ -143,6 +143,18 @@
Loading
143 143
		}
144 144
		throw new ApprovalException("无效节点 : " + nodeId);
145 145
	}
146 +
147 +
	/**
148 +
	 * 是否有审批人节点,没有审批人节点的无效
149 +
	 *
150 +
	 * @return
151 +
	 */
152 +
	public boolean hasApproverNode() {
153 +
		for (FlowNode node : nodeMap.values()) {
154 +
			if (node.getType().equals(FlowNode.TYPE_APPROVER)) return true;
155 +
		}
156 +
		return false;
157 +
	}
146 158
	
147 159
	/**
148 160
	 * @return

@@ -18,6 +18,7 @@
Loading
18 18
19 19
package com.rebuild.server.configuration;
20 20
21 +
import com.alibaba.fastjson.JSONObject;
21 22
import com.rebuild.server.business.approval.FlowParser;
22 23
23 24
/**
@@ -28,6 +29,8 @@
Loading
28 29
 */
29 30
public class FlowDefinition extends ConfigEntry {
30 31
	private static final long serialVersionUID = 9146239943240893998L;
32 +
33 +
	transient private FlowParser flowParser;
31 34
	
32 35
	/**
33 36
	 * @return
@@ -40,6 +43,17 @@
Loading
40 43
	 * @return
41 44
	 */
42 45
	public FlowParser createFlowParser() {
43 -
		return new FlowParser(getJSON("flowDefinition"));
46 +
		if (flowParser == null) {
47 +
			flowParser = new FlowParser(getJSON("flowDefinition"));
48 +
		}
49 +
		return flowParser;
50 +
	}
51 +
52 +
	/**
53 +
	 * @return
54 +
	 */
55 +
	public boolean isWorkable() {
56 +
		JSONObject def = (JSONObject) getJSON("flowDefinition");
57 +
		return def != null && createFlowParser().hasApproverNode();
44 58
	}
45 59
}

@@ -21,6 +21,7 @@
Loading
21 21
import com.rebuild.server.service.bizz.UserHelper;
22 22
23 23
import java.util.ArrayList;
24 +
import java.util.Date;
24 25
import java.util.List;
25 26
26 27
/**
@@ -33,6 +34,8 @@
Loading
33 34
34 35
	public static final RobotApprovalManager instance = new RobotApprovalManager();
35 36
	private RobotApprovalManager() {}
37 +
38 +
	private static final String CKEY_PREFIX = "RobotApprovalManager2-";
36 39
	
37 40
	/**
38 41
	 * 获取实体/记录流程状态
@@ -95,10 +98,10 @@
Loading
95 98
		// 过滤可用的
96 99
		List<FlowDefinition> workable = new ArrayList<>();
97 100
		for (FlowDefinition def : defs) {
98 -
			if (def.isDisabled() || def.getJSON("flowDefinition") == null) {
101 +
			if (def.isDisabled() || !def.isWorkable()) {
99 102
				continue;
100 103
			}
101 -
			
104 +
102 105
			FlowParser flowParser = def.createFlowParser();
103 106
			FlowNode root = flowParser.getNode("ROOT");  // 发起人节点
104 107
			
@@ -122,24 +125,24 @@
Loading
122 125
	 * @return
123 126
	 */
124 127
	public FlowDefinition[] getFlowDefinitions(Entity entity) {
125 -
		final String cKey = "RobotApprovalManager-" + entity.getName();
128 +
		final String cKey = CKEY_PREFIX + entity.getName();
126 129
		FlowDefinition[] defs = (FlowDefinition[]) Application.getCommonCache().getx(cKey);
127 130
		if (defs != null) {
128 131
			return defs;
129 132
		}
130 133
		
131 134
		Object[][] array = Application.createQueryNoFilter(
132 -
				"select flowDefinition,isDisabled,name,configId from RobotApprovalConfig where belongEntity = ?")
135 +
				"select flowDefinition,isDisabled,name,configId,modifiedOn from RobotApprovalConfig where belongEntity = ?")
133 136
				.setParameter(1, entity.getName())
134 137
				.array();
135 138
		
136 139
		List<FlowDefinition> list = new ArrayList<>();
137 140
		for (Object[] o : array) {
138 -
			FlowDefinition def = new FlowDefinition();
139 -
			def.set("flowDefinition", JSON.parseObject((String) o[0]));
140 -
			def.set("disabled", o[1]);
141 -
			def.set("name", o[2]);
142 -
			def.set("id", o[3]);
141 +
			FlowDefinition def = (FlowDefinition) new FlowDefinition()
142 +
					.set("flowDefinition", JSON.parseObject((String) o[0]))
143 +
					.set("disabled", o[1])
144 +
					.set("name", o[2])
145 +
					.set("id", o[3]);
143 146
			list.add(def);
144 147
		}
145 148
		
@@ -150,7 +153,7 @@
Loading
150 153
	
151 154
	@Override
152 155
	public void clean(Object entity) {
153 -
		final String cKey = "RobotApprovalManager-" + ((Entity) entity).getName();
156 +
		final String cKey = CKEY_PREFIX + ((Entity) entity).getName();
154 157
		Application.getCommonCache().evict(cKey);
155 158
	}
156 159
}

@@ -11,8 +11,10 @@
Loading
11 11
import org.apache.commons.lang.StringEscapeUtils;
12 12
import org.apache.commons.lang.StringUtils;
13 13
14 -
import java.text.SimpleDateFormat;
15 -
import java.util.*;
14 +
import java.util.Collections;
15 +
import java.util.Date;
16 +
import java.util.HashSet;
17 +
import java.util.Set;
16 18
import java.util.regex.Matcher;
17 19
import java.util.regex.Pattern;
18 20

Learn more Showing 1 files with coverage changes found.

Changes in src/main/java/com/rebuild/server/ServerStatus.java
-1
-1
+2
Loading file...
Files Coverage
src/main/java/com/rebuild -0.01% 57.88%
Project Totals (248 files) 57.88%
Loading