Package org.jboss.seam.wiki.util

Examples of org.jboss.seam.wiki.util.Hash


    public String getArchiveCacheKeyAppendix() {
        StringBuilder builder = new StringBuilder();
        if (tag != null && Math.abs(tag.hashCode()) != 0) builder.append(Math.abs(tag.hashCode()));
        builder.append(WikiUtil.dateAsString(year, month, day));
        Hash hash = (Hash)Component.getInstance(Hash.class);
        return hash.hash(builder.toString());
    }
View Full Code Here


    }

    public String getCacheKey(Object... objects) {
        WikiDocument currentDocument = (WikiDocument)Component.getInstance("currentDocument");
        Integer accessLevel = (Integer) Component.getInstance("currentAccessLevel");
        Hash hash = (Hash)Component.getInstance(Hash.class);

        log.debug("generating cache key for document: " + currentDocument + " and macro: " + this + " and access level: " + accessLevel);
        StringBuilder builder = new StringBuilder();

        if (log.isDebugEnabled()) log.debug("including id of document: " + currentDocument.getId());
        builder.append( currentDocument.getId() );

        int namePositionHash = (getName() + "_" + getPosition()).hashCode();
        if (log.isDebugEnabled()) log.debug("including name/position of this macro: " + Math.abs(namePositionHash));
        builder.append( Math.abs(namePositionHash) );

        if (log.isDebugEnabled()) log.debug("including hashCode of macro params: " + Math.abs(getParams().hashCode()));
        builder.append( Math.abs(getParams().hashCode()) );

        if (log.isDebugEnabled()) log.debug("including accessLevel: " + accessLevel);
        builder.append( accessLevel );

        // This needs to be empty-String safe (the additional objects might be some of the
        // JSF "oh let's map a non-existant request parameter to an empty string" genius behavior...
        if (objects != null && objects.length > 0) {
            for (Object o : objects) {
                if (o != null && Math.abs(o.hashCode()) != 0) {
                    log.debug("including hashCode of object: " + Math.abs(o.hashCode()));
                    builder.append( Math.abs(o.hashCode()) );
                }
            }
        }
        return hash.hash(builder.toString());
    }
View Full Code Here

        return syndFeed;
    }

    private String calculateEtag(Date date) {
        Hash hash = new Hash();
        return hash.hash(date.toString());
    }
View Full Code Here

                assert user == null;

                UserDAO dao = (UserDAO)getInstance(UserDAO.class);
                User dbUser = dao.findUser(3l);
                assert dbUser.getActivationCode() == null;
                Hash hashUtil = (Hash)getInstance(Hash.class);
                assert dbUser.getPasswordHash().equals(hashUtil.hash("foo123"));
            }
        }.run();

    }
View Full Code Here

TOP

Related Classes of org.jboss.seam.wiki.util.Hash

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.