|
@@ -1,15 +1,14 @@ |
1 |
1 |
|
// This Source Code is in the Public Domain per: http://litesoft.org/License.txt |
2 |
2 |
|
package org.litesoft.orsup.nonpublic; |
3 |
3 |
|
|
|
4 |
+ |
import java.sql.*; |
|
5 |
+ |
import java.util.*; |
|
6 |
+ |
|
4 |
7 |
|
import org.litesoft.orsup.base.*; |
5 |
8 |
|
import org.litesoft.orsup.transact.*; |
6 |
9 |
|
import org.litesoft.util.*; |
7 |
10 |
|
|
8 |
|
- |
import java.sql.*; |
9 |
|
- |
import java.util.*; |
10 |
|
- |
|
11 |
|
- |
public abstract class PersistentObjectImplMetaData<T extends PersistentObjectImpl> |
12 |
|
- |
implements MetaDataForPOinternalExtension<T> |
|
11 |
+ |
public abstract class PersistentObjectImplMetaData<T extends PersistentObjectImpl> implements MetaDataForPOinternalExtension<T> |
13 |
12 |
|
{ |
14 |
13 |
|
private MetaDataStore mMetaDataStore = null; |
15 |
14 |
|
private String mIdentifierName; |
|
@@ -23,8 +22,7 @@ |
23 |
22 |
|
private AbstractAttributeAccessorSCDtoOne[] mToOneAccessorSCDsThatFlagPeerChangeNotification; |
24 |
23 |
|
private Index[] mIndexes = Index.EMPTY_ARRAY; |
25 |
24 |
|
|
26 |
|
- |
protected PersistentObjectImplMetaData( AttributeAccessorSCD[] pAccessorSCDs, String pIdentifierName, String pTableName, |
27 |
|
- |
AttributeAccessorKeySet pAttributeAccessorKeySet, AttributeAccessorSCD... pMoreAccessorSCDs ) |
|
25 |
+ |
protected PersistentObjectImplMetaData( AttributeAccessorSCD[] pAccessorSCDs, String pIdentifierName, String pTableName, AttributeAccessorKeySet pAttributeAccessorKeySet, AttributeAccessorSCD... pMoreAccessorSCDs ) |
28 |
26 |
|
{ |
29 |
27 |
|
pAccessorSCDs = join( pAccessorSCDs, pMoreAccessorSCDs ); |
30 |
28 |
|
mIdentifierName = Utils.assertNotNullNotEmpty( "IdentifierName", pIdentifierName ); |
|
@@ -76,9 +74,7 @@ |
76 |
74 |
|
} |
77 |
75 |
|
} |
78 |
76 |
|
|
79 |
|
- |
protected PersistentObjectImplMetaData( String pIdentifierName, String pTableName, |
80 |
|
- |
AttributeAccessorKeySet pAttributeAccessorKeySet, |
81 |
|
- |
AttributeAccessorSCD... pAccessorSCDs ) |
|
77 |
+ |
protected PersistentObjectImplMetaData( String pIdentifierName, String pTableName, AttributeAccessorKeySet pAttributeAccessorKeySet, AttributeAccessorSCD... pAccessorSCDs ) |
82 |
78 |
|
{ |
83 |
79 |
|
this( null, pIdentifierName, pTableName, pAttributeAccessorKeySet, pAccessorSCDs ); |
84 |
80 |
|
} |
|
@@ -109,9 +105,7 @@ |
109 |
105 |
|
String zAttributeName = makeCaseInsensitive( pAccessor.getName() ); |
110 |
106 |
|
if ( mAccessorSCDsByName.containsKey( zAttributeName ) ) |
111 |
107 |
|
{ |
112 |
|
- |
throw new IllegalArgumentException( "Attempt to add an AttributeAccessorSCD (" + |
113 |
|
- |
pAccessor.getName() + ") who's name already exists in: " + |
114 |
|
- |
getIdentifierName() ); |
|
108 |
+ |
throw new IllegalArgumentException( "Attempt to add an AttributeAccessorSCD (" + pAccessor.getName() + ") who's name already exists in: " + getIdentifierName() ); |
115 |
109 |
|
} |
116 |
110 |
|
mAccessorSCDsByName.put( zAttributeName, pAccessor ); |
117 |
111 |
|
return true; |
|
@@ -148,15 +142,13 @@ |
148 |
142 |
|
{ |
149 |
143 |
|
mToOneAccessorSCDsThatFlagPeerChange = // |
150 |
144 |
|
AbstractAttributeAccessorSCDtoOne.append( // |
151 |
|
- |
mToOneAccessorSCDsThatFlagPeerChange, |
152 |
|
- |
zToOne ); |
|
145 |
+ |
mToOneAccessorSCDsThatFlagPeerChange, zToOne ); |
153 |
146 |
|
} |
154 |
147 |
|
if ( zToOne.changedPOflagsPeerChangeNotification() ) |
155 |
148 |
|
{ |
156 |
149 |
|
mToOneAccessorSCDsThatFlagPeerChangeNotification = // |
157 |
150 |
|
AbstractAttributeAccessorSCDtoOne.append( // |
158 |
|
- |
mToOneAccessorSCDsThatFlagPeerChangeNotification, |
159 |
|
- |
zToOne ); |
|
151 |
+ |
mToOneAccessorSCDsThatFlagPeerChangeNotification, zToOne ); |
160 |
152 |
|
} |
161 |
153 |
|
} |
162 |
154 |
|
} |
|
@@ -176,8 +168,7 @@ |
176 |
168 |
|
Integer zPersistingAt = findPersistingASCDindex( scd ); |
177 |
169 |
|
if ( (zPersistingAt != null) && (zPersistingAt <= mPrimaryKeyPersistingAccessorSCDsIndex) ) |
178 |
170 |
|
{ |
179 |
|
- |
throw new IllegalStateException( |
180 |
|
- |
"May not remove a column/attribute positioned at/before the Primay Key" ); |
|
171 |
+ |
throw new IllegalStateException( "May not remove a column/attribute positioned at/before the Primay Key" ); |
181 |
172 |
|
} |
182 |
173 |
|
} |
183 |
174 |
|
mAccessorSCDsByName.remove( makeCaseInsensitive( pAttributeName ) ); |
|
@@ -188,8 +179,7 @@ |
188 |
179 |
|
mToOneAccessorSCDsThatFlagPeerChange, scd ); |
189 |
180 |
|
mToOneAccessorSCDsThatFlagPeerChangeNotification = // |
190 |
181 |
|
AbstractAttributeAccessorSCDtoOne.remove( // |
191 |
|
- |
mToOneAccessorSCDsThatFlagPeerChangeNotification, |
192 |
|
- |
scd ); |
|
182 |
+ |
mToOneAccessorSCDsThatFlagPeerChangeNotification, scd ); |
193 |
183 |
|
} |
194 |
184 |
|
} |
195 |
185 |
|
|
|
@@ -449,8 +439,7 @@ |
449 |
439 |
|
return mToOneAccessorSCDsThatFlagPeerChangeNotification; |
450 |
440 |
|
} |
451 |
441 |
|
|
452 |
|
- |
@SuppressWarnings({"unchecked"}) |
453 |
|
- |
@Override |
|
442 |
+ |
@SuppressWarnings({"unchecked"}) @Override |
454 |
443 |
|
public final PersistentObjectUniqueKey createUniqueKeyFrom( String pKeyToString ) |
455 |
444 |
|
throws IllegalArgumentException |
456 |
445 |
|
{ |
|
@@ -459,8 +448,7 @@ |
459 |
448 |
|
throw new IllegalArgumentException( mIdentifierName + " does not have Uniqueness" ); |
460 |
449 |
|
} |
461 |
450 |
|
AttributeAccessorSCD[] zAASCDs = mKeySet.getKeyAttributeAccessorSCDs(); |
462 |
|
- |
return (zAASCDs.length == 1) ? new UniqueKeySingle( pKeyToString, zAASCDs[0] ) : |
463 |
|
- |
new UniqueKeyMulti( pKeyToString, zAASCDs ); |
|
451 |
+ |
return (zAASCDs.length == 1) ? new UniqueKeySingle( pKeyToString, zAASCDs[0] ) : new UniqueKeyMulti( pKeyToString, zAASCDs ); |
464 |
452 |
|
} |
465 |
453 |
|
|
466 |
454 |
|
@Override |