Libraryless. Click here for Pure Java version (12826L/86K).
1 | srecord UndoCreateConcept(long conceptID) implements UndoableWithAnswer { |
2 | transient Concepts cc = db_mainConcepts(); |
3 | |
4 | toString { ret "Create " + getConcept(conceptID); } |
5 | |
6 | public S undo() { |
7 | Concept c = getConcept(cc, conceptID); |
8 | S result = "Deleted " + c + " again"; |
9 | deleteConcept(conceptID); |
10 | ret result; |
11 | } |
12 | } |
13 | |
14 | srecord UndoDeleteConcept(Concept concept) implements UndoableWithAnswer { |
15 | transient Concepts cc = db_mainConcepts(); |
16 | |
17 | toString { ret "Delete " + concept; } |
18 | |
19 | public S undo() { |
20 | registerConcept(cc, concept); |
21 | ret "Restored " + concept; |
22 | } |
23 | } |
24 | |
25 | srecord UndoSetConceptField(long conceptID, S field, O value, O newValue) implements UndoableWithAnswer { |
26 | transient Concepts cc = db_mainConcepts(); |
27 | |
28 | toString { ret "Set " + field + " of " + getConcept(conceptID) + " to " + newValue; } |
29 | |
30 | public S undo() { |
31 | Concept c = getConcept(cc, conceptID); |
32 | S result = "Reset " + field + " of " + c + " to " + value; |
33 | cset(c, field, value); |
34 | ret result; |
35 | } |
36 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1027555 |
Snippet name: | Concept Undo Classes [UndoCreateConcept, UndoDeleteConcept, UndoSetConceptField] |
Eternal ID of this version: | #1027555/6 |
Text MD5: | 6f5926436214b8096362bdc59a8c96e4 |
Transpilation MD5: | f6bfe7209ef32e91aceb0e0050535a82 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-03-23 22:29:36 |
Source code size: | 1049 bytes / 36 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 289 / 627 |
Version history: | 5 change(s) |
Referenced in: | [show references] |