public static Collection<SelectorOptions<GetOperationOptions>> createReadOnlyCollection() { return SelectorOptions.createCollection(createReadOnly()); }
private void loadSystemConfiguration(OperationResult result) throws ObjectNotFoundException, SchemaException { Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(GetOperationOptions.createReadOnly()); systemConfiguration = cacheRepositoryService.getObject(SystemConfigurationType.class, SystemObjectsType.SYSTEM_CONFIGURATION.value(), options, result); systemConfigurationCheckTimestamp = System.currentTimeMillis(); if (systemConfiguration != null && systemConfiguration.getVersion() == null) { LOGGER.warn("Retrieved system configuration with null version"); } }
public static <F extends ObjectType> ResourceType getResourceReadOnly(LensContext<F> context, String resourceOid, ObjectResolver objectResolver, Task task, OperationResult result) throws ObjectNotFoundException, CommunicationException, SchemaException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException { ResourceType resourceType = context.getResource(resourceOid); if (resourceType == null) { Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(GetOperationOptions.createReadOnly()); resourceType = objectResolver.getObject(ResourceType.class, resourceOid, options, task, result); context.rememberResource(resourceType); } return resourceType; }
private <P extends ObjectType> void handleOwner(ResultHandler<P> handler, String contextDescription, Task task, OperationResult result) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException { objectResolver.searchIterative(getOwnerClass(), getOwnerQuery(), SelectorOptions.createCollection(GetOperationOptions.createReadOnly()), handler, task, result); } }
private PrismObject<? extends ObjectType> getPrismObject(String oid, boolean mightBeRemoved, OperationResult result) { try { Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(GetOperationOptions.createReadOnly()); return cacheRepositoryService.getObject(ObjectType.class, oid, options, result); } catch (ObjectNotFoundException e) { if (!mightBeRemoved) { LoggingUtils.logException(LOGGER, "Couldn't resolve reference when displaying object name within a notification (it might be already removed)", e); } else { // ok, accepted } } catch (SchemaException e) { LoggingUtils.logException(LOGGER, "Couldn't resolve reference when displaying object name within a notification", e); } return null; }
public static <F extends ObjectType> ResourceType getResourceReadOnly(LensContext<F> context, String resourceOid, ProvisioningService provisioningService, Task task, OperationResult result) throws ObjectNotFoundException, CommunicationException, SchemaException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException { ResourceType resourceType = context.getResource(resourceOid); if (resourceType == null) { // Fetching from provisioning to take advantage of caching and // pre-parsed schema Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(GetOperationOptions.createReadOnly()); resourceType = provisioningService.getObject(ResourceType.class, resourceOid, options, task, result) .asObjectable(); context.rememberResource(resourceType); } return resourceType; }
private <P extends ObjectType> void handlePersonas(ResultHandler<P> handler, String contextDescription, Task task, OperationResult result) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException { PrismObject<O> object = getObject(); if (!object.canRepresent(UserType.class)) { return; } for (ObjectReferenceType personaRef: ((UserType)object.asObjectable()).getPersonaRef()) { UserType persona = objectResolver.resolve(personaRef, UserType.class, SelectorOptions.createCollection(GetOperationOptions.createReadOnly()), "resolving persona in " + contextDescription, task, result); handler.handle((PrismObject<P>) persona.asPrismObject(), result); } }
public ResourceType getResource() throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ExpressionEvaluationException { if (resource == null) { if (getResourceOid() == null) { throw new SchemaException("Null resource OID "+getDesc()); } GetOperationOptions options = GetOperationOptions.createReadOnly(); resource = resourceManager.getResource(getResourceOid(), options, getTask(), parentResult).asObjectable(); updateResourceName(); } return resource; }
try { repositoryService.searchObjectsIterative(FunctionLibraryType.class, null, functionLibraryHandler, SelectorOptions.createCollection(GetOperationOptions.createReadOnly()), true, subResult); subResult.recordSuccessIfUnknown(); } catch (SchemaException | RuntimeException e) {
ConnectorType connectorType = connectorTypeCache.get(connOid); if (connectorType == null) { Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(GetOperationOptions.createReadOnly()); PrismObject<ConnectorType> repoConnector = repositoryService.getObject(ConnectorType.class, connOid, options, result); String currentConnectorVersion = repositoryService.getVersion(ConnectorType.class, connOid, result); if (!currentConnectorVersion.equals(connectorType.getVersion())) { Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(GetOperationOptions.createReadOnly()); PrismObject<ConnectorType> repoConnector = repositoryService.getObject(ConnectorType.class, connOid, options, result); connectorType = repoConnector.asObjectable();
repoOptions = SelectorOptions.createCollection(GetOperationOptions.createReadOnly());
public PrismObject<ResourceType> getResource(String oid, GetOperationOptions options, Task task, OperationResult parentResult) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ExpressionEvaluationException{ InternalMonitor.getResourceCacheStats().recordRequest(); String version = repositoryService.getVersion(ResourceType.class, oid, parentResult); PrismObject<ResourceType> cachedResource = resourceCache.get(oid, version, options); if (cachedResource != null) { InternalMonitor.getResourceCacheStats().recordHit(); if (LOGGER.isTraceEnabled()){ LOGGER.trace("Returning resource from cache:\n{}", cachedResource.debugDump()); } return cachedResource; } if (LOGGER.isDebugEnabled()) { LOGGER.debug("Fetching resource {}, version {}, storing to cache (previously cached version {})", oid, version, resourceCache.getVersion(oid)); } Collection<SelectorOptions<GetOperationOptions>> repoOptions = null; if (GetOperationOptions.isReadOnly(options)) { repoOptions = SelectorOptions.createCollection(GetOperationOptions.createReadOnly()); } PrismObject<ResourceType> repositoryObject = readResourceFromRepository(oid, repoOptions, parentResult); return loadAndCacheResource(repositoryObject, options, task, parentResult); }
repoOptions = SelectorOptions.createCollection(GetOperationOptions.createReadOnly());
try { objectResolver.searchIterative(FocusType.class, query, SelectorOptions.createCollection(GetOperationOptions.createReadOnly()), (foundObject, objectResult) -> { focusTypeHolder.setValue(foundObject.asObjectable()); GetOperationOptions options = GetOperationOptions.createReadOnly(); options.setNoFetch(true); ShadowType shadowType = objectResolver.resolve(linkRef, ShadowType.class,
@Test public void test112GetResourceDummyReadOnly() throws Exception { final String TEST_NAME = "test112GetResourceDummyReadOnly"; displayTestTitle(TEST_NAME); // GIVEN Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); preTestCleanup(AssignmentPolicyEnforcementType.POSITIVE); rememberCounter(InternalCounters.PRISM_OBJECT_CLONE_COUNT); Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection( GetOperationOptions.createReadOnly()); // WHEN displayWhen(TEST_NAME); PrismObject<ResourceType> resource = modelService.getObject(ResourceType.class, RESOURCE_DUMMY_OID, options , task, result); // THEN displayThen(TEST_NAME); assertSuccess(result); assertCounterIncrement(InternalCounters.PRISM_OBJECT_CLONE_COUNT, 1); assertResourceDummy(resource, true); assertCounterIncrement(InternalCounters.RESOURCE_REPOSITORY_READ_COUNT, 0); assertCounterIncrement(InternalCounters.RESOURCE_SCHEMA_FETCH_COUNT, 0); assertCounterIncrement(InternalCounters.RESOURCE_SCHEMA_PARSE_COUNT, 0); assertCounterIncrement(InternalCounters.CONNECTOR_CAPABILITIES_FETCH_COUNT, 0); assertCounterIncrement(InternalCounters.CONNECTOR_INSTANCE_INITIALIZATION_COUNT, 0); assertCounterIncrement(InternalCounters.CONNECTOR_SCHEMA_PARSE_COUNT, 0); IntegrationTestTools.displayXml("Initialized dummy resource", resource); assertSteadyResources(); }
String resourceOid = ShadowUtil.getResourceOid(shadow); if (resourceOid != null) { Collection<SelectorOptions<GetOperationOptions>> options = createCollection(GetOperationOptions.createReadOnly()); PrismObject<ResourceType> resource; try {