@PreAuthorize("hasRole('" + StandardEntitlement.RESOURCE_HISTORY_LIST + "')") @Transactional(readOnly = true) public List<ResourceHistoryConfTO> list(final String key) { ExternalResource resource = resourceDAO.find(key); if (resource == null) { throw new NotFoundException("Resource '" + key + "'"); } return resourceHistoryConfDAO.findByEntity(resource).stream(). map(binder::getResourceHistoryConfTO).collect(Collectors.toList()); }
type, resourceDAO.find(resource), notificationDAO.find(notification), anyTypeKind, entityKey); type, resourceDAO.find(resource), notificationDAO.find(notification), anyTypeKind, entityKey, page, size, orderByClauses).stream(). <T>map(task -> binder.getTaskTO(task, taskUtilsFactory.getInstance(type), details)).
@PreAuthorize("hasRole('" + StandardEntitlement.CONNECTOR_READ + "')") @Transactional(readOnly = true) public ConnInstanceTO readByResource(final String resourceName, final String lang) { CurrentLocale.set(StringUtils.isBlank(lang) ? Locale.ENGLISH : new Locale(lang)); ExternalResource resource = resourceDAO.find(resourceName); if (resource == null) { throw new NotFoundException("Resource '" + resourceName + "'"); } ConnInstanceTO connInstance = binder.getConnInstanceTO(connFactory.getConnector(resource).getConnInstance()); connInstance.setKey(resource.getConnector().getKey()); return connInstance; }
ExternalResource resource = resourceDAO.find(task.getResource()); taskToResource.put(task, resource);
@Override protected ResourceTO resolveReference(final Method method, final Object... args) throws UnresolvedReferenceException { String key = null; if (ArrayUtils.isNotEmpty(args)) { for (int i = 0; key == null && i < args.length; i++) { if (args[i] instanceof String) { key = (String) args[i]; } else if (args[i] instanceof ResourceTO) { key = ((ResourceTO) args[i]).getKey(); } } } if (key != null) { try { return binder.getResourceTO(resourceDAO.find(key)); } catch (Throwable ignore) { LOG.debug("Unresolved reference", ignore); throw new UnresolvedReferenceException(ignore); } } throw new UnresolvedReferenceException(); } }
map(resource -> resourceDAO.find(resource)). filter(resource -> resource != null && resource.getPasswordPolicy() != null). forEach(resource -> {
ExternalResource resource = resourceDAO.find(resourceKey); if (resource == null) { LOG.debug("Invalid " + ExternalResource.class.getSimpleName() + " {}, ignoring...", resourceKey);
ExternalResource resource = resourceDAO.find(resourceKey); OrgUnit orgUnit = resource == null ? null : resource.getOrgUnit();
@SuppressWarnings("unchecked") private Pair<Any<?>, Provision> init(final AnyTypeKind anyTypeKind, final String anyKey, final String resourceKey) { AnyUtils anyUtils = anyUtilsFactory.getInstance(anyTypeKind); Any<?> any = anyUtils.dao().authFind(anyKey); if (any == null) { throw new NotFoundException(anyTypeKind + " '" + anyKey + "'"); } ExternalResource resource = resourceDAO.find(resourceKey); if (resource == null) { throw new NotFoundException("Resource '" + resourceKey + "'"); } Provision provision = resource.getProvision(any.getType()).orElseThrow(() -> new NotFoundException("Provision for " + any.getType() + " on Resource '" + resourceKey + "'")); if (provision.getMapping() == null) { throw new NotFoundException("Mapping for " + any.getType() + " on Resource '" + resourceKey + "'"); } return (Pair<Any<?>, Provision>) Pair.of(any, provision); }
ExternalResource resource = resourceDAO.find(resourceKey); if (resource == null) { LOG.debug("Invalid " + ExternalResource.class.getSimpleName() + " {}, ignoring...", resourceKey);
ExternalResource resource = resourceDAO.find(resourceKey); if (resource == null) { LOG.debug("Invalid " + ExternalResource.class.getSimpleName() + " {}, ignoring...", resourceKey);
ExternalResource resource = resourceDAO.find(resourceKey); Provision provision = resource == null ? null : resource.getProvision(any.getType()).orElse(null); List<? extends Item> mappingItems = provision == null
ExternalResource resource = resourceDAO.find(resourceName); if (resource == null) { LOG.debug("Ignoring invalid resource {} ", resourceName);
@Override public SchedTask createSchedTask(final SchedTaskTO taskTO, final TaskUtils taskUtils) { Class<? extends TaskTO> taskTOClass = taskUtils.taskTOClass(); if (taskTOClass == null || !taskTOClass.equals(taskTO.getClass())) { throw new IllegalArgumentException(String.format("Expected %s, found %s", taskTOClass, taskTO.getClass())); } SchedTask task = taskUtils.newTask(); task.setStartAt(taskTO.getStartAt()); task.setCronExpression(taskTO.getCronExpression()); task.setName(taskTO.getName()); task.setDescription(taskTO.getDescription()); task.setActive(taskTO.isActive()); if (taskUtils.getType() == TaskType.SCHEDULED) { Implementation implementation = implementationDAO.find(taskTO.getJobDelegate()); if (implementation == null) { throw new NotFoundException("Implementation " + taskTO.getJobDelegate()); } task.setJobDelegate(implementation); } else if (taskTO instanceof ProvisioningTaskTO) { ProvisioningTaskTO provisioningTaskTO = (ProvisioningTaskTO) taskTO; ExternalResource resource = resourceDAO.find(provisioningTaskTO.getResource()); if (resource == null) { throw new NotFoundException("Resource " + provisioningTaskTO.getResource()); } ((ProvisioningTask) task).setResource(resource); fill((ProvisioningTask) task, provisioningTaskTO); } return task; }
ExternalResource resource = resourceDAO.find(patch.getValue()); if (resource == null) { LOG.debug("Invalid " + ExternalResource.class.getSimpleName() + " {}, ignoring...", patch.getValue());
if (taskInfo.getKey() == null) { task = entityFactory.newEntity(PropagationTask.class); task.setResource(resourceDAO.find(taskInfo.getResource())); task.setObjectClassName(taskInfo.getObjectClassName()); task.setAnyTypeKind(taskInfo.getAnyTypeKind());
ExternalResource resource = resourceDAO.find(schemaTO.getResource()); if (resource == null) { SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidSchemaDefinition);