Subversion Repository Public Repository

litesoft

Diff Revisions 947 vs 948 for /trunk/Java/DATT/src/org/litesoft/datt/server/pos/Story.java

Diff revisions: vs.
  @@ -1,8 +1,5 @@
1 1 package org.litesoft.datt.server.pos;
2 2
3 - import java.io.*;
4 - import java.sql.*;
5 -
6 3 import org.litesoft.commonfoundation.typeutils.*;
7 4 import org.litesoft.core.simpletypes.*;
8 5 import org.litesoft.core.util.*;
  @@ -11,21 +8,20 @@
11 8 import org.litesoft.orsup.selection.*;
12 9 import org.litesoft.orsup.transact.*;
13 10
14 - public class Story extends StoryGO
15 - {
16 - public Story( Transaction pTransaction )
17 - {
11 + import java.io.*;
12 + import java.sql.*;
13 +
14 + public class Story extends StoryGO {
15 + public Story( Transaction pTransaction ) {
18 16 super( pTransaction );
19 17 }
20 18
21 - public Story( ConstructionControl pConstructionControl )
22 - {
19 + public Story( ConstructionControl pConstructionControl ) {
23 20 super( pConstructionControl );
24 21 }
25 22
26 23 @Override
27 - protected void transactionDisposed()
28 - {
24 + protected void transactionDisposed() {
29 25 mCommitUpdate = null;
30 26 super.transactionDisposed();
31 27 }
  @@ -33,42 +29,31 @@
33 29 private transient StoryUpdate mCommitUpdate = null;
34 30
35 31 @Override
36 - public Serializable aboutToCommit( Timestamp pTransactionTimestamp )
37 - {
32 + public Serializable aboutToCommit( Timestamp pTransactionTimestamp ) {
38 33 Transaction zTransaction = getTransaction();
39 - if ( isNew() )
40 - {
41 - if ( getCreator() == null )
42 - {
34 + if ( isNew() ) {
35 + if ( getCreator() == null ) {
43 36 setCreator( CurrentUserAccessor.get().getRequiredUser().freshIntoIfNotAlreadyIn( zTransaction ) );
44 37 }
45 - if ( getRestrictedResource() == null )
46 - {
38 + if ( getRestrictedResource() == null ) {
47 39 setRestrictedResource( CurrentRestrictedResourceAccessor.get().getRequiredRestrictedResource().freshIntoIfNotAlreadyIn( zTransaction ) );
48 40 }
49 41 setCreatorFullName( getCreator().getFullName() );
50 - }
51 - else if ( isAnyAttributeChanged() && notJustPriorityLastChangedBy() )
52 - {
53 - if ( mCommitUpdate != null )
54 - {
42 + } else if ( isAnyAttributeChanged() && notJustPriorityLastChangedBy() ) {
43 + if ( mCommitUpdate != null ) {
55 44 removeUpdates( mCommitUpdate );
56 45 mCommitUpdate.requestDelete();
57 46 mCommitUpdate = null;
58 47 }
59 48 User zUser = CurrentUserAccessor.get().getRequiredUser().freshIntoIfNotAlreadyIn( zTransaction );
60 49 addUpdates( mCommitUpdate = new StoryUpdate( zTransaction, zUser ) );
61 - for ( String zChangedAttributeName : getChangedAttributeNames() )
62 - {
50 + for ( String zChangedAttributeName : getChangedAttributeNames() ) {
63 51 AttributeAccessorSCD<Story> zACD = getAccessorSCDrequired( zChangedAttributeName );
64 - if ( zACD.isPersisted() )
65 - {
66 - if ( zACD == CD_Priority )
67 - {
52 + if ( zACD.isPersisted() ) {
53 + if ( zACD == CD_Priority ) {
68 54 setPriorityLastChangedBy( zUser.getFullName() );
69 55 }
70 - if ( zACD != CD_PriorityLastChangedBy )
71 - {
56 + if ( zACD != CD_PriorityLastChangedBy ) {
72 57 String zName = zACD.getName();
73 58 String zOldValue = Objects.toString( getOriginalValueFor( zName ) );
74 59 mCommitUpdate.addChanges( new StoryChange( zTransaction, zName, zOldValue ) );
  @@ -79,8 +64,7 @@
79 64 return super.aboutToCommit( pTransactionTimestamp );
80 65 }
81 66
82 - private boolean notJustPriorityLastChangedBy()
83 - {
67 + private boolean notJustPriorityLastChangedBy() {
84 68 int changes = numberOfAttributeChanged();
85 69 return (changes > 1) || ((changes == 1) && !isAttributeChanged( CD_PriorityLastChangedBy ));
86 70 }
  @@ -88,33 +72,27 @@
88 72 private GenericReference<String> mChanges = null;
89 73
90 74 @Override
91 - protected void LLclearChanges()
92 - {
75 + protected void LLclearChanges() {
93 76 mChanges = GenericReference.dispose( mChanges );
94 77 }
95 78
96 79 @Override
97 - public String getChanges()
98 - {
99 - if ( mChanges == null )
100 - {
80 + public String getChanges() {
81 + if ( mChanges == null ) {
101 82 mChanges = new GenericReference<String>( createChanges() );
102 83 }
103 84 return mChanges.get();
104 85 }
105 86
106 - private String createChanges()
107 - {
87 + private String createChanges() {
108 88 StringBuilder sb = new StringBuilder();
109 - for ( StoryUpdate zUpdate : getUpdates() )
110 - {
89 + for ( StoryUpdate zUpdate : getUpdates() ) {
111 90 zUpdate.toString( sb );
112 91 }
113 92 return sb.toString();
114 93 }
115 94
116 - public static WhereClause getLimitToCurrentRestrictedResource()
117 - {
95 + public static WhereClause getLimitToCurrentRestrictedResource() {
118 96 // Add filter to where clause to only select based on RestrictedResource.
119 97 RestrictedResource zRestrictedResource = CurrentRestrictedResourceAccessor.get().getRequiredRestrictedResource();
120 98 return WhereClauseFactory.INSTANCE.isEqual( CD_RestrictedResource, zRestrictedResource );