Exemple #1
0
 public AllTermsCache(CompassSettings settings, CompassMapping mapping) {
   for (ResourceMapping resourceMapping : mapping.getRootMappings()) {
     if (resourceMapping.getAllMapping().isExcludeAlias()) {
       aliasTokensPerRootAlias.put(resourceMapping.getAlias(), new Token[0]);
     } else {
       List<Token> aliasTokens = new ArrayList<Token>();
       aliasTokens.add(
           new Token(
               resourceMapping.getAlias().toLowerCase(), 0, resourceMapping.getAlias().length()));
       for (String extendedAlias : resourceMapping.getExtendedAliases()) {
         aliasTokens.add(new Token(extendedAlias.toLowerCase(), 0, extendedAlias.length()));
       }
       aliasTokensPerRootAlias.put(
           resourceMapping.getAlias(), aliasTokens.toArray(new Token[aliasTokens.size()]));
     }
   }
 }
 public Resource marshall(Object root) {
   if (root instanceof AliasedObject) {
     return marshall(((AliasedObject) root).getAlias(), root);
   }
   ResourceMapping resourceMapping = mapping.getRootMappingByClass(root.getClass());
   if (resourceMapping == null) {
     return null;
   }
   Resource resource = resourceFactory.createResource(resourceMapping.getAlias());
   resourceMapping.getConverter().marshall(resource, root, resourceMapping, createContext());
   return resource;
 }
Exemple #3
0
 public ResourceKey(ResourceMapping resourceMapping, Property[] ids) {
   this.resourceMapping = resourceMapping;
   this.ids = ids;
   this.alias = resourceMapping.getAlias();
 }
 public Resource marshallIds(ResourceMapping resourceMapping, Object id) {
   Resource idResource = resourceFactory.createResource(resourceMapping.getAlias());
   marshallIds(idResource, resourceMapping, id, createContext());
   return idResource;
 }