本文整理了Java中com.evolveum.midpoint.prism.PrismReferenceValue.setObject()
方法的一些代码示例,展示了PrismReferenceValue.setObject()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PrismReferenceValue.setObject()
方法的具体详情如下:
包路径:com.evolveum.midpoint.prism.PrismReferenceValue
类名称:PrismReferenceValue
方法名:setObject
暂无
代码示例来源:origin: Evolveum/midpoint
public static
PrismContext prismContext) {
if (object == null) {
return null;
}
ObjectReferenceType ref = createObjectRef(object, prismContext);
ref.asReferenceValue().setObject(object);
return ref;
}
代码示例来源:origin: Evolveum/midpoint
@Override
public void setOwner(PrismObject
if (isPersistent()) {
throw new IllegalStateException("setOwner method can be called only on transient tasks!");
}
PrismReference ownerRef;
try {
ownerRef = taskPrism.findOrCreateReference(TaskType.F_OWNER_REF);
} catch (SchemaException e) {
// This should not happen
throw new IllegalStateException("Internal schema error: " + e.getMessage(), e);
}
ownerRef.getValue().setObject(owner);
}
代码示例来源:origin: Evolveum/midpoint
private void distributeResourceValue(PrismReferenceValue resourceRefVal, PrismObject
if (resourceRefVal != null) {
boolean immutable = resourceRefVal.isImmutable();
if (immutable) {
resourceRefVal.setImmutable(false);
}
resourceRefVal.setObject(resource);
resourceRefVal.setImmutable(immutable);
}
}
代码示例来源:origin: Evolveum/midpoint
public static
PrismObject
for (PrismReferenceValue refValue: reference.getValues()) {
if (object == refValue.getObject()) {
return refValue;
}
}
PrismReferenceValue referenceValue = new PrismReferenceValueImpl();
referenceValue.setObject(object);
return referenceValue;
}
代码示例来源:origin: Evolveum/midpoint
@SuppressWarnings("unchecked")
private PrismReferenceValue createRefValueWithObject(PrismReferenceValue refValue, VisualizationContext context, Task task, OperationResult result) {
if (refValue.getObject() != null) {
return refValue;
}
PrismObject extends ObjectType> object = getObject(refValue.getOid(),
(Class) refValue.getTargetTypeCompileTimeClass(prismContext), context, task, result);
if (object == null) {
return refValue;
}
refValue = refValue.clone();
refValue.setObject(object);
return refValue;
}
代码示例来源:origin: Evolveum/midpoint
private void collectMembership(AssignmentHolderType targetType, QName relation, EvaluationContext ctx) {
PrismReferenceValue refVal = prismContext.itemFactory().createReferenceValue();
refVal.setObject(targetType.asPrismObject());
refVal.setTargetType(ObjectTypes.getObjectType(targetType.getClass()).getTypeQName());
refVal.setRelation(relation);
refVal.setTargetName(targetType.getName().toPolyString());
collectMembershipRefVal(refVal, targetType.getClass(), relation, targetType, ctx);
}
代码示例来源:origin: Evolveum/midpoint
private ValuePolicyType postProcessCredentialPolicy(SecurityPolicyType securityPolicyType, CredentialPolicyType credPolicy, String credShortDesc, Task task, OperationResult result) {
ObjectReferenceType valuePolicyRef = credPolicy.getValuePolicyRef();
if (valuePolicyRef == null) {
return null;
}
ValuePolicyType valuePolicyType;
try {
valuePolicyType = objectResolver.resolve(valuePolicyRef, ValuePolicyType.class, null, credShortDesc + " in " + securityPolicyType, task, result);
} catch (ObjectNotFoundException | SchemaException | CommunicationException | ConfigurationException | SecurityViolationException | ExpressionEvaluationException e) {
LOGGER.warn("{} {} referenced from {} was not found", credShortDesc, valuePolicyRef.getOid(), securityPolicyType);
return null;
}
valuePolicyRef.asReferenceValue().setObject(valuePolicyType.asPrismObject());
return valuePolicyType;
}
代码示例来源:origin: Evolveum/midpoint
@Override
public PrismReferenceValue createReferenceValue(PrismObject> target) {
PrismReferenceValue rv = new PrismReferenceValueImpl(target.getOid());
rv.setPrismContext(prismContext);
rv.setObject(target);
if (target.getDefinition() != null) {
rv.setTargetType(target.getDefinition().getTypeName());
}
return rv;
}
代码示例来源:origin: Evolveum/midpoint
private
SelectorOptions
OperationResult result = parentResult.createMinorSubresult(RESOLVE_REFERENCE);
try {
PrismObject
refObject = objectResolver.resolve(refVal, containerable.toString(), option.getOptions(), task, result);
refObject = refObject.cloneIfImmutable();
schemaTransformer.applySchemasAndSecurity(refObject, option.getOptions(),
SelectorOptions.createCollection(option.getOptions()), null, task, result);
refVal.setObject(refObject);
return refObject;
} catch (CommonException e) {
result.recordWarning("Couldn't resolve reference to " + ObjectTypeUtil.toShortString(refVal) + ": " + e.getMessage(), e);
return null;
} finally {
result.computeStatusIfUnknown();
}
}
代码示例来源:origin: Evolveum/midpoint
public ShadowType resolveTargetUnchecked(ShadowAssociationType association, OperationResult result) throws SchemaException, ObjectNotFoundException {
if (association == null) {
return null;
}
ObjectReferenceType shadowRef = association.getShadowRef();
if (shadowRef == null || shadowRef.getOid() == null) {
throw new IllegalStateException("None or null-OID shadowRef in " + association);
}
PrismObject
if (shadow == null) {
Collection
GetOperationOptions.createNoFetch());
shadow = repositoryService.getObject(ShadowType.class, shadowRef.getOid(), options, result);
shadowRef.asReferenceValue().setObject(shadow);
}
return shadow.asObjectable();
}
代码示例来源:origin: Evolveum/midpoint
private static PrismReferenceValue getAuditTarget(ObjectDelta extends ObjectType> delta,
PrismContext prismContext) {
PrismReferenceValue targetRef = prismContext.itemFactory().createReferenceValue(delta.getOid());
targetRef.setTargetType(ObjectTypes.getObjectType(delta.getObjectTypeClass()).getTypeQName());
if (delta.isAdd()) {
targetRef.setObject(delta.getObjectToAdd());
}
return targetRef;
}
代码示例来源:origin: Evolveum/midpoint
private SecurityPolicyType postProcessPasswordPolicy(ValuePolicyType passwordPolicyType) {
SecurityPolicyType securityPolicyType = new SecurityPolicyType();
CredentialsPolicyType creds = new CredentialsPolicyType();
PasswordCredentialsPolicyType passwd = new PasswordCredentialsPolicyType();
ObjectReferenceType passwordPolicyRef = new ObjectReferenceType();
passwordPolicyRef.asReferenceValue().setObject(passwordPolicyType.asPrismObject());
passwd.setValuePolicyRef(passwordPolicyRef);
creds.setPassword(passwd);
securityPolicyType.setCredentials(creds);
setDeprecatedPasswordPolicyProperties(passwordPolicyType, passwd);
return securityPolicyType;
}
代码示例来源:origin: Evolveum/midpoint
PrismObject
PrismReference ownerRef = taskPrism.findReference(TaskType.F_OWNER_REF);
if (ownerRef == null) {
throw new SchemaException("Task " + getOid() + " does not have an owner (missing ownerRef)");
}
try {
PrismObject
ownerRef.getValue().setObject(owner);
return owner;
} catch (ObjectNotFoundException e) {
LoggingUtils.logExceptionAsWarning(LOGGER, "The owner of task {} cannot be found (owner OID: {})", e, getOid(),
ownerRef.getOid());
return null;
}
}
代码示例来源:origin: Evolveum/midpoint
protected ObjectDelta
String accountOid = getLinkRefOid(userOid, resourceOid);
PrismObject
ObjectDelta
);
PrismReferenceValue accountRefVal = itemFactory().createReferenceValue();
accountRefVal.setObject(account);
ReferenceDelta accountDelta = prismContext.deltaFactory().reference().createModificationDelete(UserType.F_LINK_REF, getUserDefinition(), accountRefVal);
userDelta.addModification(accountDelta);
return userDelta;
}
代码示例来源:origin: Evolveum/midpoint
protected void modifyUserAddAccount(String userOid, File accountFile, Task task, OperationResult result) throws SchemaException, IOException, ObjectAlreadyExistsException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException {
PrismObject
ObjectDelta
);
PrismReferenceValue accountRefVal = itemFactory().createReferenceValue();
accountRefVal.setObject(account);
ReferenceDelta accountDelta = prismContext.deltaFactory().reference().createModificationAdd(UserType.F_LINK_REF, getUserDefinition(), accountRefVal);
userDelta.addModification(accountDelta);
Collection> deltas = (Collection)MiscUtil.createCollection(userDelta);
modelService.executeChanges(deltas, null, task, result);
}
代码示例来源:origin: Evolveum/midpoint
protected ObjectDelta
PrismObject
ObjectReferenceType resourceRef = new ObjectReferenceType();
resourceRef.setOid(resource.getOid());
account.asObjectable().setResourceRef(resourceRef);
RefinedResourceSchema refinedSchema = RefinedResourceSchemaImpl.getRefinedSchema(resource);
account.asObjectable().setObjectClass(refinedSchema.getDefaultRefinedDefinition(ShadowKindType.ACCOUNT).getObjectClassDefinition().getTypeName());
ObjectDelta
);
PrismReferenceValue accountRefVal = itemFactory().createReferenceValue();
accountRefVal.setObject(account);
ReferenceDelta accountDelta = prismContext.deltaFactory().reference().createModificationAdd(UserType.F_LINK_REF, getUserDefinition(), accountRefVal);
userDelta.addModification(accountDelta);
return userDelta;
}
代码示例来源:origin: Evolveum/midpoint
private void modifyUserAddAccountImplicit(String bundleName, ObjectSource
ObjectChecker
final String TEST_NAME = bundleName + "Implicit";
displayTestTitle(TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject
ObjectDelta
.createEmptyModifyDelta(UserType.class, USER_JACK_OID);
PrismReferenceValue accountRefVal = itemFactory().createReferenceValue();
accountRefVal.setObject(account);
ReferenceDelta accountRefDelta = prismContext.deltaFactory().reference().createModificationAdd(UserType.F_LINK_REF, getUserDefinition(), accountRefVal);
userDelta.addModification(accountRefDelta);
Collection> deltas = MiscSchemaUtil.createCollection(userDelta);
doPreview(deltas, checker, task, result);
}
代码示例来源:origin: Evolveum/midpoint
private void modifyUserAddAccountImplicitExplicitSameReverse(String bundleName,
ObjectSource
final String TEST_NAME = bundleName + "ImplicitExplicitSameReverse";
displayTestTitle(TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject
ObjectDelta
.createEmptyModifyDelta(UserType.class, USER_JACK_OID);
PrismReferenceValue accountRefVal = itemFactory().createReferenceValue();
accountRefVal.setObject(account);
ReferenceDelta accountRefDelta = prismContext.deltaFactory().reference().createModificationAdd(UserType.F_LINK_REF, getUserDefinition(), accountRefVal);
userDelta.addModification(accountRefDelta);
ObjectDelta
Collection> deltas = MiscSchemaUtil.createCollection(accountDelta, userDelta);
doPreview(deltas, checker, task, result);
}
代码示例来源:origin: Evolveum/midpoint
private void modifyUserAddAccountImplicitExplicitSame(String bundleName,
ObjectSource
final String TEST_NAME = bundleName + "ImplicitExplicitSame";
displayTestTitle(TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject
ObjectDelta
.createEmptyModifyDelta(UserType.class, USER_JACK_OID);
PrismReferenceValue accountRefVal = itemFactory().createReferenceValue();
accountRefVal.setObject(account);
ReferenceDelta accountRefDelta = prismContext.deltaFactory().reference().createModificationAdd(UserType.F_LINK_REF, getUserDefinition(), accountRefVal);
userDelta.addModification(accountRefDelta);
ObjectDelta
Collection> deltas = MiscSchemaUtil.createCollection(userDelta, accountDelta);
doPreview(deltas, checker, task, result);
}
代码示例来源:origin: Evolveum/midpoint
private void modifyUserAddAccountImplicitExplicitEqual(String bundleName,
ObjectSource
final String TEST_NAME = bundleName + "ImplicitExplicitEqual";
displayTestTitle(TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject
ObjectDelta
.createEmptyModifyDelta(UserType.class, USER_JACK_OID);
PrismReferenceValue accountRefVal = itemFactory().createReferenceValue();
accountRefVal.setObject(account.clone());
ReferenceDelta accountRefDelta = prismContext.deltaFactory().reference().createModificationAdd(UserType.F_LINK_REF, getUserDefinition(), accountRefVal);
userDelta.addModification(accountRefDelta);
ObjectDelta
Collection> deltas = MiscSchemaUtil.createCollection(userDelta, accountDelta);
doPreview(deltas, checker, task, result);
}