1 /*
2 * Copyright 2010 FatWire Corporation. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package com.fatwire.gst.foundation.wra;
17
18 import com.fatwire.assetapi.data.AssetId;
19 import com.fatwire.gst.foundation.controller.AssetIdWithSite;
20 import com.fatwire.gst.foundation.facade.assetapi.asset.TemplateAsset;
21
22 /**
23 * Dao for dealing with core fields in a WRA This DAO is not aware of Aliases.
24 * To work with Alias assets, see {@link AliasCoreFieldDao}.}
25 *
26 * @author Tony Field
27 * @author Dolf Dijkstra
28 * @since Jul 21, 2010
29 */
30 public interface WraCoreFieldDao {
31
32 public static String[] WRA_ATTRIBUTE_NAMES = { "metatitle", "metadescription", "metakeyword", "h1title",
33 "linktext", "path", "template", "id", "name", "subtype", "startdate", "enddate", "status" };
34 public static String[] VANITY_ATTRIBUTE_NAMES = { "path", "template", "id", "name", "subtype", "startdate",
35 "enddate", "status" };
36
37 /**
38 * Method to test whether or not an asset is web-referenceable.
39 *
40 * @param id asset ID to check
41 * @return true if the asset is a valid web-referenceable asset, false if it
42 * is not
43 */
44 public boolean isWebReferenceable(AssetId id);
45
46 /**
47 * Method to test whether or not an asset is web-referenceable.
48 *
49 * @param candidate asset to check for web-referenceable support.
50 * @return true if the asset is a valid web-referenceable asset, false if it
51 * is not
52 */
53 public boolean isWebReferenceable(TemplateAsset candidate);
54
55 /**
56 * Method to test whether or not an asset is web-referenceable.
57 *
58 * @param candidate asset to check for web-referenceable support.
59 * @return true if the asset is a valid web-referenceable asset, false if it
60 * is not
61 */
62 public boolean isWebReferenceable(WebReferenceableAsset candidate);
63
64 /**
65 * Method to test if an asset has a vanity url, that is has a path field.
66 *
67 * @param id asset ID to check
68 * @return true if the asset has a vanity url, false if it is not
69 */
70 public boolean isVanityAsset(AssetId id);
71
72 /**
73 * Return a web referenceable asset bean given an input id. Required fields
74 * must be set or an exception is thrown.
75 *
76 * @param id asset id
77 * @return WebReferenceableAsset, never null
78 * @see #isWebReferenceable
79 */
80 public WebReferenceableAsset getWra(AssetId id);
81
82 /**
83 * Locate the page that contains the specified Web-Referenceable Asset.
84 * <p/>
85 * A WRA is supposed to just be placed on one page (in the unnamed
86 * association block), and this method locates it. If it is not found, 0L is
87 * returned.
88 * <p/>
89 * If multiple matches are found, a warning is logged and the first one is
90 * returned.
91 *
92 * @param wraAssetIdWithSite id of the web-referenceable asset. Site is
93 * included
94 * @return page asset ID or 0L.
95 */
96 public long findP(AssetIdWithSite wraAssetIdWithSite);
97
98 /**
99 * @param c
100 * @param cid
101 * @return the name of the site that this asset belongs to.
102 */
103 public String resolveSite(String c, String cid);
104
105 /**
106 * @param id
107 * @return the VanityAsset for the id, null is not found or not a VanityAsset
108 */
109 public VanityAsset getVanityWra(AssetId id);
110
111 }