@Node(jcrType="hippostd:html") public class HippoHtml extends HippoItem implements HippoHtmlBean{ @IndexField(name="hippostdContent") public String getContent(){ return getProperty("hippostd:content"); } }
private String getOverridenPrimaryJcrType(Method method) { String overridenPrimaryJcrType = this.primaryJcrType; if (method.isAnnotationPresent(Node.class)) { overridenPrimaryJcrType = method.getAnnotation(Node.class).jcrType(); } else if (method.getDeclaringClass().isAnnotationPresent(Node.class)) { overridenPrimaryJcrType = method.getDeclaringClass().getAnnotation(Node.class).jcrType(); } return overridenPrimaryJcrType; }
private String getOverridenPrimaryJcrType(Method method) { String overridenPrimaryJcrType = this.primaryJcrType; if (method.isAnnotationPresent(Node.class)) { overridenPrimaryJcrType = method.getAnnotation(Node.class).jcrType(); } else if (method.getDeclaringClass().isAnnotationPresent(Node.class)) { overridenPrimaryJcrType = method.getDeclaringClass().getAnnotation(Node.class).jcrType(); } return overridenPrimaryJcrType; }
@Node(jcrType="hippogallery:exampleAssetSet") public class HippoAsset extends HippoDocument implements HippoAssetBean{ public HippoResourceBean getAsset(){ return getBean("hippogallery:asset", HippoResourceBean.class); } }
private static String findPrimaryJcrType(Class [] proxyInterfaces) { String primaryJcrType = null; for (Class proxyInterface : proxyInterfaces) { if (proxyInterface.isAnnotationPresent(Node.class)) { primaryJcrType = ((Node) proxyInterface.getAnnotation(Node.class)).jcrType(); break; } } if (primaryJcrType == null) { for (Class proxyInterface : proxyInterfaces) { Class [] extendingInterfaces = proxyInterface.getInterfaces(); if (extendingInterfaces.length > 0) { primaryJcrType = findPrimaryJcrType(extendingInterfaces); if (primaryJcrType != null) { break; } } } } return primaryJcrType; }
/** * This bean is only to map a hippo:translation to a bean: Normally, you never use this bean at all, as translations are * available through {@link HippoNode#getLocalizedName()} * */ @Node(jcrType="hippo:translation") public class HippoTranslation extends HippoItem { }
jcrPrimaryNodeType = anno.jcrType();
@Node(jcrType="hippostd:html") public class HippoHtml extends HippoItem implements HippoHtmlBean{ public String getContent(){ return getProperty("hippostd:content"); } }
private static void addJcrPrimaryNodeTypeClassPair(Map<String, Class<? extends HippoBean>> jcrPrimaryNodeTypeClassPairs, Class clazz, boolean builtinType) throws HstComponentException { String jcrPrimaryNodeType = null; if (clazz.isAnnotationPresent(Node.class)) { Node anno = (Node) clazz.getAnnotation(Node.class); jcrPrimaryNodeType = anno.jcrType(); } if (jcrPrimaryNodeTypeClassPairs.get(jcrPrimaryNodeType) != null) { if (!builtinType) { throw new HstComponentFatalException("Annotated class for primarytype '"+jcrPrimaryNodeType+"' is duplicate. " + "You might have configured a bean in 'beans-annotated-classes.xml' that does not have a annotation for the jcrType and" + "inherits the jcrType from the bean it extends, resulting in 2 beans with the same jcrType. Correct your beans."); } return; } if (jcrPrimaryNodeType == null) { throw new IllegalArgumentException("There's no annotation for jcrType in the class: " + clazz); } jcrPrimaryNodeTypeClassPairs.put(jcrPrimaryNodeType,clazz); }
/** * [selection:valuelist] > selection:basedocument orderable * + selection:listitem (selection:listitem) multiple */ @Node(jcrType = "selection:valuelist") public class ValueList extends HippoDocument { /** * Get the value list items. */ public List<ValueListItem> getItems() { return getChildBeans("selection:listitem"); } }
private static String findPrimaryJcrType(Class [] proxyInterfaces) { String primaryJcrType = null; for (Class proxyInterface : proxyInterfaces) { if (proxyInterface.isAnnotationPresent(Node.class)) { primaryJcrType = ((Node) proxyInterface.getAnnotation(Node.class)).jcrType(); break; } } if (primaryJcrType == null) { for (Class proxyInterface : proxyInterfaces) { Class [] extendingInterfaces = proxyInterface.getInterfaces(); if (extendingInterfaces.length > 0) { primaryJcrType = findPrimaryJcrType(extendingInterfaces); if (primaryJcrType != null) { break; } } } } return primaryJcrType; }
/** * hippo:facetselect has the same methods as for hippo:mirror * */ @Node(jcrType="hippo:facetselect") public class HippoFacetSelect extends HippoMirror{ }
private static void addJcrPrimaryNodeTypeClassPair(Map<String, Class<? extends HippoBean>> jcrPrimaryNodeTypeClassPairs, Class clazz, boolean builtinType) throws HstComponentException { String jcrPrimaryNodeType = null; if (clazz.isAnnotationPresent(Node.class)) { Node anno = (Node) clazz.getAnnotation(Node.class); jcrPrimaryNodeType = anno.jcrType(); } if(jcrPrimaryNodeTypeClassPairs.get(jcrPrimaryNodeType) != null) { if(builtinType) { log.debug("Builtin annotated class for primary type '{}' is overridden. Builtin version is ignored", jcrPrimaryNodeType); } else { throw new HstComponentFatalException("Annotated class for primarytype '"+jcrPrimaryNodeType+"' is duplicate. " + "You might have configured a bean in 'beans-annotated-classes.xml' that does not have a annotation for the jcrType and" + "inherits the jcrType from the bean it extends, resulting in 2 beans with the same jcrType. Correct your beans."); } return; } if (jcrPrimaryNodeType == null) { throw new IllegalArgumentException("There's no annotation for jcrType in the class: " + clazz); } jcrPrimaryNodeTypeClassPairs.put(jcrPrimaryNodeType,clazz); }
@Node(jcrType="hippo:facetresult") public class HippoFacetResult extends HippoFolder implements HippoResultSetBean { public Long getCount() { return this.getProperty(HippoNodeType.HIPPO_COUNT); } }
@Node(jcrType="hippo:facetsearch") public class HippoFacetSearch extends HippoFolder{ }
@Node(jcrType="hippofacnav:facetnavigation") public class HippoFacetNavigation extends HippoFolder { }
@Node(jcrType="hippostd:directory") public class HippoDirectory extends HippoFolder{ }
@Node(jcrType="hippostd:fixeddirectory") public class HippoFixedDirectory extends HippoFolder{ }
/** * [selection:valuelist] > selection:basedocument orderable * + selection:listitem (selection:listitem) multiple */ @Node(jcrType = "selection:valuelist") public class ValueList extends HippoDocument { /** * Get the value list items. */ public List<ValueListItem> getItems() { return getChildBeans("selection:listitem"); } }
@Node(jcrType="hippostd:directory") public class HippoDirectory extends HippoFolder{ }