001/*
002 *  Copyright 2019 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.plugins.queriesdirectory;
017
018import javax.jcr.Node;
019
020import org.ametys.cms.indexing.solr.SolrAclCacheUninfluentialObject;
021import org.ametys.plugins.repository.AmetysObject;
022import org.ametys.plugins.repository.AmetysRepositoryException;
023import org.ametys.plugins.repository.MovableAmetysObject;
024import org.ametys.plugins.repository.RepositoryIntegrityViolationException;
025import org.ametys.plugins.repository.jcr.DefaultTraversableAmetysObject;
026
027/**
028 * Class representing a query container, backed by a JCR node.<br>
029 */
030@SolrAclCacheUninfluentialObject
031public class QueryContainer extends DefaultTraversableAmetysObject<QueryContainerFactory> implements MovableAmetysObject
032{
033    /**
034     * Creates a {@link QueryContainer}.
035     * @param node the node backing this {@link AmetysObject}
036     * @param parentPath the parentPath in the Ametys hierarchy
037     * @param factory the DefaultAmetysObjectFactory which created the AmetysObject
038     */
039    public QueryContainer(Node node, String parentPath, QueryContainerFactory factory)
040    {
041        super(node, parentPath, factory);
042    }
043    
044    @Override
045    public boolean canMoveTo(AmetysObject newParent) throws AmetysRepositoryException
046    {
047        return QueryAndContainerCommonMethods.canMoveTo(newParent, this, _getFactory().getQueryDAO());
048    }
049    
050    @Override
051    public void moveTo(AmetysObject newParent, boolean renameIfExist) throws AmetysRepositoryException, RepositoryIntegrityViolationException
052    {
053        QueryAndContainerCommonMethods.moveTo(newParent, renameIfExist, this);
054    }
055    
056    @Override
057    public void orderBefore(AmetysObject siblingNode) throws AmetysRepositoryException
058    {
059        QueryAndContainerCommonMethods.orderBefore(siblingNode, this);
060    }
061}