001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.jetspeed.om.page.psml;
018:
019: import org.apache.jetspeed.om.page.Link;
020:
021: /**
022: * <p>
023: * Link
024: * </p>
025: * <p>
026: *
027: * </p>
028: * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
029: * @version $Id: LinkImpl.java 516448 2007-03-09 16:25:47Z ate $
030: *
031: */
032: public class LinkImpl extends DocumentImpl implements Link {
033:
034: private String skin;
035:
036: private String target;
037:
038: /**
039: * <p>
040: * getType
041: * </p>
042: *
043: * @see org.apache.jetspeed.om.page.Document#getType()
044: * @return
045: */
046: public String getType() {
047: return DOCUMENT_TYPE;
048: }
049:
050: /* (non-Javadoc)
051: * @see org.apache.jetspeed.om.page.Link#getSkin()
052: */
053: public String getSkin() {
054: return skin;
055: }
056:
057: /* (non-Javadoc)
058: * @see org.apache.jetspeed.om.page.Link#setSkin(java.lang.String)
059: */
060: public void setSkin(String skin) {
061: this .skin = skin;
062: }
063:
064: /**
065: * @return Returns the target.
066: */
067: public String getTarget() {
068: return target;
069: }
070:
071: /**
072: * @param target The target to set.
073: */
074: public void setTarget(String target) {
075: this .target = target;
076: }
077:
078: /**
079: * <p>
080: * grantViewActionAccess
081: * </p>
082: *
083: * @return granted access for view action
084: */
085: public boolean grantViewActionAccess() {
086: // always allow links that reference absolute urls since these
087: // are probably not a security related concern but rather
088: // should always be viewable, (subject to folder access)
089: String hrefUrl = getUrl();
090: return ((hrefUrl != null) && (hrefUrl.startsWith("http://") || hrefUrl
091: .startsWith("https://")));
092: }
093:
094: /**
095: * unmarshalled - notification that this instance has been
096: * loaded from the persistent store
097: */
098: public void unmarshalled() {
099: // notify super class implementation
100: super .unmarshalled();
101:
102: // default title of pages to name
103: if (getTitle() == null) {
104: setTitle(getTitleName());
105: }
106: }
107: }
|