001/*
002 *  Copyright 2014 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.workspaces.calendars.jcr;
017
018import javax.jcr.Node;
019
020import org.ametys.cms.repository.DefaultIndexableAmetysObject;
021import org.ametys.plugins.repository.AmetysObject;
022import org.ametys.plugins.workspaces.calendars.Calendar;
023import org.ametys.plugins.workspaces.calendars.resources.CalendarResource;
024
025/**
026 * Default implementation of an {@link Calendar}, backed by a JCR node.<br>
027 */
028public class JCRCalendarResource extends DefaultIndexableAmetysObject<JCRCalendarResourceFactory> implements CalendarResource
029{
030    /** Attribute id */
031    public static final String ATTRIBUTE_CALENDAR_RESOURCE_ID = "calendarResourceId";
032    /** Attribute title */
033    public static final String ATTRIBUTE_TITLE = "title";
034    /** Attribute icon */
035    public static final String ATTRIBUTE_ICON = "icon";
036    /** Attribute instructions */
037    public static final String ATTRIBUTE_INSTRUCTIONS = "instructions";
038    
039    /**
040     * Creates an {@link JCRCalendarResource}.
041     * @param node the node backing this {@link AmetysObject}
042     * @param parentPath the parentPath in the Ametys hierarchy
043     * @param factory the DefaultAmetysObjectFactory which created the AmetysObject
044     */
045    public JCRCalendarResource(Node node, String parentPath, JCRCalendarResourceFactory factory)
046    {
047        super(node, parentPath, factory);
048    }
049
050    public String getTitle()
051    {
052        return getValue(ATTRIBUTE_TITLE);
053    }
054
055    public void setTitle(String title)
056    {
057        setValue(ATTRIBUTE_TITLE, title);
058    }
059
060    public String getInstructions()
061    {
062        return getValue(ATTRIBUTE_INSTRUCTIONS);
063    }
064
065    public void setInstructions(String instructions)
066    {
067        setValue(ATTRIBUTE_INSTRUCTIONS, instructions);
068    }
069
070    public String getIcon()
071    {
072        return getValue(ATTRIBUTE_ICON);
073    }
074
075    public void setIcon(String icon)
076    {
077        setValue(ATTRIBUTE_ICON, icon);
078    }
079    
080    public String getCalendarResourceId()
081    {
082        return getValue(ATTRIBUTE_CALENDAR_RESOURCE_ID);
083    }
084    
085    public void setCalendarResourceId(String id)
086    {
087        setValue(ATTRIBUTE_CALENDAR_RESOURCE_ID, id);
088    }
089}