@Override public void deleteEntry(String id) { acquireConnection(); if (!canDeleteMultiTenantEntry(id)) { throw new OperationNotAllowedException("Operation not allowed in the current tenant context", "label.directory.error.multi.tenant.operationNotAllowed", null); } super.deleteEntry(id); }
public SQLSession(SQLDirectory directory, SQLDirectoryDescriptor config) { super(directory, TableReference.class); table = directory.getTable(); dialect = directory.getDialect(); sid = String.valueOf(SIDGenerator.next()); staticFilters = config.getStaticFilters(); acquireConnection(); }
@Override public void deleteEntry(String id, Map<String, String> map) { checkPermission(SecurityConstants.WRITE); acquireConnection();
@Override public DocumentModel getEntryFromSource(String id, boolean fetchReferences) { acquireConnection();
return new DocumentModelListImpl(); acquireConnection(); Map<String, Object> filterMap = new LinkedHashMap<>(filter);
@Override public boolean hasEntry(String id) { acquireConnection(); Select select = new Select(table); select.setFrom(table.getQuotedName()); select.setWhat("1"); select.setWhere(table.getPrimaryColumn().getQuotedName() + " = ?"); String sql = select.getStatement(); if (logger.isLogEnabled()) { logger.logSQL(sql, Collections.singleton(id)); } try (PreparedStatement ps = sqlConnection.prepareStatement(sql)) { setFieldValue(ps, 1, table.getPrimaryColumn(), id); try (ResultSet rs = ps.executeQuery()) { boolean has = rs.next(); if (logger.isLogEnabled()) { logger.logCount(has ? 1 : 0); } return has; } } catch (SQLException e) { throw new DirectoryException("hasEntry failed", e); } }
acquireConnection(); if (autoincrementId) { fieldMap.remove(idFieldName);
@Override protected List<String> updateEntryWithoutReferences(DocumentModel docModel) { acquireConnection(); List<Column> storedColumnList = new LinkedList<>(); List<String> referenceFieldList = new LinkedList<>();