Skip to content

Commit

Permalink
Fixed MID-4047: Create new user + assign WF role in one screen
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Jul 12, 2017
1 parent 32773f1 commit bfff22a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
Expand Up @@ -592,7 +592,7 @@ private PrismReferenceValue parseReferenceValueAsCompositeObject(XNode node,

PrismReferenceValue refVal = new PrismReferenceValue();
setReferenceObject(refVal, compositeObject);
((PrismReferenceDefinitionImpl) definition).setComposite(true);
((PrismReferenceDefinitionImpl) definition).setComposite(true); // TODO why do we modify the definition? is that safe?
return refVal;
}

Expand Down
Expand Up @@ -234,6 +234,13 @@ public static ObjectReferenceType createObjectRef(PrismReferenceValue prv) {
return ort;
}

public static ObjectReferenceType createObjectRefWithFullObject(ObjectType objectType) {
if (objectType == null) {
return null;
}
return createObjectRefWithFullObject(objectType.asPrismObject());
}

public static ObjectReferenceType createObjectRef(ObjectType objectType) {
if (objectType == null) {
return null;
Expand All @@ -255,7 +262,16 @@ public static <T extends ObjectType> ObjectReferenceType createObjectRef(PrismOb
return ref;
}

//FIXME TODO temporary hack
public static <T extends ObjectType> ObjectReferenceType createObjectRefWithFullObject(PrismObject<T> object) {
if (object == null) {
return null;
}
ObjectReferenceType ref = createObjectRef(object);
ref.asReferenceValue().setObject(object);
return ref;
}

//FIXME TODO temporary hack
public static <T extends ObjectType> ObjectReferenceType createObjectRef(PrismObject<T> object, boolean nameAsDescription) {
if (object == null) {
return null;
Expand Down
Expand Up @@ -896,7 +896,10 @@
Object whose modification is to be approved. (Normally the same as task.objectRef but there can be differences
in cases when the object is only to be created.) TODO - think this through.
</xsd:documentation>
</xsd:annotation>
<xsd:appinfo>
<a:composite>true</a:composite>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="targetRef" type="c:ObjectReferenceType" minOccurs="0" maxOccurs="1">
<xsd:annotation>
Expand Down
Expand Up @@ -22,6 +22,7 @@
import com.evolveum.midpoint.model.impl.lens.LensContext;
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.delta.ObjectDelta;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.util.ObjectTypeUtil;
import com.evolveum.midpoint.task.api.*;
Expand Down Expand Up @@ -256,7 +257,13 @@ public void setObjectRef(ObjectReferenceType ref, OperationResult result) {

public void setObjectRef(ModelContext<?> modelContext, OperationResult result) {
ObjectType focus = MiscDataUtil.getFocusObjectNewOrOld(modelContext);
setObjectRef(ObjectTypeUtil.createObjectRef(focus), result);
ObjectDelta<?> primaryDelta = modelContext.getFocusContext().getPrimaryDelta();
if (primaryDelta != null && primaryDelta.isAdd()) {
ObjectReferenceType ref = ObjectTypeUtil.createObjectRefWithFullObject(focus);
wfContext.setObjectRef(ref);
} else {
setObjectRef(ObjectTypeUtil.createObjectRef(focus), result);
}
}

public void setTargetRef(ObjectReferenceType ref, OperationResult result) {
Expand Down
Expand Up @@ -57,7 +57,7 @@ public TaskRunResult run(Task task) {
OperationResult result = task.getResult().createSubresult(WaitForTasksTaskHandler.class.getName()+".run");
result.recordInProgress();

LOGGER.info("WaitForTasksTaskHandler run starting; in task " + task.getName());
LOGGER.debug("WaitForTasksTaskHandler run starting; in task " + task.getName());
try {
// todo resolve this brutal hack
taskManagerImpl.pauseTask(task, TaskWaitingReason.OTHER, result);
Expand All @@ -67,7 +67,7 @@ public TaskRunResult run(Task task) {
} catch (ObjectNotFoundException e) {
throw new SystemException("Couldn't mark task as waiting for prerequisite tasks", e); // should not occur; will be handled by task runner
}
LOGGER.info("WaitForTasksTaskHandler run finishing; in task " + task.getName());
LOGGER.debug("WaitForTasksTaskHandler run finishing; in task " + task.getName());

result.computeStatus();

Expand Down

0 comments on commit bfff22a

Please sign in to comment.