public boolean hasCustomMapping() { String cMapping = getCustomMapping(); return (cMapping != null) && (!"".equals(cMapping)); }
public boolean hasExternalCustomMapping() { String cMapping = getCustomMapping(); return (cMapping != null) && (!"".equals(cMapping)) && (!"internal".equals(cMapping)); }
public boolean isCustomMappingValid(XWikiContext context) throws XWikiException { return isCustomMappingValid(getCustomMapping(), context); }
public List<String> getCustomMappingPropertyList(XWikiContext context) { String custommapping1 = getCustomMapping(); if ((custommapping1 != null) && (custommapping1.trim().length() > 0)) { return context.getWiki().getStore().getCustomMappingPropertyList(this); } else { return new ArrayList<String>(); } }
public List getCustomMappingPropertyList(BaseClass bclass) { List list = new ArrayList(); Configuration hibconfig; if (bclass.hasExternalCustomMapping()) { hibconfig = makeMapping(bclass.getName(), bclass.getCustomMapping()); } else { hibconfig = getConfiguration(); } PersistentClass mapping = hibconfig.getClassMapping(bclass.getName()); if (mapping == null) { return null; } Iterator it = mapping.getPropertyIterator(); while (it.hasNext()) { Property hibprop = (Property) it.next(); String propname = hibprop.getName(); list.add(propname); } return list; }
if (!getCustomMapping().equals(bclass.getCustomMapping())) { return false;
this.classFiles.add(docinfo); if (bclass.getCustomMapping() != null) { this.customMappingFiles.add(docinfo);
/** * Custom Mapping This function update the schema based on the dynamic custom mapping provided by the class * * @param bclass * @param context * @throws com.xpn.xwiki.XWikiException */ public void updateSchema(BaseClass bclass, XWikiContext context) throws XWikiException { String custommapping = bclass.getCustomMapping(); if (!bclass.hasExternalCustomMapping()) { return; } Configuration config = makeMapping(bclass.getName(), custommapping); /* * if (isValidCustomMapping(bclass.getName(), config, bclass)==false) { throw new XWikiException( * XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_STORE_HIBERNATE_INVALID_MAPPING, "Cannot update * schema for class " + bclass.getName() + " because of an invalid mapping"); } */ String[] sql = getSchemaUpdateScript(config, context); updateSchema(sql, context); }
if (!"internal".equals(bclass.getCustomMapping())) { needsUpdate = true; bclass.setCustomMapping("internal");
classParameters.put(WikiClassFilter.PARAMETER_CUSTOMMAPPING, xclass.getCustomMapping()); classParameters.put(WikiClassFilter.PARAMETER_DEFAULTSPACE, xclass.getDefaultWeb()); classParameters.put(WikiClassFilter.PARAMETER_NAMEFIELD, xclass.getNameField());
/** * {@inheritDoc} * * @see com.xpn.xwiki.objects.BaseCollection#clone() */ @Override public Object clone() { BaseClass bclass = (BaseClass) super.clone(); bclass.setCustomClass(getCustomClass()); bclass.setCustomMapping(getCustomMapping()); bclass.setDefaultWeb(getDefaultWeb()); bclass.setDefaultViewSheet(getDefaultViewSheet()); bclass.setDefaultEditSheet(getDefaultEditSheet()); bclass.setNameField(getNameField()); return bclass; }
public boolean injectCustomMapping(BaseClass doc1class, XWikiContext context) throws XWikiException { // If we haven't turned of dynamic custom mappings we should not inject them if (context.getWiki().hasDynamicCustomMappings() == false) { return false; } String custommapping = doc1class.getCustomMapping(); if (!doc1class.hasExternalCustomMapping()) { return false; } Configuration config = getConfiguration(); // don't add a mapping that's already there if (config.getClassMapping(doc1class.getName()) != null) { return true; } Configuration mapconfig = makeMapping(doc1class.getName(), custommapping); if (!isValidCustomMapping(doc1class.getName(), mapconfig, doc1class)) { throw new XWikiException(XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_STORE_HIBERNATE_INVALID_MAPPING, "Invalid Custom Mapping"); } config.addXML(makeMapping(doc1class.getName(), "xwikicustom_" + doc1class.getName().replaceAll("\\.", "_"), custommapping)); config.buildMappings(); return true; }
if (!"internal".equals(bclass.getCustomMapping())) { needsUpdate = true; bclass.setCustomMapping("internal");
el.addText((getCustomMapping() == null) ? "" : getCustomMapping()); cel.add(el);
if (!"internal".equals(bclass.getCustomMapping())) { needsUpdate = true; bclass.setCustomMapping("internal");