/** * Create FieldTypeConstaintChecker usable in client side * @param client client used to do request if needed by tag value */ public FieldTypeConstaintChecker(WikittyClient client) { this.ws = client.getWikittyService(); this.token = client.getSecurityToken(); }
/** * Asynchronous export by criteria. * * @param format export format * @param criteria criteria * @return export as string * @deprecated since 3.4 user {@link #asyncExportAllByQuery(org.nuiton.wikitty.addons.WikittyImportExportService.FORMAT, org.nuiton.wikitty.query.WikittyQuery) } */ @Deprecated public String asyncExportAllByCriteria(FORMAT format, Criteria criteria) { try { String jobId = UUID.randomUUID().toString(); File file = new File(exportDirectory, jobId); file.getParentFile().mkdirs(); String url = exportPublicURL + jobId; Writer result = new FileWriter(file); ExportTask task = new ExportTask(client.getSecurityToken(), client.getWikittyService(), format, criteria, result); FutureTask<String> future = new FutureTask<String>(task, url); importExportExecutor.submit(future); importExportTask.put(jobId, future); return jobId; } catch (Exception eee) { throw new WikittyException(String.format( "Can't export in format %s", format), eee); } }
/** * Synchronous export by criteria. * * @param format export format * @param criteria criteria * @return export as string * @deprecated since 3.4 user {@link #syncExportAllByQuery(org.nuiton.wikitty.addons.WikittyImportExportService.FORMAT, org.nuiton.wikitty.query.WikittyQuery, java.io.Writer) } */ @Deprecated public void syncExportAllByCriteria(FORMAT format, Criteria criteria, Writer writer) { ExportTask task = new ExportTask(client.getSecurityToken(), client.getWikittyService(), format, criteria, writer); task.run(); }
@Override public void run() { WikittyServiceTransaction tx = new WikittyServiceTransaction( client.getConfig(), client.getWikittyService()); // TODO poussin 20101029 rendre configurable le l'auto commit '1000' pour l'import tx.setAutoCommit(1000); try { long time = 0; if (log.isInfoEnabled()) { time = System.currentTimeMillis(); log.info("Import in (ms)" + time); } WikittyClient txClient = new WikittyClient( client.getConfig(), tx, client.getSecurityToken()); ImportExportMethod importer = format.ieporter(); importer.importReader(txClient, reader); if (log.isInfoEnabled()) { time = System.currentTimeMillis() - time; log.info("Import in (ms)" + time); } // don't forget to commit :) with true to force version tx.commit(client.getSecurityToken(), true); } catch (Exception eee) { tx.rollback(client.getSecurityToken()); throw new WikittyException("Error during import task", eee); } } }
} else if ("object".equals(name)) { w.setWikittyVersion(objectVersion); client.getWikittyService().store(client.getSecurityToken(), Collections.singleton(w), true); w = null;
client.getWikittyService().store(client.getSecurityToken(), Collections.singleton(currentWikitty), true);
@Test @Ignore // on l'ignore car il faut avoir accept a un LDAP et mettre en clair un mot de passe :( public void testLDAP() throws Exception { ApplicationConfig config = WikittyConfig.getConfig(); String services = config.getOption(WikittyConfigOption.WIKITTY_WIKITTYSERVICE_COMPONENTS.getKey()); services += "," + WikittyServiceAuthenticationLDAP.class.getName(); config.setOption(WikittyConfigOption.WIKITTY_WIKITTYSERVICE_COMPONENTS.getKey(), services); config.setOption(WikittyConfigOption .WIKITTY_SERVICE_AUTHENTICATION_LDAP_SERVER.getKey(), "ldap://intranet:389"); config.setOption(WikittyConfigOption .WIKITTY_SERVICE_AUTHENTICATION_LDAP_LOGIN_PATTERN.getKey(), "uid=%s,ou=People,dc=codelutin,dc=home"); WikittyClient client = new WikittyClient(config); client.login("poussin", "xxxxxxxx"); System.out.println("token:" + client.getSecurityToken()); // System.out.println("user: " + client.getUser()); System.out.println("config: " + config.getFlatOptions()); } }