{
private static final Logger logger = Logger.getLogger(MolgenisModel.class.getSimpleName());
public static Model parse(MolgenisOptions options) throws Exception
{
Model model = null;
try
{
logger.info("parsing db-schema from " + options.model_database);
// 19-4-2011 ER: unused code, so commented out!
// ArrayList<String> db_files = options.model_database;
// for (int i = 0; i < db_files.size(); i++)
// db_files.set(i, options.path + db_files.get(i));
model = MolgenisModelParser.parseDbSchema(options.model_database);
// Get the strings of the property 'authorizable' and add the entity
// name
// 'Authorizable' to the list of Implements. Solves datamodel
// duplication
// in molgenis_apps suite. Possible future work: put auth
// dependencies into
// molgenis itself so it becomes generic across projects.
for (String eName : options.authorizable)
{
eName = eName.trim(); // allow e.g. 'Observation, Investigation'
Vector<String> implNames = model.getEntity(eName).getImplementsNames();
if (!implNames.contains("Authorizable"))
{
implNames.add("Authorizable");
model.getEntity(eName).setImplements(implNames);
}
}
logger.debug("read: " + model);