/*
* (C) Copyright 2006-2007 Nuxeo SA (http://nuxeo.com/) and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a>
*
* $Id: AbstractDocumentViewCodec.java 29556 2008-01-23 00:59:39Z jcarsique $
*/
package org.nuxeo.ecm.platform.url.service;
import org.nuxeo.ecm.platform.url.api.DocumentView;
import org.nuxeo.ecm.platform.url.codec.api.DocumentViewCodec;
/**
* Abstract implementation for codecs.
* <p>
* Implements methods that are not likely to be customized except for optimization.
*
* @author <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a>
*/
public abstract class AbstractDocumentViewCodec implements DocumentViewCodec {
protected String prefix;
public String getPrefix() {
return prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public boolean handleDocumentView(DocumentView docView) {
String url = getUrlFromDocumentView(docView);
return url != null;
}
public boolean handleUrl(String url) {
DocumentView docView = getDocumentViewFromUrl(url);
return docView != null;
}
}