@Override public String getFullName(String packagePrefix) { return super.getFullName(null); } }
public String getFullName() { return getFullName(null); }
protected String getEntityFullName(DomainEntity domEntity) { if (domEntity == null) { return null; } else { return domEntity.getFullName(getPackageName()); } }
private static ClassDescriptor getOtherRoleClassDescriptor(Role role) { String classname = role.getOtherRole().getType().getFullName(); return getDescriptorTable().get(classname); }
@Override public int compare(Role one, Role other) { if (one.getName() == null) { return -1; } if (other.getName() == null) { return 1; } if (!one.getName().equals(other.getName())) { return one.getName().compareTo(other.getName()); } else { return one.getType().getFullName().compareTo(other.getType().getFullName()); } } };
protected String getDefaultCollectionFor(Role role) { return makeGenericType(getCollectionToUse(), role.getType().getFullName()); }
@Override protected void generateRelationAddMethodCall(Role role, String otherArg, String indexParam, PrintWriter out) { generateSetterDAPStatement(dC, role.getName(), role.getType().getFullName(), out); super.generateRelationAddMethodCall(role, otherArg, indexParam, out); }
@Override protected void generateRelationRemoveMethodCall(Role role, String otherArg, PrintWriter out) { generateSetterDAPStatement(dC, role.getName(), role.getType().getFullName(), out); super.generateRelationRemoveMethodCall(role, otherArg, out); }
protected void generateStaticKeyFunctionForRole(Role role, PrintWriter out) { if (role.getMultiplicityUpper() != 1) { println(out, generateMapKeyFunction(role.getName(), role.getType().getFullName(), "Comparable<?>", "Oid", false)); } }
@Override protected String getDefaultCollectionFor(Role role) { if (role.isIndexed() && role.getIndexCardinality() == Role.MULTIPLICITY_MANY) { return makeGenericType(getCollectionToUse(), makeGenericType(LINKED_LIST_FULL_CLASS, role.getType().getFullName())); } else { return super.getDefaultCollectionFor(role); } }
private static void updateCollectionDescriptorWithCommonSettings(final ClassDescriptor classDescriptor, Class<?> persistentFieldClass, Role role, String roleName, CollectionDescriptor collectionDescriptor) throws ClassNotFoundException { collectionDescriptor.setItemClass(Class.forName(role.getType().getFullName())); collectionDescriptor.setPersistentField(new WriteOnlyPersistentField(persistentFieldClass, roleName)); collectionDescriptor.setRefresh(false); collectionDescriptor.setCascadingStore(ObjectReferenceDescriptor.CASCADE_NONE); collectionDescriptor.setCollectionClass(OJBFunctionalSetWrapper.class); collectionDescriptor.setCascadeRetrieve(false); collectionDescriptor.setLazy(false); classDescriptor.addCollectionDescriptor(collectionDescriptor); }
@Override protected void generateRelationGetter(String getterName, String valueToReturn, Role role, String typeName, PrintWriter out) { newline(out); printFinalMethod(out, "public", typeName, getterName); startMethodBody(out); generateGetterDAPStatement(dC, role.getName(), role.getType().getFullName(), out); generateRelationGetterBody(role, out); endMethodBody(out); }
protected void generateRoleSlotMethodsMultStarGetter(String methodName, Role role, PrintWriter out) { newline(out); printFinalMethod(out, "public", getSetTypeDeclarationFor(role), methodName); startMethodBody(out); generateGetterDAPStatement(dC, role.getName(), role.getType().getFullName(), out);//DAP read stats update statement generateRoleStarGetterBody(role.getName(), getTypeFullName(role.getType()), out); endMethodBody(out); }
@Override protected void generateStaticKeyFunctionForRole(Role role, PrintWriter out) { if (role.isIndexed()) { onNewline(out); Slot indexedSlot = getIndexedSlot(role); String keyField = role.getIndexProperty(); println(out, generateMapKeyFunction(role.getName(), role.getType().getFullName(), indexedSlot.getSlotType().getFullname(), keyField, role.getIndexCardinality() == Role.MULTIPLICITY_MANY)); onNewline(out); } else { super.generateStaticKeyFunctionForRole(role, out); } }
protected void generateRoleSlotMethodsMultStarIndexed(Role role, PrintWriter out, String methodModifiers, String capitalizedSlotName, String slotAccessExpression, String typeName, String slotName) { Slot indexedSlot = getIndexedSlot(role); String keyField = role.getIndexProperty(); String retType = role.getType().getFullName(); String methodNameSufix = ""; boolean haveMany = role.getIndexCardinality() == Role.MULTIPLICITY_MANY; if (haveMany) { retType = makeGenericType("java.util.Set", retType); } onNewline(out); printMethod(out, "public", retType, "get" + capitalize(role.getName()) + "By" + capitalize(keyField) + methodNameSufix, indexedSlot.getSlotType().getFullname() + " key"); startMethodBody(out); printWords(out, "return", getSearchForKey(role, haveMany ? getCollectionToUse() : retType)); print(out, ";"); endMethodBody(out); }
private void generateDeprecatedGetters(Role role, PrintWriter out) { newline(out); println(out, "@Deprecated"); printMethod(out, "public", makeGenericType("java.util.Set", role.getType().getFullName()), "get" + capitalize(role.getName())); startMethodBody(out); print(out, "return get" + capitalize(role.getName()) + "Set();"); endMethodBody(out); newline(out); println(out, "@Deprecated"); printMethod(out, "public", "int", "get" + capitalize(role.getName()) + "Count"); startMethodBody(out); print(out, "return get" + capitalize(role.getName()) + "Set().size();"); endMethodBody(out); } }
@Override protected void generateRoleSlotMethodsMultStarGetter(String methodName, Role role, PrintWriter out) { newline(out); printFinalMethod(out, "public", getSetTypeDeclarationFor(role), methodName); startMethodBody(out); generateGetterDAPStatement(dC, role.getName(), role.getType().getFullName(), out);//DAP read stats update statement print(out, "return new "); print(out, getRelationAwareTypeFor(role)); print(out, "(("); print(out, getTypeFullName(role.getOtherRole().getType())); print(out, ") this, "); print(out, getRelationMethodNameFor(role)); print(out, ", this."); print(out, role.getName()); print(out, ", keyFunction$$"); print(out, role.getName()); print(out, ");"); endMethodBody(out); }
@Override protected void generateRelationGetter(String getterName, String valueToReturn, Role role, String typeName, PrintWriter out) { newline(out); printFinalMethod(out, "public", typeName, getterName); startMethodBody(out); generateGetterDAPStatement(dC, role.getName(), role.getType().getFullName(), out); String collectionType = getDefaultCollectionFor(role); println(out, collectionType + " internalSet = OgmBackEnd.getInstance().getDomainObject(" + makeForeignKeyName(role.getName()) + ");"); print(out, "return new "); print(out, getRelationAwareTypeFor(role)); print(out, "(("); print(out, getTypeFullName(role.getOtherRole().getType())); print(out, ") this, "); print(out, getRelationMethodNameFor(role)); print(out, ", internalSet, keyFunction$$"); print(out, role.getName()); print(out, ");"); endMethodBody(out); }
protected void generateRoleSlotMethodsMultStarGetter(Role role, PrintWriter out) { newline(out); printFinalMethod(out, "public", getSetTypeDeclarationFor(role), "get" + capitalize(role.getName()) + "Set"); startMethodBody(out); generateGetterDAPStatement(dC, role.getName(), role.getType().getFullName(), out);//DAP read stats update statement String collectionType = getDefaultCollectionFor(role); println(out, collectionType + " internalSet;"); println(out, "Object oid = InfinispanBackEnd.getInstance().cacheGet(getOid().getFullId() + \":" + role.getName() + "\");"); print(out, "if (oid == null || oid instanceof Externalization.NullClass)"); newBlock(out); println(out, "internalSet = new " + collectionType + "();"); print(out, "InfinispanBackEnd.getInstance().cachePut(getOid().getFullId() + \":" + role.getName() + "\", internalSet.getOid());"); closeBlock(out, false); print(out, " else"); newBlock(out); print(out, "internalSet = (" + collectionType + ")InfinispanBackEnd.getInstance().fromOid(oid);"); // print(out, "// no need to test for null. The entry must exist for sure."); closeBlock(out); print(out, "return new "); print(out, getRelationAwareTypeFor(role)); print(out, "(("); print(out, getTypeFullName(role.getOtherRole().getType())); print(out, ") this, "); print(out, getRelationMethodNameFor(role)); print(out, ", internalSet, keyFunction$$"); print(out, role.getName()); print(out, ");"); endMethodBody(out); }
print(out, relationSlotName + ".relation"); } else { print(out, role.getType().getFullName() + "." + methodName + "()");