001    /*
002     * JBoss DNA (http://www.jboss.org/dna)
003     * See the COPYRIGHT.txt file distributed with this work for information
004     * regarding copyright ownership.  Some portions may be licensed
005     * to Red Hat, Inc. under one or more contributor license agreements.
006     * See the AUTHORS.txt file in the distribution for a full listing of 
007     * individual contributors.
008     *
009     * Unless otherwise indicated, all code in JBoss DNA is licensed
010     * to you under the terms of the GNU Lesser General Public License as
011     * published by the Free Software Foundation; either version 2.1 of
012     * the License, or (at your option) any later version.
013     * 
014     * JBoss DNA is distributed in the hope that it will be useful,
015     * but WITHOUT ANY WARRANTY; without even the implied warranty of
016     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017     * Lesser General Public License for more details.
018     *
019     * You should have received a copy of the GNU Lesser General Public
020     * License along with this software; if not, write to the Free
021     * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
022     * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
023     */
024    package org.jboss.dna.jcr.cache;
025    
026    import java.util.Map;
027    import java.util.UUID;
028    import org.jboss.dna.graph.Location;
029    import org.jboss.dna.graph.property.Name;
030    import org.jboss.dna.jcr.NodeDefinitionId;
031    
032    /**
033     * 
034     */
035    public class NewNodeInfo extends ChangedNodeInfo {
036        /**
037         * Create an immutable NodeInfo instance.
038         * 
039         * @param originalLocation the original location
040         * @param primaryTypeName the name of the node's primary type
041         * @param definition the definition used when creating the node
042         * @param parent the parent
043         * @param properties the unmodifiable map of properties; may be null if there are no properties
044         */
045        public NewNodeInfo( Location originalLocation,
046                            Name primaryTypeName,
047                            NodeDefinitionId definition,
048                            UUID parent,
049                            Map<Name, PropertyInfo> properties ) {
050            super(new ImmutableNodeInfo(originalLocation, primaryTypeName, null, definition, parent, null, properties));
051        }
052    
053        /**
054         * {@inheritDoc}
055         * <p>
056         * Always returns true.
057         * </p>
058         * 
059         * @see org.jboss.dna.jcr.cache.ChangedNodeInfo#isNew()
060         */
061        @Override
062        public boolean isNew() {
063            return true;
064        }
065    
066        /**
067         * {@inheritDoc}
068         * <p>
069         * Always returns false, since a new node is not persisted yet.
070         * </p>
071         * 
072         * @see org.jboss.dna.jcr.cache.ChangedNodeInfo#isModified()
073         */
074        @Override
075        public boolean isModified() {
076            return false;
077        }
078    
079    }