| 1 |
|
package net.sf.sapjcosupport; |
| 2 |
|
|
| 3 |
|
import java.util.Collection; |
| 4 |
|
import java.util.HashMap; |
| 5 |
|
import java.util.Map; |
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
public class SapStructureMapping { |
| 12 |
|
private String name; |
| 13 |
|
private Map fields; |
| 14 |
|
private String keyField, primaryKey; |
| 15 |
|
private short type; |
| 16 |
|
private boolean isExcluded; |
| 17 |
|
public static final short MAP = 0, LIST = 1, LIST_OF_MAPS = 2, NORMAL = 3, ENTITY = 4; |
| 18 |
|
|
| 19 |
|
private String entityClass; |
| 20 |
|
private String collectionName; |
| 21 |
|
|
| 22 |
0 |
public SapStructureMapping(String name, short type) { |
| 23 |
0 |
this.name = name; |
| 24 |
0 |
this.fields = new HashMap(); |
| 25 |
0 |
this.type = type; |
| 26 |
0 |
} |
| 27 |
|
|
| 28 |
|
public SapStructureMapping(String name) { |
| 29 |
0 |
this(name, NORMAL); |
| 30 |
0 |
} |
| 31 |
|
|
| 32 |
|
public String getName() { |
| 33 |
0 |
return name; |
| 34 |
|
} |
| 35 |
|
|
| 36 |
|
public short getType() { |
| 37 |
0 |
return type; |
| 38 |
|
} |
| 39 |
|
|
| 40 |
|
public void setType(short type) { |
| 41 |
0 |
this.type = type; |
| 42 |
0 |
} |
| 43 |
|
|
| 44 |
|
public String getEntityClass() { |
| 45 |
0 |
return entityClass; |
| 46 |
|
} |
| 47 |
|
|
| 48 |
|
public void setEntityClass(String entityClass) { |
| 49 |
0 |
this.entityClass = entityClass; |
| 50 |
0 |
} |
| 51 |
|
|
| 52 |
|
public String getCollectionName() { |
| 53 |
0 |
return collectionName; |
| 54 |
|
} |
| 55 |
|
|
| 56 |
|
public void setCollectionName(String collectionName) { |
| 57 |
0 |
this.collectionName = collectionName; |
| 58 |
0 |
} |
| 59 |
|
|
| 60 |
|
public Collection getFields() { |
| 61 |
0 |
return fields.values(); |
| 62 |
|
} |
| 63 |
|
|
| 64 |
|
public Map getFieldsMap() { |
| 65 |
0 |
return fields; |
| 66 |
|
} |
| 67 |
|
|
| 68 |
|
public void addField(SapFieldMapping field) { |
| 69 |
0 |
if (type == MAP || type == LIST_OF_MAPS) { |
| 70 |
0 |
fields.put(field.getKey(), field); |
| 71 |
|
} else { |
| 72 |
0 |
fields.put(field.getPropertyName(), field); |
| 73 |
|
} |
| 74 |
0 |
} |
| 75 |
|
|
| 76 |
|
public String getKeyField() { |
| 77 |
0 |
return keyField; |
| 78 |
|
} |
| 79 |
|
|
| 80 |
|
public void setKeyField(String keyField) { |
| 81 |
0 |
this.keyField = keyField; |
| 82 |
0 |
} |
| 83 |
|
|
| 84 |
|
public String getPrimaryKey() { |
| 85 |
0 |
return primaryKey; |
| 86 |
|
} |
| 87 |
|
|
| 88 |
|
public void setPrimaryKey(String pk) { |
| 89 |
0 |
primaryKey = pk; |
| 90 |
0 |
} |
| 91 |
|
|
| 92 |
|
public boolean isMap() { |
| 93 |
0 |
return type == MAP; |
| 94 |
|
} |
| 95 |
|
|
| 96 |
|
public boolean isList() { |
| 97 |
0 |
return type == LIST; |
| 98 |
|
} |
| 99 |
|
|
| 100 |
|
public boolean isListOfMaps() { |
| 101 |
0 |
return type == LIST_OF_MAPS; |
| 102 |
|
} |
| 103 |
|
|
| 104 |
|
public boolean isEntity() { |
| 105 |
0 |
return type == ENTITY; |
| 106 |
|
} |
| 107 |
|
|
| 108 |
|
public boolean isExcluded() { |
| 109 |
0 |
return isExcluded; |
| 110 |
|
} |
| 111 |
|
|
| 112 |
|
public void setExcluded(boolean excluded) { |
| 113 |
0 |
isExcluded = excluded; |
| 114 |
0 |
} |
| 115 |
|
} |