001/*
002 * (C) Copyright 2018 Nuxeo (http://nuxeo.com/) and others.
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 *
016 * Contributors:
017 *     Funsho David
018 *
019 */
020
021package org.nuxeo.ecm.annotation;
022
023import static org.nuxeo.ecm.annotation.AnnotationConstants.ANNOTATION_DOCUMENT_ID_PROPERTY;
024import static org.nuxeo.ecm.annotation.AnnotationConstants.ANNOTATION_ENTITY_PROPERTY;
025import static org.nuxeo.ecm.annotation.AnnotationConstants.ANNOTATION_ID_PROPERTY;
026import static org.nuxeo.ecm.annotation.AnnotationConstants.ANNOTATION_XPATH_PROPERTY;
027
028import org.nuxeo.ecm.core.api.DocumentModel;
029
030/**
031 * @since 10.1
032 */
033public class AnnotationImpl implements Annotation {
034
035    protected String id;
036
037    protected String documentId;
038
039    protected String xpath;
040
041    protected String entity;
042
043    public AnnotationImpl() {
044    }
045
046    protected AnnotationImpl(DocumentModel annotationModel) {
047        id = (String) annotationModel.getPropertyValue(ANNOTATION_ID_PROPERTY);
048        documentId = (String) annotationModel.getPropertyValue(ANNOTATION_DOCUMENT_ID_PROPERTY);
049        xpath = (String) annotationModel.getPropertyValue(ANNOTATION_XPATH_PROPERTY);
050        entity = (String) annotationModel.getPropertyValue(ANNOTATION_ENTITY_PROPERTY);
051    }
052
053    @Override
054    public String getId() {
055        return id;
056    }
057
058    @Override
059    public void setId(String id) {
060        this.id = id;
061    }
062
063    @Override
064    public String getDocumentId() {
065        return documentId;
066    }
067
068    @Override
069    public void setDocumentId(String documentId) {
070        this.documentId = documentId;
071    }
072
073    @Override
074    public String getXpath() {
075        return xpath;
076    }
077
078    @Override
079    public void setXpath(String xpath) {
080        this.xpath = xpath;
081    }
082
083    @Override
084    public String getEntity() {
085        return entity;
086    }
087
088    @Override
089    public void setEntity(String entity) {
090        this.entity = entity;
091    }
092
093}