|
@@ -5,7 +5,6 @@ |
5 |
5 |
|
import java.util.*; |
6 |
6 |
|
|
7 |
7 |
|
import org.litesoft.core.simpletypes.*; |
8 |
|
- |
import org.litesoft.core.simpletypes.temporal.*; |
9 |
8 |
|
import org.litesoft.core.util.*; |
10 |
9 |
|
import org.litesoft.orsup.base.*; |
11 |
10 |
|
import org.litesoft.orsup.transact.*; |
|
@@ -41,7 +40,7 @@ |
41 |
40 |
|
{ |
42 |
41 |
|
setCreator( zUser ); |
43 |
42 |
|
} |
44 |
|
- |
else if ( isAnyAttributeChanged() ) |
|
43 |
+ |
else if ( isAnyAttributeChanged() && notJustPriorityLastChangedBy() ) |
45 |
44 |
|
{ |
46 |
45 |
|
if ( mCommitUpdate != null ) |
47 |
46 |
|
{ |
|
@@ -55,47 +54,50 @@ |
55 |
54 |
|
AttributeAccessorSCD<Story> zACD = getAccessorSCDrequired( zChangedAttributeName ); |
56 |
55 |
|
if ( zACD.isPersisted() ) |
57 |
56 |
|
{ |
58 |
|
- |
String zName = zACD.getName(); |
59 |
|
- |
String zOldValue = UtilsCommon.toString( getOriginalValueFor( zName ) ); |
60 |
|
- |
mCommitUpdate.addChanges( new StoryChange( zTransaction, zName, zOldValue ) ); |
|
57 |
+ |
if ( zACD == CD_Priority ) |
|
58 |
+ |
{ |
|
59 |
+ |
setPriorityLastChangedBy( zUser.getFullName() ); |
|
60 |
+ |
} |
|
61 |
+ |
if ( zACD != CD_PriorityLastChangedBy ) |
|
62 |
+ |
{ |
|
63 |
+ |
String zName = zACD.getName(); |
|
64 |
+ |
String zOldValue = UtilsCommon.toString( getOriginalValueFor( zName ) ); |
|
65 |
+ |
mCommitUpdate.addChanges( new StoryChange( zTransaction, zName, zOldValue ) ); |
|
66 |
+ |
} |
61 |
67 |
|
} |
62 |
68 |
|
} |
63 |
69 |
|
} |
64 |
70 |
|
return super.aboutToCommit( pTransactionTimestamp ); |
65 |
71 |
|
} |
66 |
72 |
|
|
67 |
|
- |
@Override |
68 |
|
- |
public String getLastChanged() |
69 |
|
- |
{ |
70 |
|
- |
StoryUpdate zLastUpdate = getLastUpdate(); |
71 |
|
- |
return zLastUpdate == null ? null : TypeConverter.to_SimpleTimestamp( TimeRes.ToMIN, zLastUpdate.getCreated() ).toString(); |
72 |
|
- |
} |
73 |
|
- |
|
74 |
|
- |
@Override |
75 |
|
- |
protected void LLclearLastChanged() |
|
73 |
+ |
private boolean notJustPriorityLastChangedBy() |
76 |
74 |
|
{ |
|
75 |
+ |
int changes = numberOfAttributeChanged(); |
|
76 |
+ |
return (changes > 1) || ((changes == 1) && isAttributeChanged( CD_PriorityLastChangedBy )); |
77 |
77 |
|
} |
78 |
78 |
|
|
79 |
|
- |
private GenericReference<StoryUpdate> mLastUpdate = null; |
|
79 |
+ |
private GenericReference<String> mChanges = null; |
80 |
80 |
|
|
81 |
81 |
|
@Override |
82 |
|
- |
protected void LLclearLastUpdate() |
|
82 |
+ |
protected void LLclearChanges() |
83 |
83 |
|
{ |
84 |
|
- |
mLastUpdate = GenericReference.dispose( mLastUpdate ); |
|
84 |
+ |
mChanges = GenericReference.dispose( mChanges ); |
85 |
85 |
|
} |
86 |
86 |
|
|
87 |
87 |
|
@Override |
88 |
|
- |
public StoryUpdate getLastUpdate() |
|
88 |
+ |
public String getChanges() |
89 |
89 |
|
{ |
90 |
|
- |
if ( mLastUpdate == null ) |
|
90 |
+ |
if ( mChanges == null ) |
91 |
91 |
|
{ |
92 |
|
- |
mLastUpdate = new GenericReference<StoryUpdate>( createLastUpdate() ); |
|
92 |
+ |
mChanges = new GenericReference<String>( createChanges() ); |
93 |
93 |
|
} |
94 |
|
- |
return mLastUpdate.get(); |
|
94 |
+ |
return mChanges.get(); |
95 |
95 |
|
} |
96 |
96 |
|
|
97 |
|
- |
protected StoryUpdate createLastUpdate() |
|
97 |
+ |
private String createChanges() |
98 |
98 |
|
{ |
|
99 |
+ |
// return zLastUpdate == null ? null : TypeConverter.to_SimpleTimestamp( TimeRes.ToMIN, zLastUpdate.getCreated() ).toString(); |
|
100 |
+ |
|
99 |
101 |
|
List<StoryUpdate> zUpdates = getUpdates(); |
100 |
102 |
|
if ( zUpdates.isEmpty() ) |
101 |
103 |
|
{ |
|
@@ -106,6 +108,7 @@ |
106 |
108 |
|
zUpdates = new ArrayList<StoryUpdate>( zUpdates ); |
107 |
109 |
|
Collections.sort( zUpdates ); |
108 |
110 |
|
} |
109 |
|
- |
return zUpdates.get( 0 ); |
|
111 |
+ |
// return zUpdates.get( 0 ); |
|
112 |
+ |
return null; |
110 |
113 |
|
} |
111 |
114 |
|
} |