private ResourceAttributeDefinition getUidDefinition(ResourceObjectIdentification identification) throws SchemaException { ResourceAttribute<String> primaryIdentifier = identification.getPrimaryIdentifier(); if (primaryIdentifier == null) { // fallback, compatibility for (ResourceAttribute<?> attr : identification.getAllIdentifiers()) { if (attr.getElementName().equals(SchemaConstants.ICFS_UID)) { return attr.getDefinition(); } } return null; } return primaryIdentifier.getDefinition(); }
private ResourceAttributeDefinition getNameDefinition(ResourceObjectIdentification identification) throws SchemaException { ResourceAttribute<String> secondaryIdentifier = identification.getSecondaryIdentifier(); if (secondaryIdentifier == null) { // fallback, compatibility for (ResourceAttribute<?> attr : identification.getAllIdentifiers()) { if (attr.getElementName().equals(SchemaConstants.ICFS_NAME)) { return attr.getDefinition(); } } return null; } return secondaryIdentifier.getDefinition(); }
private void replaceNameValue(ResourceObjectIdentification identification, Name newName) throws SchemaException { ResourceAttribute<String> secondaryIdentifier = identification.getSecondaryIdentifier(); if (secondaryIdentifier == null) { // fallback, compatibility for (ResourceAttribute<?> attr : identification.getAllIdentifiers()) { if (attr.getElementName().equals(SchemaConstants.ICFS_NAME)) { // expecting the NAME property is of type String //noinspection unchecked ((ResourceAttribute<String>) attr).setRealValue(newName.getNameValue()); return; } } throw new IllegalStateException("No identifiers"); } secondaryIdentifier.setRealValue(newName.getNameValue()); }
private void replaceUidValue(ResourceObjectIdentification identification, Uid newUid) throws SchemaException { ResourceAttribute<String> primaryIdentifier = identification.getPrimaryIdentifier(); if (primaryIdentifier == null) { // fallback, compatibility Collection<? extends ResourceAttribute<?>> identifiers = identification.getAllIdentifiers(); for (ResourceAttribute<?> attr : identifiers) { if (attr.getElementName().equals(SchemaConstants.ICFS_UID)) { // expecting the UID property is of type String //noinspection unchecked ((ResourceAttribute<String>) attr).setRealValue(newUid.getUidValue()); return; } } throw new IllegalStateException("No UID attribute in " + identifiers); } primaryIdentifier.setRealValue(newUid.getUidValue()); }
@Override public AsynchronousOperationReturnValue<Collection<PropertyModificationOperation>> modifyObject( ResourceObjectIdentification identification, PrismObject<ShadowType> shadow, Collection<Operation> changes, ConnectorOperationOptions options, StateReporter reporter, OperationResult parentResult) throws ObjectNotFoundException, CommunicationException, GenericFrameworkException, SchemaException, SecurityViolationException, ObjectAlreadyExistsException, ConfigurationException { OperationResult result = parentResult.createSubresult(OPERATION_MODIFY); InternalMonitor.recordConnectorOperation("modify"); InternalMonitor.recordConnectorModification("modify"); String ticketIdentifier = null; try { ticketIdentifier = createTicketModify(identification.getObjectClassDefinition(), shadow, identification.getAllIdentifiers(), reporter.getResourceOid(), changes, result); } catch (ObjectNotFoundException | CommunicationException | GenericFrameworkException | SchemaException | ObjectAlreadyExistsException | ConfigurationException | RuntimeException | Error e) { result.recordFatalError(e); throw e; } result.recordInProgress(); result.setAsynchronousOperationReference(ticketIdentifier); AsynchronousOperationReturnValue<Collection<PropertyModificationOperation>> ret = new AsynchronousOperationReturnValue<>(); ret.setOperationType(PendingOperationTypeType.MANUAL); ret.setOperationResult(result); return ret; }