public void setEntitySubtypeSchemaEnum(String schemaEnumId) { String[] params = TextUtils.getInstance().split(schemaEnumId, ",", true); if (params.length != 2) log.error( "the entity-subtype-schema-enum attribute in the entity page requires 2 params: schema.enum-table,enum-id-or-caption"); else { Project project = getOwner().getProject(); Table table = project.getSchemas().getTable(params[0]); if (table == null || !(table instanceof EnumerationTable)) log.error( "the entity-subtype-schema-enum attribute in the entity page has an invalid schema.enum-table: " + params[0]); else { EnumerationTable enumTable = (EnumerationTable) table; EnumerationTableRows enumRows = (EnumerationTableRows) enumTable.getData(); EnumerationTableRow enumRow = enumRows.getByIdOrCaptionOrAbbrev(params[1]); if (enumRow == null) log.error( "the entity-subtype-schema-enum attribute in the entity page has an invalid enum value for " + params[0] + ": " + params[1]); else { setEntitySubtypeId(enumRow.getId()); setEntitySubtypeName(enumRow.getCaption()); } } } }
public void testEnumTableType() { EnumerationTable table = (EnumerationTable) populatedSchema.getTables().getByName("Enum_set_Lookup"); assertNotNull(table); EnumerationTableRows rows = table.getEnums(); assertEquals("Zero", rows.getEnumerationsPresentationValue().getTextValues()[0]); assertEquals("One", rows.getEnumerationsPresentationValue().getTextValues()[1]); assertEquals("Two", rows.getEnumerationsPresentationValue().getTextValues()[2]); assertNotNull(rows.getEnumerationsValue()); }