Performance tweak to Dictionary for MT case - reduce number of getCurrentUserName() calls

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6780 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2007-09-13 16:56:44 +00:00
parent c872cb5bc5
commit fc1533b4a3
2 changed files with 58 additions and 71 deletions

View File

@@ -142,7 +142,7 @@ public class DictionaryDAOImpl implements DictionaryDAO
*/ */
public void init() public void init()
{ {
String tenantDomain = getTenantDomain(); String tenantDomain = tenantService.getCurrentUserDomain();
// initialise empty dictionary & namespaces // initialise empty dictionary & namespaces
putCompiledModels(tenantDomain, new HashMap<QName,CompiledModel>()); putCompiledModels(tenantDomain, new HashMap<QName,CompiledModel>());
@@ -164,7 +164,7 @@ public class DictionaryDAOImpl implements DictionaryDAO
*/ */
public void destroy() public void destroy()
{ {
String tenantDomain = getTenantDomain(); String tenantDomain = tenantService.getCurrentUserDomain();
removeCompiledModels(tenantDomain); removeCompiledModels(tenantDomain);
removeUriToModels(tenantDomain); removeUriToModels(tenantDomain);
@@ -179,7 +179,7 @@ public class DictionaryDAOImpl implements DictionaryDAO
*/ */
public void reset() public void reset()
{ {
reset(getTenantDomain()); reset(tenantService.getCurrentUserDomain());
} }
private void reset(String tenantDomain) private void reset(String tenantDomain)
@@ -221,23 +221,25 @@ public class DictionaryDAOImpl implements DictionaryDAO
*/ */
public QName putModel(M2Model model) public QName putModel(M2Model model)
{ {
String tenantDomain = tenantService.getCurrentUserDomain();
// Compile model definition // Compile model definition
CompiledModel compiledModel = model.compile(this, namespaceDAO); CompiledModel compiledModel = model.compile(this, namespaceDAO);
QName modelName = compiledModel.getModelDefinition().getName(); QName modelName = compiledModel.getModelDefinition().getName();
// Remove namespace definitions for previous model, if it exists // Remove namespace definitions for previous model, if it exists
CompiledModel previousVersion = getCompiledModels().get(modelName); CompiledModel previousVersion = getCompiledModels(tenantDomain).get(modelName);
if (previousVersion != null) if (previousVersion != null)
{ {
for (M2Namespace namespace : previousVersion.getM2Model().getNamespaces()) for (M2Namespace namespace : previousVersion.getM2Model().getNamespaces())
{ {
namespaceDAO.removePrefix(namespace.getPrefix()); namespaceDAO.removePrefix(namespace.getPrefix());
namespaceDAO.removeURI(namespace.getUri()); namespaceDAO.removeURI(namespace.getUri());
unmapUriToModel(namespace.getUri(), previousVersion); unmapUriToModel(namespace.getUri(), previousVersion, tenantDomain);
} }
for (M2Namespace importNamespace : previousVersion.getM2Model().getImports()) for (M2Namespace importNamespace : previousVersion.getM2Model().getImports())
{ {
unmapUriToModel(importNamespace.getUri(), previousVersion); unmapUriToModel(importNamespace.getUri(), previousVersion, tenantDomain);
} }
} }
@@ -246,15 +248,15 @@ public class DictionaryDAOImpl implements DictionaryDAO
{ {
namespaceDAO.addURI(namespace.getUri()); namespaceDAO.addURI(namespace.getUri());
namespaceDAO.addPrefix(namespace.getPrefix(), namespace.getUri()); namespaceDAO.addPrefix(namespace.getPrefix(), namespace.getUri());
mapUriToModel(namespace.getUri(), compiledModel); mapUriToModel(namespace.getUri(), compiledModel, tenantDomain);
} }
for (M2Namespace importNamespace : model.getImports()) for (M2Namespace importNamespace : model.getImports())
{ {
mapUriToModel(importNamespace.getUri(), compiledModel); mapUriToModel(importNamespace.getUri(), compiledModel, tenantDomain);
} }
// Publish new Model Definition // Publish new Model Definition
getCompiledModels().put(modelName, compiledModel); getCompiledModels(tenantDomain).put(modelName, compiledModel);
if (logger.isInfoEnabled()) if (logger.isInfoEnabled())
{ {
@@ -274,7 +276,9 @@ public class DictionaryDAOImpl implements DictionaryDAO
*/ */
public void removeModel(QName modelName) public void removeModel(QName modelName)
{ {
CompiledModel compiledModel = getCompiledModels().get(modelName); String tenantDomain = tenantService.getCurrentUserDomain();
CompiledModel compiledModel = getCompiledModels(tenantDomain).get(modelName);
if (compiledModel != null) if (compiledModel != null)
{ {
// Remove the namespaces from the namespace service // Remove the namespaces from the namespace service
@@ -283,11 +287,11 @@ public class DictionaryDAOImpl implements DictionaryDAO
{ {
namespaceDAO.removePrefix(namespace.getPrefix()); namespaceDAO.removePrefix(namespace.getPrefix());
namespaceDAO.removeURI(namespace.getUri()); namespaceDAO.removeURI(namespace.getUri());
unmapUriToModel(namespace.getUri(), compiledModel); unmapUriToModel(namespace.getUri(), compiledModel, tenantDomain);
} }
// Remove the model from the list // Remove the model from the list
getCompiledModels().remove(modelName); getCompiledModels(tenantDomain).remove(modelName);
} }
} }
@@ -297,10 +301,11 @@ public class DictionaryDAOImpl implements DictionaryDAO
* *
* @param uri namespace uri * @param uri namespace uri
* @param model model * @param model model
* @param tenantDomain
*/ */
private void mapUriToModel(String uri, CompiledModel model) private void mapUriToModel(String uri, CompiledModel model, String tenantDomain)
{ {
List<CompiledModel> models = getUriToModels().get(uri); List<CompiledModel> models = getUriToModels(tenantDomain).get(uri);
if (models == null) if (models == null)
{ {
models = new ArrayList<CompiledModel>(); models = new ArrayList<CompiledModel>();
@@ -318,10 +323,11 @@ public class DictionaryDAOImpl implements DictionaryDAO
* *
* @param uri namespace uri * @param uri namespace uri
* @param model model * @param model model
* @param tenantDomain
*/ */
private void unmapUriToModel(String uri, CompiledModel model) private void unmapUriToModel(String uri, CompiledModel model, String tenantDomain)
{ {
List<CompiledModel> models = getUriToModels().get(uri); List<CompiledModel> models = getUriToModels(tenantDomain).get(uri);
if (models != null) if (models != null)
{ {
models.remove(model); models.remove(model);
@@ -337,7 +343,8 @@ public class DictionaryDAOImpl implements DictionaryDAO
*/ */
private List<CompiledModel> getModelsForUri(String uri) private List<CompiledModel> getModelsForUri(String uri)
{ {
if (tenantService.isEnabled()) String tenantDomain = tenantService.getCurrentUserDomain();
if (tenantDomain != "")
{ {
// note: special case, if running as System - e.g. addAuditAspect // note: special case, if running as System - e.g. addAuditAspect
String currentUserName = AuthenticationUtil.getCurrentUserName(); String currentUserName = AuthenticationUtil.getCurrentUserName();
@@ -347,15 +354,10 @@ public class DictionaryDAOImpl implements DictionaryDAO
if ((tenantService.isTenantUser(currentUserName)) || if ((tenantService.isTenantUser(currentUserName)) ||
(currentUserName.equals(AuthenticationUtil.getSystemUserName()) && tenantService.isTenantName(uri))) (currentUserName.equals(AuthenticationUtil.getSystemUserName()) && tenantService.isTenantName(uri)))
{ {
String tenantDomain = null;
if (currentUserName.equals(AuthenticationUtil.getSystemUserName())) if (currentUserName.equals(AuthenticationUtil.getSystemUserName()))
{ {
tenantDomain = tenantService.getDomain(uri); tenantDomain = tenantService.getDomain(uri);
} }
else
{
tenantDomain = tenantService.getCurrentUserDomain();
}
uri = tenantService.getBaseName(uri, true); uri = tenantService.getBaseName(uri, true);
// get non-tenant models (if any) // get non-tenant models (if any)
@@ -413,10 +415,11 @@ public class DictionaryDAOImpl implements DictionaryDAO
*/ */
private CompiledModel getCompiledModel(QName modelName) private CompiledModel getCompiledModel(QName modelName)
{ {
if (tenantService.isTenantUser()) String tenantDomain = tenantService.getCurrentUserDomain();
if (tenantDomain != "")
{ {
// get tenant-specific model (if any) // get tenant-specific model (if any)
CompiledModel model = getCompiledModels().get(modelName); CompiledModel model = getCompiledModels(tenantDomain).get(modelName);
if (model != null) if (model != null)
{ {
return model; return model;
@@ -458,10 +461,11 @@ public class DictionaryDAOImpl implements DictionaryDAO
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public DataTypeDefinition getDataType(Class javaClass) public DataTypeDefinition getDataType(Class javaClass)
{ {
if (tenantService.isTenantUser() == true) String tenantDomain = tenantService.getCurrentUserDomain();
if (tenantDomain != "")
{ {
// get tenant models (if any) // get tenant models (if any)
for (CompiledModel model : getCompiledModels().values()) for (CompiledModel model : getCompiledModels(tenantDomain).values())
{ {
DataTypeDefinition dataTypeDef = model.getDataType(javaClass); DataTypeDefinition dataTypeDef = model.getDataType(javaClass);
if (dataTypeDef != null) if (dataTypeDef != null)
@@ -484,7 +488,7 @@ public class DictionaryDAOImpl implements DictionaryDAO
} }
else else
{ {
for (CompiledModel model : getCompiledModels().values()) for (CompiledModel model : getCompiledModels("").values())
{ {
DataTypeDefinition dataTypeDef = model.getDataType(javaClass); DataTypeDefinition dataTypeDef = model.getDataType(javaClass);
if (dataTypeDef != null) if (dataTypeDef != null)
@@ -625,7 +629,8 @@ public class DictionaryDAOImpl implements DictionaryDAO
*/ */
public Collection<QName> getModels() public Collection<QName> getModels()
{ {
if (tenantService.isTenantUser()) String tenantDomain = tenantService.getCurrentUserDomain();
if (tenantDomain != "")
{ {
// return all tenant-specific models and all shared (non-overridden) models // return all tenant-specific models and all shared (non-overridden) models
Collection<QName> filteredModels = new ArrayList<QName>(); Collection<QName> filteredModels = new ArrayList<QName>();
@@ -633,7 +638,7 @@ public class DictionaryDAOImpl implements DictionaryDAO
Collection<QName> nontenantModels = new ArrayList<QName>(); Collection<QName> nontenantModels = new ArrayList<QName>();
// get tenant models (if any) // get tenant models (if any)
for (QName key : getCompiledModels().keySet()) for (QName key : getCompiledModels(tenantDomain).keySet())
{ {
tenantModels.add(key); tenantModels.add(key);
} }
@@ -666,14 +671,14 @@ public class DictionaryDAOImpl implements DictionaryDAO
} }
else else
{ {
return getCompiledModels().keySet(); return getCompiledModels("").keySet();
} }
} }
// used for clean-up, e.g. when deleting a tenant // used for clean-up, e.g. when deleting a tenant
protected Collection<QName> getNonSharedModels() protected Collection<QName> getNonSharedModels()
{ {
return getCompiledModels().keySet(); return getCompiledModels(tenantService.getCurrentUserDomain()).keySet();
} }
/* (non-Javadoc) /* (non-Javadoc)
@@ -782,23 +787,13 @@ public class DictionaryDAOImpl implements DictionaryDAO
return namespaces; return namespaces;
} }
/**
* Get compiledModels from the cache (in the context of the current user's tenant domain)
*
* @param tenantDomain
*/
/* package */ Map<QName,CompiledModel> getCompiledModels()
{
return getCompiledModels(getTenantDomain());
}
/** /**
* Get compiledModels from the cache (in the context of the given tenant domain) * Get compiledModels from the cache (in the context of the given tenant domain)
* *
* @param tenantDomain * @param tenantDomain
*/ */
private Map<QName,CompiledModel> getCompiledModels(String tenantDomain) /* package */ Map<QName,CompiledModel> getCompiledModels(String tenantDomain)
{ {
Map<QName,CompiledModel> compiledModels = null; Map<QName,CompiledModel> compiledModels = null;
try try
@@ -883,7 +878,7 @@ public class DictionaryDAOImpl implements DictionaryDAO
*/ */
private Map<String, List<CompiledModel>> getUriToModels() private Map<String, List<CompiledModel>> getUriToModels()
{ {
return getUriToModels(getTenantDomain()); return getUriToModels(tenantService.getCurrentUserDomain());
} }
/** /**
@@ -968,14 +963,6 @@ public class DictionaryDAOImpl implements DictionaryDAO
} }
} }
/**
* Local helper - returns tenant domain (or empty string if default non-tenant)
*/
private String getTenantDomain()
{
return tenantService.getCurrentUserDomain();
}
/** /**
* Return diffs between input model and model in the Dictionary. * Return diffs between input model and model in the Dictionary.
* *
@@ -991,7 +978,7 @@ public class DictionaryDAOImpl implements DictionaryDAO
CompiledModel compiledModel = model.compile(this, namespaceDAO); CompiledModel compiledModel = model.compile(this, namespaceDAO);
QName modelName = compiledModel.getModelDefinition().getName(); QName modelName = compiledModel.getModelDefinition().getName();
CompiledModel previousVersion = getCompiledModels().get(modelName); CompiledModel previousVersion = getCompiledModels(tenantService.getCurrentUserDomain()).get(modelName);
if (previousVersion == null) if (previousVersion == null)
{ {
return new ArrayList<M2ModelDiff>(0); return new ArrayList<M2ModelDiff>(0);

View File

@@ -806,7 +806,7 @@ public class DiffModelTest extends TestCase
M2Model model = M2Model.createModel(byteArrayInputStream); M2Model model = M2Model.createModel(byteArrayInputStream);
QName modelName = dictionaryDAO.putModel(model); QName modelName = dictionaryDAO.putModel(model);
CompiledModel previousVersion = dictionaryDAO.getCompiledModels().get(modelName); CompiledModel previousVersion = dictionaryDAO.getCompiledModels("").get(modelName);
List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModel(previousVersion, null); List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModel(previousVersion, null);
@@ -839,7 +839,7 @@ public class DiffModelTest extends TestCase
M2Model model = M2Model.createModel(byteArrayInputStream); M2Model model = M2Model.createModel(byteArrayInputStream);
QName modelName = dictionaryDAO.putModel(model); QName modelName = dictionaryDAO.putModel(model);
CompiledModel compiledModel = dictionaryDAO.getCompiledModels().get(modelName); CompiledModel compiledModel = dictionaryDAO.getCompiledModels("").get(modelName);
try try
{ {
@@ -859,7 +859,7 @@ public class DiffModelTest extends TestCase
M2Model model = M2Model.createModel(byteArrayInputStream); M2Model model = M2Model.createModel(byteArrayInputStream);
QName modelName = dictionaryDAO.putModel(model); QName modelName = dictionaryDAO.putModel(model);
CompiledModel newVersion = dictionaryDAO.getCompiledModels().get(modelName); CompiledModel newVersion = dictionaryDAO.getCompiledModels("").get(modelName);
List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModel(null, newVersion); List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModel(null, newVersion);
@@ -879,12 +879,12 @@ public class DiffModelTest extends TestCase
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(MODEL1_XML.getBytes()); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(MODEL1_XML.getBytes());
M2Model model = M2Model.createModel(byteArrayInputStream); M2Model model = M2Model.createModel(byteArrayInputStream);
QName modelName = dictionaryDAO.putModel(model); QName modelName = dictionaryDAO.putModel(model);
CompiledModel previousVersion = dictionaryDAO.getCompiledModels().get(modelName); CompiledModel previousVersion = dictionaryDAO.getCompiledModels("").get(modelName);
byteArrayInputStream = new ByteArrayInputStream(MODEL1_UPDATE1_XML.getBytes()); byteArrayInputStream = new ByteArrayInputStream(MODEL1_UPDATE1_XML.getBytes());
model = M2Model.createModel(byteArrayInputStream); model = M2Model.createModel(byteArrayInputStream);
modelName = dictionaryDAO.putModel(model); modelName = dictionaryDAO.putModel(model);
CompiledModel newVersion = dictionaryDAO.getCompiledModels().get(modelName); CompiledModel newVersion = dictionaryDAO.getCompiledModels("").get(modelName);
List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModel(previousVersion, newVersion); List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModel(previousVersion, newVersion);
@@ -911,12 +911,12 @@ public class DiffModelTest extends TestCase
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(MODEL2_XML.getBytes()); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(MODEL2_XML.getBytes());
M2Model model = M2Model.createModel(byteArrayInputStream); M2Model model = M2Model.createModel(byteArrayInputStream);
QName modelName = dictionaryDAO.putModel(model); QName modelName = dictionaryDAO.putModel(model);
CompiledModel previousVersion = dictionaryDAO.getCompiledModels().get(modelName); CompiledModel previousVersion = dictionaryDAO.getCompiledModels("").get(modelName);
byteArrayInputStream = new ByteArrayInputStream(MODEL2_EXTRA_PROPERTIES_XML.getBytes()); byteArrayInputStream = new ByteArrayInputStream(MODEL2_EXTRA_PROPERTIES_XML.getBytes());
model = M2Model.createModel(byteArrayInputStream); model = M2Model.createModel(byteArrayInputStream);
modelName = dictionaryDAO.putModel(model); modelName = dictionaryDAO.putModel(model);
CompiledModel newVersion = dictionaryDAO.getCompiledModels().get(modelName); CompiledModel newVersion = dictionaryDAO.getCompiledModels("").get(modelName);
List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModel(previousVersion, newVersion); List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModel(previousVersion, newVersion);
@@ -936,12 +936,12 @@ public class DiffModelTest extends TestCase
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(MODEL3_XML.getBytes()); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(MODEL3_XML.getBytes());
M2Model model = M2Model.createModel(byteArrayInputStream); M2Model model = M2Model.createModel(byteArrayInputStream);
QName modelName = dictionaryDAO.putModel(model); QName modelName = dictionaryDAO.putModel(model);
CompiledModel previousVersion = dictionaryDAO.getCompiledModels().get(modelName); CompiledModel previousVersion = dictionaryDAO.getCompiledModels("").get(modelName);
byteArrayInputStream = new ByteArrayInputStream(MODEL3_EXTRA_TYPES_AND_ASPECTS_XML.getBytes()); byteArrayInputStream = new ByteArrayInputStream(MODEL3_EXTRA_TYPES_AND_ASPECTS_XML.getBytes());
model = M2Model.createModel(byteArrayInputStream); model = M2Model.createModel(byteArrayInputStream);
modelName = dictionaryDAO.putModel(model); modelName = dictionaryDAO.putModel(model);
CompiledModel newVersion = dictionaryDAO.getCompiledModels().get(modelName); CompiledModel newVersion = dictionaryDAO.getCompiledModels("").get(modelName);
List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModel(previousVersion, newVersion); List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModel(previousVersion, newVersion);
@@ -964,12 +964,12 @@ public class DiffModelTest extends TestCase
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(MODEL5_XML.getBytes()); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(MODEL5_XML.getBytes());
M2Model model = M2Model.createModel(byteArrayInputStream); M2Model model = M2Model.createModel(byteArrayInputStream);
QName modelName = dictionaryDAO.putModel(model); QName modelName = dictionaryDAO.putModel(model);
CompiledModel previousVersion = dictionaryDAO.getCompiledModels().get(modelName); CompiledModel previousVersion = dictionaryDAO.getCompiledModels("").get(modelName);
byteArrayInputStream = new ByteArrayInputStream(MODEL5_EXTRA_ASSOCIATIONS_XML.getBytes()); byteArrayInputStream = new ByteArrayInputStream(MODEL5_EXTRA_ASSOCIATIONS_XML.getBytes());
model = M2Model.createModel(byteArrayInputStream); model = M2Model.createModel(byteArrayInputStream);
modelName = dictionaryDAO.putModel(model); modelName = dictionaryDAO.putModel(model);
CompiledModel newVersion = dictionaryDAO.getCompiledModels().get(modelName); CompiledModel newVersion = dictionaryDAO.getCompiledModels("").get(modelName);
List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModel(previousVersion, newVersion); List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModel(previousVersion, newVersion);
@@ -993,12 +993,12 @@ public class DiffModelTest extends TestCase
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(MODEL2_EXTRA_PROPERTIES_XML.getBytes()); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(MODEL2_EXTRA_PROPERTIES_XML.getBytes());
M2Model model = M2Model.createModel(byteArrayInputStream); M2Model model = M2Model.createModel(byteArrayInputStream);
QName modelName = dictionaryDAO.putModel(model); QName modelName = dictionaryDAO.putModel(model);
CompiledModel previousVersion = dictionaryDAO.getCompiledModels().get(modelName); CompiledModel previousVersion = dictionaryDAO.getCompiledModels("").get(modelName);
byteArrayInputStream = new ByteArrayInputStream(MODEL2_XML.getBytes()); byteArrayInputStream = new ByteArrayInputStream(MODEL2_XML.getBytes());
model = M2Model.createModel(byteArrayInputStream); model = M2Model.createModel(byteArrayInputStream);
modelName = dictionaryDAO.putModel(model); modelName = dictionaryDAO.putModel(model);
CompiledModel newVersion = dictionaryDAO.getCompiledModels().get(modelName); CompiledModel newVersion = dictionaryDAO.getCompiledModels("").get(modelName);
List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModel(previousVersion, newVersion); List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModel(previousVersion, newVersion);
@@ -1018,12 +1018,12 @@ public class DiffModelTest extends TestCase
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(MODEL3_EXTRA_TYPES_AND_ASPECTS_XML.getBytes()); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(MODEL3_EXTRA_TYPES_AND_ASPECTS_XML.getBytes());
M2Model model = M2Model.createModel(byteArrayInputStream); M2Model model = M2Model.createModel(byteArrayInputStream);
QName modelName = dictionaryDAO.putModel(model); QName modelName = dictionaryDAO.putModel(model);
CompiledModel previousVersion = dictionaryDAO.getCompiledModels().get(modelName); CompiledModel previousVersion = dictionaryDAO.getCompiledModels("").get(modelName);
byteArrayInputStream = new ByteArrayInputStream(MODEL3_XML.getBytes()); byteArrayInputStream = new ByteArrayInputStream(MODEL3_XML.getBytes());
model = M2Model.createModel(byteArrayInputStream); model = M2Model.createModel(byteArrayInputStream);
modelName = dictionaryDAO.putModel(model); modelName = dictionaryDAO.putModel(model);
CompiledModel newVersion = dictionaryDAO.getCompiledModels().get(modelName); CompiledModel newVersion = dictionaryDAO.getCompiledModels("").get(modelName);
List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModel(previousVersion, newVersion); List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModel(previousVersion, newVersion);
@@ -1046,12 +1046,12 @@ public class DiffModelTest extends TestCase
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(MODEL4_XML.getBytes()); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(MODEL4_XML.getBytes());
M2Model model = M2Model.createModel(byteArrayInputStream); M2Model model = M2Model.createModel(byteArrayInputStream);
QName modelName = dictionaryDAO.putModel(model); QName modelName = dictionaryDAO.putModel(model);
CompiledModel previousVersion = dictionaryDAO.getCompiledModels().get(modelName); CompiledModel previousVersion = dictionaryDAO.getCompiledModels("").get(modelName);
byteArrayInputStream = new ByteArrayInputStream(MODEL4_EXTRA_DEFAULT_ASPECT_XML.getBytes()); byteArrayInputStream = new ByteArrayInputStream(MODEL4_EXTRA_DEFAULT_ASPECT_XML.getBytes());
model = M2Model.createModel(byteArrayInputStream); model = M2Model.createModel(byteArrayInputStream);
modelName = dictionaryDAO.putModel(model); modelName = dictionaryDAO.putModel(model);
CompiledModel newVersion = dictionaryDAO.getCompiledModels().get(modelName); CompiledModel newVersion = dictionaryDAO.getCompiledModels("").get(modelName);
List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModel(previousVersion, newVersion); List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModel(previousVersion, newVersion);
@@ -1071,12 +1071,12 @@ public class DiffModelTest extends TestCase
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(MODEL5_EXTRA_ASSOCIATIONS_XML.getBytes()); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(MODEL5_EXTRA_ASSOCIATIONS_XML.getBytes());
M2Model model = M2Model.createModel(byteArrayInputStream); M2Model model = M2Model.createModel(byteArrayInputStream);
QName modelName = dictionaryDAO.putModel(model); QName modelName = dictionaryDAO.putModel(model);
CompiledModel previousVersion = dictionaryDAO.getCompiledModels().get(modelName); CompiledModel previousVersion = dictionaryDAO.getCompiledModels("").get(modelName);
byteArrayInputStream = new ByteArrayInputStream(MODEL5_XML.getBytes()); byteArrayInputStream = new ByteArrayInputStream(MODEL5_XML.getBytes());
model = M2Model.createModel(byteArrayInputStream); model = M2Model.createModel(byteArrayInputStream);
modelName = dictionaryDAO.putModel(model); modelName = dictionaryDAO.putModel(model);
CompiledModel newVersion = dictionaryDAO.getCompiledModels().get(modelName); CompiledModel newVersion = dictionaryDAO.getCompiledModels("").get(modelName);
List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModel(previousVersion, newVersion); List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModel(previousVersion, newVersion);