001/*
002 *  Copyright 2009 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.workspaces.repository;
017
018import javax.jcr.Node;
019import javax.jcr.RepositoryException;
020
021import org.ametys.plugins.repository.script.RepositoryScriptHelper;
022
023/**
024 * Helper methods to manipulating JCR nodes in JCR repository console
025 * 
026 * @deprecated Use {@link RepositoryScriptHelper} instead
027 * This helper (moved from JCR to Repository) has been kept only to maintained backward compatibility with old
028 * script using directly the fully qualified name of this class instead of Repository.helper
029 */
030@Deprecated
031public final class ConsoleHelper
032{
033    private ConsoleHelper()
034    {
035        // Utility class
036    }
037    
038    /**
039     * Helper to set ambiguous object values from a node property
040     * @param node the node
041     * @param name the property name
042     * @param values the property values as String[] or Value[]
043     * @throws RepositoryException if an error occurred
044     */
045    public static void setProperty(Node node, String name, Object values) throws RepositoryException
046    {
047        RepositoryScriptHelper.setProperty(node, name, values);
048    }
049    
050    /**
051     * Helper to convert a single-valued property to a multi-valued property.
052     * This helper checks that property exists and that it is not already multiple.
053     * @param node the node holding the property
054     * @param propertyName the property's name
055     * @return true if changes was made
056     * @throws RepositoryException if an error occurred
057     */
058    public static boolean convertSingleToMultipleProperty (Node node, String propertyName) throws RepositoryException
059    {
060        return RepositoryScriptHelper.convertSingleToMultipleProperty(node, propertyName);
061    }
062}