Andrew Hind 1d8438e7bf ALF-8990: RSOLR 032: Model track and build from SOLR
- SOLR tracking now reflects all models loaded and changed on the repo to which it points 
- model tracking and related fixes
- model XML now round trips for Boolean properties :-)
- upgraded to latest version of jibx - 1.2.3
- added API to load models and not class load constraint extensions (does not affect the generated model XML only constraint enforcement)
- removed solr specific m2 model binding
- fixed SOLR tracking test

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28714 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2011-06-30 09:18:46 +00:00

56 lines
1.2 KiB
Java

package org.alfresco.repo.solr;
import org.alfresco.service.cmr.dictionary.ModelDefinition;
/**
* Represents an alfresco model and checksum.
*
* @since 4.0
*/
public class AlfrescoModel
{
private ModelDefinition modelDef;
private long checksum;
protected AlfrescoModel(ModelDefinition modelDef)
{
this.modelDef = modelDef;
this.checksum = modelDef.getChecksum(ModelDefinition.XMLBindingType.DEFAULT);
}
public ModelDefinition getModelDef()
{
return modelDef;
}
public long getChecksum()
{
return checksum;
}
public boolean equals(Object other)
{
if (this == other)
{
return true;
}
if(!(other instanceof AlfrescoModel))
{
return false;
}
AlfrescoModel model = (AlfrescoModel)other;
return (modelDef.getName().equals(model.getModelDef().getName()) &&
checksum == model.getChecksum());
}
public int hashcode()
{
int result = 17;
result = 31 * result + modelDef.hashCode();
result = 31 * result + Long.valueOf(checksum).hashCode();
return result;
}
}