@Override public WikittyTreeNode getParent(boolean exceptionIfNotLoaded) { if (exceptionIfNotLoaded) { throw new WikittyException("Preload is not implemented in DTO"); } else { return null; } }
@Override public Wikitty getRestored(boolean exceptionIfNotLoaded) { if (exceptionIfNotLoaded) { throw new WikittyException("Preload is not implemented in DTO"); } else { return null; } }
@Override public WikittyToken getToken(boolean exceptionIfNotLoaded) { if (exceptionIfNotLoaded) { throw new WikittyException("Preload is not implemented in DTO"); } else { return null; } }
@Override public WikittyUser getOwner(boolean exceptionIfNotLoaded) { if (exceptionIfNotLoaded) { throw new WikittyException("Preload is not implemented in DTO"); } else { return null; } }
@Override public Set<WikittyAuthorisation> getParent(boolean exceptionIfNotLoaded) { if (exceptionIfNotLoaded) { throw new WikittyException("Preload is not implemented in DTO"); } else { return null; } }
@Override public WikittyUser getUser(boolean exceptionIfNotLoaded) { if (exceptionIfNotLoaded) { throw new WikittyException("Preload is not implemented in DTO"); } else { return null; } }
@Override public WikittyUser getUser(boolean exceptionIfNotLoaded) { if (exceptionIfNotLoaded) { throw new WikittyException("Preload is not implemented in DTO"); } else { return null; } }
@Override public boolean isDeleted(WikittyTransaction transaction, String id) { boolean result = false; Wikitty w = wikitties.get(id); if (w == null) { throw new WikittyException(String.format("No wikitty with id '%s'", id)); } else { result = w.isDeleted(); } return result; }
private String value2solr(String value) { String result; if (value != null) { result = Restriction2Solr.escapeValue(value); } else { throw new WikittyException("Parse error, value must be not empty"); } if (result.contains(" ")) { result = "\"" + result + "\""; } return result; }
@Override public WikittyExtension restore(WikittyTransaction transaction, String name, String version) throws WikittyException { String id = WikittyExtension.computeId(name, version); WikittyExtension result = extensions.get(id); if (result == null) { throw new WikittyException(String.format("No extension with id '%s'", id)); } return result; }
public void syncImportFromUri(FORMAT format, String uri) { try { URL url = new URL(uri); Reader reader = new InputStreamReader(url.openStream()); ImportTask task = new ImportTask(client, format, reader); task.run(); } catch (Exception eee) { throw new WikittyException(String.format( "Can't import in format %s uri %s", format, uri), eee); } }
@Override public Condition addCondition(Condition c) { if (c instanceof ConditionValue) { getValues().add((ConditionValue)c); } else { throw new WikittyException(String.format( "Only ConditionValue can be add to %s, but you try to add: %s", this.getClass().getSimpleName(), ClassUtils.getShortCanonicalName(c, "null"))); } return this; }
@Override public int getFieldAsInt(String ext, String fieldName) { try { BigDecimal value = getFieldAsBigDecimal(ext, fieldName); int result = value.intValue(); return result; } catch (WikittyException eee) { throw new WikittyException(String.format( "field '%s' is not a valid int", WikittyUtil.getFQFieldName(ext, fieldName)), eee); } }
@Override public float getFieldAsFloat(String ext, String fieldName) { try { BigDecimal value = getFieldAsBigDecimal(ext, fieldName); float result = value.floatValue(); return result; } catch (WikittyException eee) { throw new WikittyException(String.format( "field '%s' is not a valid float", WikittyUtil.getFQFieldName(ext, fieldName)), eee); } }
@Override public double getFieldAsDouble(String ext, String fieldName) { try { BigDecimal value = getFieldAsBigDecimal(ext, fieldName); double result = value.doubleValue(); return result; } catch (WikittyException eee) { throw new WikittyException(String.format( "field '%s' is not a valid float", WikittyUtil.getFQFieldName(ext, fieldName)), eee); } }
@Override public void clear(WikittyTransaction transaction) { try { // FIXME poussin 20100618 pourquoi n'est pas fait dans la transaction ? solrResource.init(); solrServer.deleteByQuery("*:*"); } catch (Exception eee) { throw new WikittyException("Error during clearing SolR data", eee); } }
@Override public void copyFrom(BusinessEntity source) { try { BeanUtils.copyProperties(this, source); } catch (Exception eee) { throw new WikittyException(String.format( "Can't copy source object %s", source), eee); } }
@Override public void clear(WikittyTransaction transaction) { try { // FIXME poussin 20100618 pourquoi n'est pas fait dans la transaction ? solrResource.init(); getSolrServer().deleteByQuery("*:*"); } catch (Exception eee) { throw new WikittyException("Error during clearing SolR data", eee); } }
@Override public void copyFrom(BusinessEntity source) { if (!(source instanceof WikittyToken)){ throw new WikittyException("Can't copy source object " + source + ". They are not of the same type"); } WikittyToken sourceCopy = (WikittyToken)source; setUser(sourceCopy.getUser()); setDate(sourceCopy.getDate()); setWikittyVersion(sourceCopy.getWikittyVersion()); }
@Override public void copyFrom(BusinessEntity source) { if (!(source instanceof WikittyUser)){ throw new WikittyException("Can't copy source object " + source + ". They are not of the same type"); } WikittyUser sourceCopy = (WikittyUser)source; setLogin(sourceCopy.getLogin()); setPassword(sourceCopy.getPassword()); setWikittyVersion(sourceCopy.getWikittyVersion()); }