Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package org.litesoft.datt.server.pos;

import org.litesoft.commonfoundation.typeutils.*;
import org.litesoft.core.simpletypes.*;
import org.litesoft.core.util.*;
import org.litesoft.datt.server.*;
import org.litesoft.orsup.base.*;
import org.litesoft.orsup.selection.*;
import org.litesoft.orsup.transact.*;

import java.io.*;
import java.sql.*;

public class Story extends StoryGO {
    public Story( Transaction pTransaction ) {
        super( pTransaction );
    }

    public Story( ConstructionControl pConstructionControl ) {
        super( pConstructionControl );
    }

    @Override
    protected void transactionDisposed() {
        mCommitUpdate = null;
        super.transactionDisposed();
    }

    private transient StoryUpdate mCommitUpdate = null;

    @Override
    public Serializable aboutToCommit( Timestamp pTransactionTimestamp ) {
        Transaction zTransaction = getTransaction();
        if ( isNew() ) {
            if ( getCreator() == null ) {
                setCreator( CurrentUserAccessor.get().getRequiredUser().freshIntoIfNotAlreadyIn( zTransaction ) );
            }
            if ( getRestrictedResource() == null ) {
                setRestrictedResource( CurrentRestrictedResourceAccessor.get().getRequiredRestrictedResource().freshIntoIfNotAlreadyIn( zTransaction ) );
            }
            setCreatorFullName( getCreator().getFullName() );
        } else if ( isAnyAttributeChanged() && notJustPriorityLastChangedBy() ) {
            if ( mCommitUpdate != null ) {
                removeUpdates( mCommitUpdate );
                mCommitUpdate.requestDelete();
                mCommitUpdate = null;
            }
            User zUser = CurrentUserAccessor.get().getRequiredUser().freshIntoIfNotAlreadyIn( zTransaction );
            addUpdates( mCommitUpdate = new StoryUpdate( zTransaction, zUser ) );
            for ( String zChangedAttributeName : getChangedAttributeNames() ) {
                AttributeAccessorSCD<Story> zACD = getAccessorSCDrequired( zChangedAttributeName );
                if ( zACD.isPersisted() ) {
                    if ( zACD == CD_Priority ) {
                        setPriorityLastChangedBy( zUser.getFullName() );
                    }
                    if ( zACD != CD_PriorityLastChangedBy ) {
                        String zName = zACD.getName();
                        String zOldValue = Objects.toString( getOriginalValueFor( zName ) );
                        mCommitUpdate.addChanges( new StoryChange( zTransaction, zName, zOldValue ) );
                    }
                }
            }
        }
        return super.aboutToCommit( pTransactionTimestamp );
    }

    private boolean notJustPriorityLastChangedBy() {
        int changes = numberOfAttributeChanged();
        return (changes > 1) || ((changes == 1) && !isAttributeChanged( CD_PriorityLastChangedBy ));
    }

    private GenericReference<String> mChanges = null;

    @Override
    protected void LLclearChanges() {
        mChanges = GenericReference.dispose( mChanges );
    }

    @Override
    public String getChanges() {
        if ( mChanges == null ) {
            mChanges = new GenericReference<String>( createChanges() );
        }
        return mChanges.get();
    }

    private String createChanges() {
        StringBuilder sb = new StringBuilder();
        for ( StoryUpdate zUpdate : getUpdates() ) {
            zUpdate.toString( sb );
        }
        return sb.toString();
    }

    public static WhereClause getLimitToCurrentRestrictedResource() {
        // Add filter to where clause to only select based on RestrictedResource.
        RestrictedResource zRestrictedResource = CurrentRestrictedResourceAccessor.get().getRequiredRestrictedResource();
        return WhereClauseFactory.INSTANCE.isEqual( CD_RestrictedResource, zRestrictedResource );
    }
}

Commits for litesoft/trunk/Java/DATT/src/org/litesoft/datt/server/pos/Story.java

Diff revisions: vs.
Revision Author Commited Message
948 Diff Diff GeorgeS picture GeorgeS Sat 07 Jun, 2014 23:42:39 +0000

Jusefuls Formatter Updated to New Code Format

939 Diff Diff GeorgeS picture GeorgeS Mon 02 Jun, 2014 21:30:31 +0000

Extracting commonfoundation

822 Diff Diff GeorgeS picture GeorgeS Sun 19 Aug, 2012 01:03:51 +0000
511 Diff Diff markcmarkc Sun 18 Sep, 2011 22:42:49 +0000

Added Restricted Resource to Story selection and fixed update of who last prioritized the story

430 GeorgeS picture GeorgeS Sat 20 Aug, 2011 19:46:21 +0000