V2GetWorkOrWorkCompleted.java 25.5 KB
Newer Older
Z
zhourui 已提交
1 2 3 4 5 6 7 8
package com.x.processplatform.assemble.surface.jaxrs.work;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
9
import java.util.concurrent.TimeUnit;
Z
zhourui 已提交
10 11 12 13
import java.util.stream.Collectors;

import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.BooleanUtils;
14
import org.apache.commons.lang3.StringUtils;
Z
zhourui 已提交
15 16 17 18 19 20 21 22 23

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.dataitem.DataItem;
import com.x.base.core.entity.dataitem.ItemCategory;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
Z
zhourui 已提交
24
import com.x.base.core.project.config.Config;
Z
zhourui 已提交
25 26 27 28 29 30 31 32 33 34 35 36 37 38
import com.x.base.core.project.exception.ExceptionAccessDenied;
import com.x.base.core.project.gson.GsonPropertyObject;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.organization.Identity;
import com.x.base.core.project.organization.Person;
import com.x.base.core.project.organization.Unit;
import com.x.base.core.project.tools.ListTools;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.core.entity.content.Attachment;
import com.x.processplatform.core.entity.content.Data;
import com.x.processplatform.core.entity.content.Read;
Z
zhourui 已提交
39
import com.x.processplatform.core.entity.content.Record;
Z
zhourui 已提交
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
import com.x.processplatform.core.entity.content.Task;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.content.WorkCompleted;
import com.x.processplatform.core.entity.element.Activity;
import com.x.processplatform.core.entity.element.ActivityType;
import com.x.processplatform.core.entity.element.Manual;
import com.x.processplatform.core.entity.element.ManualMode;
import com.x.processplatform.core.entity.element.Route;
import com.x.query.core.entity.Item;

class V2GetWorkOrWorkCompleted extends BaseAction {

	private static Logger logger = LoggerFactory.getLogger(V2GetWorkOrWorkCompleted.class);

	ActionResult<Wo> execute(EffectivePerson effectivePerson, String workOrWorkCompleted) throws Exception {
Z
zhourui 已提交
55
		ActionResult<Wo> result = new ActionResult<>();
Z
zhourui 已提交
56

57 58 59 60 61 62 63
		Wo wo = new Wo();
		Work work = null;
		WorkCompleted workCompleted = null;
		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
			work = emc.find(workOrWorkCompleted, Work.class);
			if (null == work) {
				workCompleted = emc.flag(workOrWorkCompleted, WorkCompleted.class);
Z
zhourui 已提交
64
			}
65
		}
Z
zhourui 已提交
66

67 68 69 70 71 72
		CompletableFuture<Boolean> checkControlFuture = this.checkControlFuture(effectivePerson, workOrWorkCompleted);

		if (null != work) {
			CompletableFuture<Void> workJsonFuture = this.workJsonFuture(work, wo);
			CompletableFuture<Void> activityRouteFuture = this.activityRouteFuture(work, wo);
			CompletableFuture<Void> dataFuture = this.dataFuture(work, wo);
73
			CompletableFuture<Void> taskFuture = this.taskFuture(effectivePerson, work.getJob(), work.getId(), wo);
74 75 76 77 78
			CompletableFuture<Void> readFuture = this.readFuture(effectivePerson, work.getJob(), wo);
			CompletableFuture<Void> creatorIdentityFuture = this.creatorIdentityFuture(work.getCreatorIdentity(), wo);
			CompletableFuture<Void> creatorPersonFuture = this.creatorPersonFuture(work.getCreatorPerson(), wo);
			CompletableFuture<Void> creatorUnitFuture = this.creatorUnitFuture(work.getCreatorUnit(), wo);
			CompletableFuture<Void> attachmentFuture = this.attachmentFuture(effectivePerson, work.getJob(), wo);
Z
zhourui 已提交
79
			CompletableFuture<Void> recordFuture = this.recordFuture(effectivePerson, work.getJob(), wo);
Z
zhourui 已提交
80 81 82 83 84 85 86 87 88 89
			workJsonFuture.get(Config.processPlatform().getAsynchronousTimeout(), TimeUnit.SECONDS);
			activityRouteFuture.get(Config.processPlatform().getAsynchronousTimeout(), TimeUnit.SECONDS);
			dataFuture.get(Config.processPlatform().getAsynchronousTimeout(), TimeUnit.SECONDS);
			taskFuture.get(Config.processPlatform().getAsynchronousTimeout(), TimeUnit.SECONDS);
			readFuture.get(Config.processPlatform().getAsynchronousTimeout(), TimeUnit.SECONDS);
			creatorIdentityFuture.get(Config.processPlatform().getAsynchronousTimeout(), TimeUnit.SECONDS);
			creatorPersonFuture.get(Config.processPlatform().getAsynchronousTimeout(), TimeUnit.SECONDS);
			creatorUnitFuture.get(Config.processPlatform().getAsynchronousTimeout(), TimeUnit.SECONDS);
			attachmentFuture.get(Config.processPlatform().getAsynchronousTimeout(), TimeUnit.SECONDS);
			recordFuture.get(Config.processPlatform().getAsynchronousTimeout(), TimeUnit.SECONDS);
90 91
			for (WoTask woTask : wo.getTaskList()) {
				wo.getRecordList().add(taskToRecord(woTask));
Z
zhourui 已提交
92
			}
93 94 95 96 97 98 99 100 101
		} else if (null != workCompleted) {
			CompletableFuture<Void> workCompletedJsonFuture = this.workCompletedJsonFuture(workCompleted, wo);
			CompletableFuture<Void> workCompletedDataFuture = this.workCompletedDataFuture(workCompleted, wo);
			CompletableFuture<Void> readFuture = readFuture(effectivePerson, workCompleted.getJob(), wo);
			CompletableFuture<Void> creatorIdentityFuture = creatorIdentityFuture(workCompleted.getCreatorIdentity(),
					wo);
			CompletableFuture<Void> creatorPersonFuture = creatorPersonFuture(workCompleted.getCreatorPerson(), wo);
			CompletableFuture<Void> creatorUnitFuture = creatorUnitFuture(workCompleted.getCreatorUnit(), wo);
			CompletableFuture<Void> attachmentFuture = attachmentFuture(effectivePerson, workCompleted.getJob(), wo);
Z
zhourui 已提交
102 103
			CompletableFuture<Void> workCompletedRecordFuture = this.workCompletedRecordFuture(effectivePerson,
					workCompleted, wo);
Z
zhourui 已提交
104 105 106 107 108 109 110 111
			workCompletedJsonFuture.get(Config.processPlatform().getAsynchronousTimeout(), TimeUnit.SECONDS);
			workCompletedDataFuture.get(Config.processPlatform().getAsynchronousTimeout(), TimeUnit.SECONDS);
			readFuture.get(Config.processPlatform().getAsynchronousTimeout(), TimeUnit.SECONDS);
			creatorIdentityFuture.get(Config.processPlatform().getAsynchronousTimeout(), TimeUnit.SECONDS);
			creatorPersonFuture.get(Config.processPlatform().getAsynchronousTimeout(), TimeUnit.SECONDS);
			creatorUnitFuture.get(Config.processPlatform().getAsynchronousTimeout(), TimeUnit.SECONDS);
			attachmentFuture.get(Config.processPlatform().getAsynchronousTimeout(), TimeUnit.SECONDS);
			workCompletedRecordFuture.get(Config.processPlatform().getAsynchronousTimeout(), TimeUnit.SECONDS);
112 113
		}

R
Ray 已提交
114 115
		if (BooleanUtils
				.isFalse(checkControlFuture.get(Config.processPlatform().getAsynchronousTimeout(), TimeUnit.SECONDS))) {
Z
zhourui 已提交
116
			throw new ExceptionAccessDenied(effectivePerson, workOrWorkCompleted);
Z
zhourui 已提交
117 118
		}

119 120
		result.setData(wo);
		return result;
Z
zhourui 已提交
121 122
	}

Z
zhourui 已提交
123 124
	private WoRecord taskToRecord(WoTask woTask) {
		WoRecord o = new WoRecord();
125 126 127 128 129 130
		// id必须设置为空,否则会影响每次输出的内容都不同,那么会导致etag每次不同.
		o.setId("");
		// order设置为task的最后修改时间,否则会影响每次输出的内容都不同,那么会导致etag每次不同.
		o.setOrder(woTask.getUpdateTime().getTime());
		// recordTime设置为task的最后修改时间,否则会影响每次输出的内容都不同,那么会导致etag每次不同.
		o.setRecordTime(woTask.getUpdateTime());
Z
zhourui 已提交
131 132 133 134 135 136 137 138 139 140 141 142 143 144
		o.setType(Record.TYPE_CURRENTTASK);
		o.setFromActivity(woTask.getActivity());
		o.setFromActivityAlias(woTask.getActivityAlias());
		o.setFromActivityName(woTask.getActivityName());
		o.setFromActivityToken(woTask.getActivityToken());
		o.setFromActivityType(woTask.getActivityType());
		o.setPerson(woTask.getPerson());
		o.setIdentity(o.getIdentity());
		o.setUnit(woTask.getUnit());
		o.getProperties().setStartTime(woTask.getStartTime());
		o.getProperties().setEmpowerFromIdentity(woTask.getEmpowerFromIdentity());
		return o;
	}

145
	private CompletableFuture<Void> dataFuture(Work work, Wo wo) {
Z
zhourui 已提交
146
		return CompletableFuture.runAsync(() -> {
Z
zhourui 已提交
147 148 149
			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
				List<Item> list = emc.listEqualAndEqual(Item.class, DataItem.bundle_FIELDNAME, work.getJob(),
						DataItem.itemCategory_FIELDNAME, ItemCategory.pp);
Z
zhourui 已提交
150 151 152 153 154 155 156 157 158 159 160 161 162
				if (!list.isEmpty()) {
					JsonElement jsonElement = itemConverter.assemble(list);
					// 必须是Object对象
					if (jsonElement.isJsonObject()) {
						wo.setData(gson.fromJson(jsonElement, Data.class));
					}
				}
			} catch (Exception e) {
				logger.error(e);
			}
		});
	}

163
	private CompletableFuture<Void> taskFuture(EffectivePerson effectivePerson, String job, String workId, Wo wo) {
Z
zhourui 已提交
164
		return CompletableFuture.runAsync(() -> {
Z
zhourui 已提交
165
			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
166
				wo.setTaskList(WoTask.copier.copy(emc.listEqual(Task.class, Task.job_FIELDNAME, job)));
167 168
				wo.setCurrentTaskIndex(ListUtils.indexOf(wo.getTaskList(),
						e -> effectivePerson.isPerson(e.getPerson()) && (StringUtils.equals(e.getWork(), workId))));
Z
zhourui 已提交
169 170 171 172 173 174
			} catch (Exception e) {
				logger.error(e);
			}
		});
	}

175
	private CompletableFuture<Void> attachmentFuture(EffectivePerson effectivePerson, String job, Wo wo) {
Z
zhourui 已提交
176
		return CompletableFuture.runAsync(() -> {
Z
zhourui 已提交
177 178
			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
				Business business = new Business(emc);
Z
zhourui 已提交
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
				List<String> identities = business.organization().identity().listWithPerson(effectivePerson);
				List<String> units = business.organization().unit().listWithPerson(effectivePerson);
				List<WoAttachment> wos = new ArrayList<>();
				for (Attachment attachment : business.entityManagerContainer().listEqual(Attachment.class,
						Attachment.job_FIELDNAME, job)) {
					boolean canControl = attachmentControl(attachment, effectivePerson, identities, units);
					boolean canEdit = attachmentEdit(attachment, effectivePerson, identities, units) || canControl;
					boolean canRead = attachmentRead(attachment, effectivePerson, identities, units) || canEdit;
					WoAttachment woAttachment = WoAttachment.copier.copy(attachment);
					if (canRead) {
						woAttachment.getControl().setAllowRead(true);
						woAttachment.getControl().setAllowEdit(canEdit);
						woAttachment.getControl().setAllowControl(canControl);
						wos.add(woAttachment);
					}
				}
				wos = wos.stream()
						.sorted(Comparator
								.comparing(WoAttachment::getOrderNumber, Comparator.nullsLast(Integer::compareTo))
								.thenComparing(Comparator.comparing(WoAttachment::getCreateTime,
										Comparator.nullsLast(Date::compareTo))))
						.collect(Collectors.toList());
				wo.setAttachmentList(wos);
			} catch (Exception e) {
				logger.error(e);
			}
		});
	}

208
	private CompletableFuture<Void> readFuture(EffectivePerson effectivePerson, String job, Wo wo) {
Z
zhourui 已提交
209
		return CompletableFuture.runAsync(() -> {
Z
zhourui 已提交
210 211
			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
				wo.setReadList(WoRead.copier.copy(emc.listEqual(Read.class, Read.job_FIELDNAME, job)));
Z
zhourui 已提交
212 213 214 215 216 217 218 219
				wo.setCurrentReadIndex(
						ListUtils.indexOf(wo.getReadList(), e -> effectivePerson.isPerson(e.getPerson())));
			} catch (Exception e) {
				logger.error(e);
			}
		});
	}

220
	private CompletableFuture<Void> workJsonFuture(Work work, Wo wo) {
Z
zhourui 已提交
221 222 223 224 225 226 227 228 229
		return CompletableFuture.runAsync(() -> {
			try {
				wo.setWork(gson.toJsonTree(WoWork.copier.copy(work)));
			} catch (Exception e) {
				logger.error(e);
			}
		});
	}

230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
	private CompletableFuture<Void> activityRouteFuture(Work work, Wo wo) {
		return CompletableFuture.runAsync(() -> {
			WoActivity woActivity = new WoActivity();
			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
				Business business = new Business(emc);
				Activity activity = business.getActivity(work);
				if (null != activity) {
					activity.copyTo(woActivity);
					wo.setActivity(woActivity);
					if (Objects.equals(ActivityType.manual, activity.getActivityType())) {
						wo.setRouteList(WoRoute.copier.copy(business.route().pick(((Manual) activity).getRouteList())));
					}
				}
			} catch (Exception e) {
				logger.error(e);
			}
		});
	}

	private CompletableFuture<Void> creatorIdentityFuture(String creatorIdentity, Wo wo) {
Z
zhourui 已提交
250
		return CompletableFuture.runAsync(() -> {
Z
zhourui 已提交
251 252
			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
				Business business = new Business(emc);
Z
zhourui 已提交
253 254 255 256 257 258 259
				wo.setCreatorIdentity(business.organization().identity().getObject(creatorIdentity));
			} catch (Exception e) {
				logger.error(e);
			}
		});
	}

260
	private CompletableFuture<Void> creatorPersonFuture(String creatorPerson, Wo wo) {
Z
zhourui 已提交
261
		return CompletableFuture.runAsync(() -> {
Z
zhourui 已提交
262 263
			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
				Business business = new Business(emc);
Z
zhourui 已提交
264 265 266 267 268 269 270
				wo.setCreatorPerson(business.organization().person().getObject(creatorPerson));
			} catch (Exception e) {
				logger.error(e);
			}
		});
	}

271
	private CompletableFuture<Void> creatorUnitFuture(String creatorUnit, Wo wo) {
Z
zhourui 已提交
272
		return CompletableFuture.runAsync(() -> {
Z
zhourui 已提交
273 274
			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
				Business business = new Business(emc);
Z
zhourui 已提交
275 276 277 278 279 280 281
				wo.setCreatorUnit(business.organization().unit().getObject(creatorUnit));
			} catch (Exception e) {
				logger.error(e);
			}
		});
	}

282
	private CompletableFuture<Void> workCompletedJsonFuture(WorkCompleted workCompleted, Wo wo) {
Z
zhourui 已提交
283 284 285 286 287 288 289 290 291
		return CompletableFuture.runAsync(() -> {
			try {
				wo.setWork(gson.toJsonTree(WoWorkCompleted.copier.copy(workCompleted)));
			} catch (Exception e) {
				logger.error(e);
			}
		});
	}

Z
zhourui 已提交
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
	private CompletableFuture<Void> recordFuture(EffectivePerson effectivePerson, String job, Wo wo) {
		return CompletableFuture.runAsync(() -> {
			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
				wo.setRecordList(emc.fetchEqual(Record.class, WoRecord.copier, Record.job_FIELDNAME, job).stream()
						.sorted(Comparator.comparing(WoRecord::getOrder)).collect(Collectors.toList()));
			} catch (Exception e) {
				logger.error(e);
			}
		});
	}

	private CompletableFuture<Void> workCompletedRecordFuture(EffectivePerson effectivePerson,
			WorkCompleted workCompleted, Wo wo) {
		return CompletableFuture.runAsync(() -> {
			try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
				if (ListTools.isNotEmpty(workCompleted.getProperties().getRecordList())) {
					wo.setRecordList(WoRecord.copier.copy(workCompleted.getProperties().getRecordList()).stream()
							.sorted(Comparator.comparing(WoRecord::getOrder)).collect(Collectors.toList()));
				} else {
					wo.setRecordList(emc
							.fetchEqual(Record.class, WoRecord.copier, Record.job_FIELDNAME, workCompleted.getJob())
							.stream().sorted(Comparator.comparing(WoRecord::getOrder)).collect(Collectors.toList()));
				}
			} catch (Exception e) {
				logger.error(e);
			}
		});
	}

321
	private CompletableFuture<Void> workCompletedDataFuture(WorkCompleted workCompleted, Wo wo) {
Z
zhourui 已提交
322 323 324 325
		return CompletableFuture.runAsync(() -> {
			if (BooleanUtils.isTrue(workCompleted.getMerged())) {
				wo.setData(workCompleted.getProperties().getData());
			} else {
Z
zhourui 已提交
326 327 328
				try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
					List<Item> list = emc.listEqualAndEqual(Item.class, DataItem.bundle_FIELDNAME,
							workCompleted.getJob(), DataItem.itemCategory_FIELDNAME, ItemCategory.pp);
Z
zhourui 已提交
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401
					if (!list.isEmpty()) {
						JsonElement jsonElement = itemConverter.assemble(list);
						// 必须是Object对象
						if (jsonElement.isJsonObject()) {
							wo.setData(gson.fromJson(jsonElement, Data.class));
						}
					}
				} catch (Exception e) {
					logger.error(e);
				}
			}
		});
	}

	private boolean attachmentRead(Attachment attachment, EffectivePerson effectivePerson, List<String> identities,
			List<String> units) throws Exception {
		boolean value = false;
		if (effectivePerson.isManager()) {
			value = true;
		} else if (effectivePerson.isPerson(attachment.getPerson())) {
			value = true;
		} else if (ListTools.isEmpty(attachment.getReadIdentityList())
				&& ListTools.isEmpty(attachment.getReadUnitList())) {
			value = true;
		} else {
			if (ListTools.containsAny(identities, attachment.getReadIdentityList())
					|| ListTools.containsAny(units, attachment.getReadUnitList())) {
				value = true;
			}
		}
		return value;
	}

	private boolean attachmentEdit(Attachment attachment, EffectivePerson effectivePerson, List<String> identities,
			List<String> units) throws Exception {
		boolean value = false;
		if (effectivePerson.isManager()) {
			value = true;
		} else if (effectivePerson.isPerson(attachment.getPerson())) {
			value = true;
		} else if (ListTools.isEmpty(attachment.getEditIdentityList())
				&& ListTools.isEmpty(attachment.getEditUnitList())) {
			value = true;
		} else {
			if (ListTools.containsAny(identities, attachment.getEditIdentityList())
					|| ListTools.containsAny(units, attachment.getEditUnitList())) {
				value = true;
			}
		}
		return value;
	}

	private boolean attachmentControl(Attachment attachment, EffectivePerson effectivePerson, List<String> identities,
			List<String> units) throws Exception {
		boolean value = false;
		if (effectivePerson.isManager()) {
			value = true;
		} else if (effectivePerson.isPerson(attachment.getPerson())) {
			value = true;
		} else if (ListTools.isEmpty(attachment.getControllerUnitList())
				&& ListTools.isEmpty(attachment.getControllerIdentityList())) {
			value = true;
		} else {
			if (ListTools.containsAny(identities, attachment.getControllerIdentityList())
					|| ListTools.containsAny(units, attachment.getControllerUnitList())) {
				value = true;
			}
		}
		return value;
	}

	public static class Wo extends GsonPropertyObject {

402
		private static final long serialVersionUID = -2651851022553574012L;
Z
zhourui 已提交
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423
		// work和workCompleted都有
		private JsonElement work;
		// work和workCompleted都有
		private Data data;
		// work和workCompleted都有
		private List<WoRead> readList;
		// work和workCompleted都有
		private Integer currentReadIndex = -1;

		// work和workCompleted都有
		private Identity creatorIdentity;

		// work和workCompleted都有
		private Person creatorPerson;

		// work和workCompleted都有
		private Unit creatorUnit;

		// work和workCompleted都有
		private List<WoAttachment> attachmentList;

424 425
		// work和workCompleted都有,需要先行初始化,因为record可能为空
		private List<WoRecord> recordList = new ArrayList<>();
Z
zhourui 已提交
426

Z
zhourui 已提交
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531
		// 只有work有
		private WoActivity activity;
		// 只有work有
		private List<WoTask> taskList;
		// 只有work有
		private Integer currentTaskIndex = -1;
		// 只有work有
		private List<WoRoute> routeList;

		public JsonElement getWork() {
			return work;
		}

		public void setWork(JsonElement work) {
			this.work = work;
		}

		public List<WoRead> getReadList() {
			return readList;
		}

		public void setReadList(List<WoRead> readList) {
			this.readList = readList;
		}

		public Integer getCurrentReadIndex() {
			return currentReadIndex;
		}

		public void setCurrentReadIndex(Integer currentReadIndex) {
			this.currentReadIndex = currentReadIndex;
		}

		public List<WoTask> getTaskList() {
			return taskList;
		}

		public void setTaskList(List<WoTask> taskList) {
			this.taskList = taskList;
		}

		public Integer getCurrentTaskIndex() {
			return currentTaskIndex;
		}

		public void setCurrentTaskIndex(Integer currentTaskIndex) {
			this.currentTaskIndex = currentTaskIndex;
		}

		public Data getData() {
			return data;
		}

		public void setData(Data data) {
			this.data = data;
		}

		public WoActivity getActivity() {
			return activity;
		}

		public void setActivity(WoActivity activity) {
			this.activity = activity;
		}

		public Person getCreatorPerson() {
			return creatorPerson;
		}

		public void setCreatorPerson(Person creatorPerson) {
			this.creatorPerson = creatorPerson;
		}

		public Identity getCreatorIdentity() {
			return creatorIdentity;
		}

		public void setCreatorIdentity(Identity creatorIdentity) {
			this.creatorIdentity = creatorIdentity;
		}

		public Unit getCreatorUnit() {
			return creatorUnit;
		}

		public void setCreatorUnit(Unit creatorUnit) {
			this.creatorUnit = creatorUnit;
		}

		public List<WoRoute> getRouteList() {
			return routeList;
		}

		public void setRouteList(List<WoRoute> routeList) {
			this.routeList = routeList;
		}

		public List<WoAttachment> getAttachmentList() {
			return attachmentList;
		}

		public void setAttachmentList(List<WoAttachment> attachmentList) {
			this.attachmentList = attachmentList;
		}

Z
zhourui 已提交
532 533 534 535 536 537 538 539
		public List<WoRecord> getRecordList() {
			return recordList;
		}

		public void setRecordList(List<WoRecord> recordList) {
			this.recordList = recordList;
		}

Z
zhourui 已提交
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555
	}

	public static class WoWork extends Work {

		private static final long serialVersionUID = 5244996549744746585L;

		static WrapCopier<Work, WoWork> copier = WrapCopierFactory.wo(Work.class, WoWork.class, null,
				JpaObject.FieldsInvisibleIncludeProperites);

	}

	public static class WoWorkCompleted extends WorkCompleted {

		private static final long serialVersionUID = -1772642962691214007L;

		static WrapCopier<WorkCompleted, WoWorkCompleted> copier = WrapCopierFactory.wo(WorkCompleted.class,
Z
zhourui 已提交
556
				WoWorkCompleted.class, null, JpaObject.FieldsInvisibleIncludeProperites);
Z
zhourui 已提交
557 558 559 560 561 562 563
	}

	public static class WoTask extends Task {

		private static final long serialVersionUID = 5244996549744746585L;

		static WrapCopier<Task, WoTask> copier = WrapCopierFactory.wo(Task.class, WoTask.class, null,
Z
zhourui 已提交
564
				JpaObject.FieldsInvisible);
Z
zhourui 已提交
565 566 567 568 569 570 571 572

	}

	public static class WoRead extends Read {

		private static final long serialVersionUID = 5244996549744746585L;

		static WrapCopier<Read, WoRead> copier = WrapCopierFactory.wo(Read.class, WoRead.class, null,
Z
zhourui 已提交
573
				JpaObject.FieldsInvisible);
Z
zhourui 已提交
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602

	}

	public static class WoActivity extends GsonPropertyObject {

		private static final long serialVersionUID = 1L;

		static WrapCopier<Activity, WoActivity> copier = WrapCopierFactory.wo(Activity.class, WoActivity.class,
				JpaObject.singularAttributeField(Activity.class, true, true),
				JpaObject.FieldsInvisibleIncludeProperites);

		private String id;

		private String name;

		private String description;

		private String alias;

		private String position;

		private String resetRange;

		private Integer resetCount;

		private Boolean allowReset;

		private ManualMode manualMode;

R
Ray 已提交
603 604
		private JsonElement customData;

Z
zhourui 已提交
605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676
		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public String getDescription() {
			return description;
		}

		public void setDescription(String description) {
			this.description = description;
		}

		public String getAlias() {
			return alias;
		}

		public void setAlias(String alias) {
			this.alias = alias;
		}

		public String getPosition() {
			return position;
		}

		public void setPosition(String position) {
			this.position = position;
		}

		public String getId() {
			return id;
		}

		public void setId(String id) {
			this.id = id;
		}

		public String getResetRange() {
			return resetRange;
		}

		public void setResetRange(String resetRange) {
			this.resetRange = resetRange;
		}

		public Integer getResetCount() {
			return resetCount;
		}

		public void setResetCount(Integer resetCount) {
			this.resetCount = resetCount;
		}

		public Boolean getAllowReset() {
			return allowReset;
		}

		public void setAllowReset(Boolean allowReset) {
			this.allowReset = allowReset;
		}

		public ManualMode getManualMode() {
			return manualMode;
		}

		public void setManualMode(ManualMode manualMode) {
			this.manualMode = manualMode;
		}

R
Ray 已提交
677 678 679 680 681 682 683 684
		public JsonElement getCustomData() {
			return customData;
		}

		public void setCustomData(JsonElement customData) {
			this.customData = customData;
		}

Z
zhourui 已提交
685 686
	}

Z
zhourui 已提交
687 688 689 690
	public static class WoRoute extends Route {

		private static final long serialVersionUID = 556378904185283486L;

Z
zhourui 已提交
691 692 693 694
		static WrapCopier<Route, WoRoute> copier = WrapCopierFactory.wo(Route.class, WoRoute.class, null,
				ListTools.toList(Route.createTime_FIELDNAME, Route.edition_FIELDNAME, Route.position_FIELDNAME,
						Route.process_FIELDNAME, Route.updateTime_FIELDNAME, Route.track_FIELDNAME,
						Route.properties_FIELDNAME));
Z
zhourui 已提交
695 696 697
	}

	public static class WoAttachment extends Attachment {
698 699 700

		private static final long serialVersionUID = -5323646346508661416L;

Z
zhourui 已提交
701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716
		static WrapCopier<Attachment, WoAttachment> copier = WrapCopierFactory.wo(Attachment.class, WoAttachment.class,
				null, JpaObject.FieldsInvisibleIncludeProperites);

		private WoAttachmentControl control = new WoAttachmentControl();

		public WoAttachmentControl getControl() {
			return control;
		}

		public void setControl(WoAttachmentControl control) {
			this.control = control;
		}
	}

	public static class WoAttachmentControl extends GsonPropertyObject {

717
		private static final long serialVersionUID = -1159880170066584166L;
Z
zhourui 已提交
718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747
		private Boolean allowRead = false;
		private Boolean allowEdit = false;
		private Boolean allowControl = false;

		public Boolean getAllowRead() {
			return allowRead;
		}

		public void setAllowRead(Boolean allowRead) {
			this.allowRead = allowRead;
		}

		public Boolean getAllowEdit() {
			return allowEdit;
		}

		public void setAllowEdit(Boolean allowEdit) {
			this.allowEdit = allowEdit;
		}

		public Boolean getAllowControl() {
			return allowControl;
		}

		public void setAllowControl(Boolean allowControl) {
			this.allowControl = allowControl;
		}

	}

Z
zhourui 已提交
748 749 750 751 752 753 754 755 756
	public static class WoRecord extends Record {

		private static final long serialVersionUID = -7666329770246726197L;

		static WrapCopier<Record, WoRecord> copier = WrapCopierFactory.wo(Record.class, WoRecord.class,
				JpaObject.singularAttributeField(Record.class, true, false), JpaObject.FieldsInvisible);

	}

Z
zhourui 已提交
757
}