|
@@ -1,62 +1,62 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.aokeyhole.objects; |
3 |
|
- |
|
4 |
|
- |
import java.util.*; |
5 |
|
- |
|
6 |
|
- |
public abstract class AttributeSet { |
7 |
|
- |
public static final int SORT_ID = -100; |
8 |
|
- |
public static final int SORT_BridgeToOneLeft = -51; |
9 |
|
- |
public static final int SORT_PairedToOne = -50; |
10 |
|
- |
public static final int SORT_BridgeToOneRight = -49; |
11 |
|
- |
public static final int SORT_ToMany = 50; |
12 |
|
- |
|
13 |
|
- |
private int mSortIndex; |
14 |
|
- |
private AttributeType mType; |
15 |
|
- |
private ASet mPersisted, mVirtual; |
16 |
|
- |
|
17 |
|
- |
protected AttributeSet( AttributeSetBuilder pBuilder ) { |
18 |
|
- |
mSortIndex = pBuilder.getSortIndex(); |
19 |
|
- |
mType = pBuilder.getType(); |
20 |
|
- |
mPersisted = pBuilder.getPersisted(); |
21 |
|
- |
mVirtual = pBuilder.getVirtual(); |
22 |
|
- |
} |
23 |
|
- |
|
24 |
|
- |
public int getSortIndex() { |
25 |
|
- |
return mSortIndex; |
26 |
|
- |
} |
27 |
|
- |
|
28 |
|
- |
public AttributeType getType() { |
29 |
|
- |
return mType; |
30 |
|
- |
} |
31 |
|
- |
|
32 |
|
- |
abstract public boolean isUiCreatable(); |
33 |
|
- |
|
34 |
|
- |
abstract public boolean isUiDeleteable(); |
35 |
|
- |
|
36 |
|
- |
public ASet getPersisted() { |
37 |
|
- |
return mPersisted; |
38 |
|
- |
} |
39 |
|
- |
|
40 |
|
- |
public ASet getVirtual() { |
41 |
|
- |
return mVirtual; |
42 |
|
- |
} |
43 |
|
- |
|
44 |
|
- |
public boolean isNameEditable() { |
45 |
|
- |
return true; |
46 |
|
- |
} |
47 |
|
- |
|
48 |
|
- |
public void addTypeOptions( List<String> pTypes ) { |
49 |
|
- |
String zType = mType.toString(); |
50 |
|
- |
if ( mPersisted != null ) { |
51 |
|
- |
pTypes.add( zType ); |
52 |
|
- |
} |
53 |
|
- |
if ( mVirtual != null ) { |
54 |
|
- |
pTypes.add( zType + " (virtual)" ); |
55 |
|
- |
} |
56 |
|
- |
} |
57 |
|
- |
|
58 |
|
- |
public boolean isAcceptableAsRelatedTo( ObjectMetaData pObjectMetaData, boolean pVirtual ) { |
59 |
|
- |
ASet zASet = pVirtual ? getVirtual() : getPersisted(); |
60 |
|
- |
return zASet.isAcceptableAsRelatedTo( pObjectMetaData ); |
61 |
|
- |
} |
62 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.aokeyhole.objects; |
|
3 |
+ |
|
|
4 |
+ |
import java.util.*; |
|
5 |
+ |
|
|
6 |
+ |
public abstract class AttributeSet { |
|
7 |
+ |
public static final int SORT_ID = -100; |
|
8 |
+ |
public static final int SORT_BridgeToOneLeft = -51; |
|
9 |
+ |
public static final int SORT_PairedToOne = -50; |
|
10 |
+ |
public static final int SORT_BridgeToOneRight = -49; |
|
11 |
+ |
public static final int SORT_ToMany = 50; |
|
12 |
+ |
|
|
13 |
+ |
private int mSortIndex; |
|
14 |
+ |
private AttributeType mType; |
|
15 |
+ |
private ASet mPersisted, mVirtual; |
|
16 |
+ |
|
|
17 |
+ |
protected AttributeSet( AttributeSetBuilder pBuilder ) { |
|
18 |
+ |
mSortIndex = pBuilder.getSortIndex(); |
|
19 |
+ |
mType = pBuilder.getType(); |
|
20 |
+ |
mPersisted = pBuilder.getPersisted(); |
|
21 |
+ |
mVirtual = pBuilder.getVirtual(); |
|
22 |
+ |
} |
|
23 |
+ |
|
|
24 |
+ |
public int getSortIndex() { |
|
25 |
+ |
return mSortIndex; |
|
26 |
+ |
} |
|
27 |
+ |
|
|
28 |
+ |
public AttributeType getType() { |
|
29 |
+ |
return mType; |
|
30 |
+ |
} |
|
31 |
+ |
|
|
32 |
+ |
abstract public boolean isUiCreatable(); |
|
33 |
+ |
|
|
34 |
+ |
abstract public boolean isUiDeleteable(); |
|
35 |
+ |
|
|
36 |
+ |
public ASet getPersisted() { |
|
37 |
+ |
return mPersisted; |
|
38 |
+ |
} |
|
39 |
+ |
|
|
40 |
+ |
public ASet getVirtual() { |
|
41 |
+ |
return mVirtual; |
|
42 |
+ |
} |
|
43 |
+ |
|
|
44 |
+ |
public boolean isNameEditable() { |
|
45 |
+ |
return true; |
|
46 |
+ |
} |
|
47 |
+ |
|
|
48 |
+ |
public void addTypeOptions( List<String> pTypes ) { |
|
49 |
+ |
String zType = mType.toString(); |
|
50 |
+ |
if ( mPersisted != null ) { |
|
51 |
+ |
pTypes.add( zType ); |
|
52 |
+ |
} |
|
53 |
+ |
if ( mVirtual != null ) { |
|
54 |
+ |
pTypes.add( zType + " (virtual)" ); |
|
55 |
+ |
} |
|
56 |
+ |
} |
|
57 |
+ |
|
|
58 |
+ |
public boolean isAcceptableAsRelatedTo( ObjectMetaData pObjectMetaData, boolean pVirtual ) { |
|
59 |
+ |
ASet zASet = pVirtual ? getVirtual() : getPersisted(); |
|
60 |
+ |
return zASet.isAcceptableAsRelatedTo( pObjectMetaData ); |
|
61 |
+ |
} |
|
62 |
+ |
} |