热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

com.evolveum.midpoint.prism.PrismReferenceValue.setObject()方法的使用及代码示例

本文整理了Java中com.evolveum.midpoint.prism.PrismReferenceValue.setObject()方法的一些代码示例,展示了

本文整理了Java中com.evolveum.midpoint.prism.PrismReferenceValue.setObject()方法的一些代码示例,展示了PrismReferenceValue.setObject()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PrismReferenceValue.setObject()方法的具体详情如下:
包路径:com.evolveum.midpoint.prism.PrismReferenceValue
类名称:PrismReferenceValue
方法名:setObject

PrismReferenceValue.setObject介绍

暂无

代码示例

代码示例来源:origin: Evolveum/midpoint

public static ObjectReferenceType createObjectRefWithFullObject(PrismObject object,
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 owner) {
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 resource) {
if (resourceRefVal != null) {
boolean immutable = resourceRefVal.isImmutable();
if (immutable) {
resourceRefVal.setImmutable(false);
}
resourceRefVal.setObject(resource);
resourceRefVal.setImmutable(immutable);
}
}

代码示例来源:origin: Evolveum/midpoint

public static PrismReferenceValue objectableAsReferenceValue(T objectable, PrismReference reference ) {
PrismObject object = objectable.asPrismObject();
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 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 PrismObject resolveReferenceUsingOption(@NotNull PrismReferenceValue refVal,
SelectorOptions option, Containerable containerable, Task task, OperationResult parentResult) {
OperationResult result = parentResult.createMinorSubresult(RESOLVE_REFERENCE);
try {
PrismObject refObject;
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 shadow = shadowRef.asReferenceValue().getObject();
if (shadow == null) {
Collection> optiOns= SelectorOptions.createCollection(
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 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 resolveOwnerRef(OperationResult result) throws SchemaException {
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 owner = repositoryService.getObject(UserType.class, ownerRef.getOid(), null, result);
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 createModifyUserDeleteAccount(String userOid, String resourceOid) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
String accountOid = getLinkRefOid(userOid, resourceOid);
PrismObject account = getShadowModel(accountOid);
ObjectDelta userDelta = prismContext.deltaFactory().object().createEmptyModifyDelta(UserType.class, userOid
);
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 account = prismContext.parseObject(accountFile);
ObjectDelta userDelta = prismContext.deltaFactory().object().createEmptyModifyDelta(UserType.class, userOid
);
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 createModifyUserAddAccount(String userOid, PrismObject resource) throws SchemaException {
PrismObject account = getAccountShadowDefinition().instantiate();
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 userDelta = prismContext.deltaFactory().object().createEmptyModifyDelta(UserType.class, userOid
);
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> accountSource,
ObjectChecker> checker) throws Exception {
final String TEST_NAME = bundleName + "Implicit";
displayTestTitle(TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject account = accountSource.get();
ObjectDelta userDelta = prismContext.deltaFactory().object()
.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> accountSource, ObjectChecker> checker) throws Exception {
final String TEST_NAME = bundleName + "ImplicitExplicitSameReverse";
displayTestTitle(TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject account = accountSource.get();
ObjectDelta userDelta = prismContext.deltaFactory().object()
.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 accountDelta = account.createAddDelta();
Collection> deltas = MiscSchemaUtil.createCollection(accountDelta, userDelta);
doPreview(deltas, checker, task, result);
}

代码示例来源:origin: Evolveum/midpoint

private void modifyUserAddAccountImplicitExplicitSame(String bundleName,
ObjectSource> accountSource, ObjectChecker> checker) throws Exception {
final String TEST_NAME = bundleName + "ImplicitExplicitSame";
displayTestTitle(TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject account = accountSource.get();
ObjectDelta userDelta = prismContext.deltaFactory().object()
.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 accountDelta = account.createAddDelta();
Collection> deltas = MiscSchemaUtil.createCollection(userDelta, accountDelta);
doPreview(deltas, checker, task, result);
}

代码示例来源:origin: Evolveum/midpoint

private void modifyUserAddAccountImplicitExplicitEqual(String bundleName,
ObjectSource> accountSource, ObjectChecker> checker) throws Exception {
final String TEST_NAME = bundleName + "ImplicitExplicitEqual";
displayTestTitle(TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject account = accountSource.get();
ObjectDelta userDelta = prismContext.deltaFactory().object()
.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 accountDelta = account.createAddDelta();
Collection> deltas = MiscSchemaUtil.createCollection(userDelta, accountDelta);
doPreview(deltas, checker, task, result);
}

推荐阅读
author-avatar
金色阳光CC
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有