Search in sources :

Example 91 with PolyString

use of com.evolveum.midpoint.prism.polystring.PolyString in project midpoint by Evolveum.

the class ImportObjects method getDisplayName.

private String getDisplayName(PrismObject object) {
    StringBuilder builder = new StringBuilder();
    //name
    PolyString name = getName(object);
    if (name != null) {
        builder.append(name.getOrig());
    }
    //oid
    if (builder.length() != 0) {
        builder.append(' ');
    }
    builder.append('\'').append(object.getOid()).append('\'');
    return builder.toString();
}
Also used : PolyString(com.evolveum.midpoint.prism.polystring.PolyString)

Example 92 with PolyString

use of com.evolveum.midpoint.prism.polystring.PolyString in project midpoint by Evolveum.

the class ExportObjects method getDisplayName.

private String getDisplayName(PrismObject object) {
    StringBuilder builder = new StringBuilder();
    //name
    PolyString name = getName(object);
    if (name != null) {
        builder.append(name.getOrig());
    }
    //oid
    if (builder.length() != 0) {
        builder.append(' ');
    }
    builder.append('\'').append(object.getOid()).append('\'');
    return builder.toString();
}
Also used : PolyString(com.evolveum.midpoint.prism.polystring.PolyString)

Example 93 with PolyString

use of com.evolveum.midpoint.prism.polystring.PolyString in project midpoint by Evolveum.

the class TestMultiResource method test228ModifyUserJackDefaultDummyNoError.

/**
	 * Reset break mode, make sure that everything is back to normal.
	 * MID-2134
	 */
@Test
public void test228ModifyUserJackDefaultDummyNoError() throws Exception {
    final String TEST_NAME = "test228ModifyUserJackDefaultDummyNoError";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestMultiResource.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    dummyAuditService.clear();
    getDummyResource().resetBreakMode();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    modifyUserReplace(USER_JACK_OID, UserType.F_FULL_NAME, task, result, new PolyString(USER_JACK_FULL_NAME, null));
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    display("Result", result);
    TestUtil.assertSuccess(result);
    PrismObject<UserType> userJack = getUser(USER_JACK_OID);
    assertLinks(userJack, 2);
    display("dummy resource after", getDummyResource());
    display("beige dummy resource after", dummyResourceBeige);
    assertDummyAccount(null, ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true);
    assertDummyAccount(RESOURCE_DUMMY_BEIGE_NAME, ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true);
    // No value for ship ... no place to get it from
    assertDummyAccountAttribute(RESOURCE_DUMMY_BEIGE_NAME, ACCOUNT_JACK_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_SHIP_NAME);
    assertNoDummyAccount(RESOURCE_DUMMY_LAVENDER_NAME, ACCOUNT_JACK_DUMMY_USERNAME);
    assertNoDummyAccount(RESOURCE_DUMMY_IVORY_NAME, ACCOUNT_JACK_DUMMY_USERNAME);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test) AbstractPasswordTest(com.evolveum.midpoint.model.intest.password.AbstractPasswordTest)

Example 94 with PolyString

use of com.evolveum.midpoint.prism.polystring.PolyString in project midpoint by Evolveum.

the class WebComponentUtil method getEffectiveName.

public static <O extends ObjectType> String getEffectiveName(PrismObject<O> object, QName propertyName) {
    if (object == null) {
        return null;
    }
    PrismProperty prop = object.findProperty(propertyName);
    if (prop != null) {
        Object realValue = prop.getRealValue();
        if (prop.getDefinition().getTypeName().equals(DOMUtil.XSD_STRING)) {
            return (String) realValue;
        } else if (realValue instanceof PolyString) {
            return WebComponentUtil.getOrigStringFromPoly((PolyString) realValue);
        }
    }
    PolyString name = getValue(object, ObjectType.F_NAME, PolyString.class);
    return name != null ? name.getOrig() : null;
}
Also used : PrismProperty(com.evolveum.midpoint.prism.PrismProperty) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) PrismObject(com.evolveum.midpoint.prism.PrismObject) PolyString(com.evolveum.midpoint.prism.polystring.PolyString)

Example 95 with PolyString

use of com.evolveum.midpoint.prism.polystring.PolyString in project midpoint by Evolveum.

the class PropertyWrapper method createAddedValue.

@Override
public ValueWrapper createAddedValue() {
    ItemDefinition definition = item.getDefinition();
    ValueWrapper wrapper;
    if (SchemaConstants.T_POLY_STRING_TYPE.equals(definition.getTypeName())) {
        wrapper = new ValueWrapper(this, new PrismPropertyValue(new PolyString("")), new PrismPropertyValue(new PolyString("")), ValueStatus.ADDED);
    } else if (isUser() && isThisPropertyActivationEnabled()) {
        wrapper = new ValueWrapper(this, new PrismPropertyValue(null), new PrismPropertyValue(null), ValueStatus.ADDED);
    } else {
        wrapper = new ValueWrapper(this, new PrismPropertyValue(null), ValueStatus.ADDED);
    }
    return wrapper;
}
Also used : PolyString(com.evolveum.midpoint.prism.polystring.PolyString)

Aggregations

PolyString (com.evolveum.midpoint.prism.polystring.PolyString)168 Test (org.testng.annotations.Test)103 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)90 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)67 PrismPropertyValue (com.evolveum.midpoint.prism.PrismPropertyValue)53 PrismPropertyDefinition (com.evolveum.midpoint.prism.PrismPropertyDefinition)44 Task (com.evolveum.midpoint.task.api.Task)41 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)27 PrismObject (com.evolveum.midpoint.prism.PrismObject)21 QName (javax.xml.namespace.QName)18 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)17 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)16 PolyStringType (com.evolveum.prism.xml.ns._public.types_3.PolyStringType)15 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)12 ArrayList (java.util.ArrayList)12 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)10 File (java.io.File)10 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)9 PrismReferenceValue (com.evolveum.midpoint.prism.PrismReferenceValue)8 ProtectedStringType (com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType)8