Search in sources :

Example 46 with PolyStringType

use of com.evolveum.prism.xml.ns._public.types_3.PolyStringType in project midpoint by Evolveum.

the class AbstractOrgClosureTest method createPolyString.

protected PolyStringType createPolyString(String orig) {
    PolyStringType poly = new PolyStringType();
    poly.setOrig(orig);
    return poly;
}
Also used : PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType)

Example 47 with PolyStringType

use of com.evolveum.prism.xml.ns._public.types_3.PolyStringType in project midpoint by Evolveum.

the class TaskManagerQuartzImpl method persist.

private void persist(Task task, OperationResult parentResult) {
    if (task.getPersistenceStatus() == TaskPersistenceStatus.PERSISTENT) {
        // Task already persistent. Nothing to do.
        return;
    }
    TaskQuartzImpl taskImpl = (TaskQuartzImpl) task;
    if (task.getName() == null) {
        PolyStringType polyStringName = new PolyStringType("Task " + task.getTaskIdentifier());
        taskImpl.setNameTransient(polyStringName);
    }
    if (taskImpl.getOid() != null) {
        // We don't support user-specified OIDs
        throw new IllegalArgumentException("Transient task must not have OID (task:" + task + ")");
    }
    // hack: set Category if it is not set yet
    if (taskImpl.getCategory() == null) {
        taskImpl.setCategoryTransient(taskImpl.getCategoryFromHandler());
    }
    // Make sure that the task has repository service instance, so it can fully work as "persistent"
    if (taskImpl.getRepositoryService() == null) {
        RepositoryService repoService = (RepositoryService) this.beanFactory.getBean("repositoryService");
        taskImpl.setRepositoryService(repoService);
    }
    try {
        addTaskToRepositoryAndQuartz(taskImpl, parentResult);
    } catch (ObjectAlreadyExistsException ex) {
        // This should not happen. If it does, it is a bug. It is OK to convert to a runtime exception
        throw new IllegalStateException("Got ObjectAlreadyExistsException while not expecting it (task:" + task + ")", ex);
    } catch (SchemaException ex) {
        // This should not happen. If it does, it is a bug. It is OK to convert to a runtime exception
        throw new IllegalStateException("Got SchemaException while not expecting it (task:" + task + ")", ex);
    }
}
Also used : PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ObjectAlreadyExistsException(com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException) RepositoryService(com.evolveum.midpoint.repo.api.RepositoryService)

Example 48 with PolyStringType

use of com.evolveum.prism.xml.ns._public.types_3.PolyStringType in project midpoint by Evolveum.

the class NodeRegistrar method createNodePrism.

private PrismObject<NodeType> createNodePrism(TaskManagerConfiguration configuration) {
    PrismObjectDefinition<NodeType> nodeTypeDef = getPrismContext().getSchemaRegistry().findObjectDefinitionByCompileTimeClass(NodeType.class);
    PrismObject<NodeType> nodePrism;
    try {
        nodePrism = nodeTypeDef.instantiate();
    } catch (SchemaException e) {
        throw new SystemException(e.getMessage(), e);
    }
    NodeType node = nodePrism.asObjectable();
    node.setNodeIdentifier(configuration.getNodeId());
    node.setName(new PolyStringType(configuration.getNodeId()));
    node.setHostname(getMyAddress());
    node.setJmxPort(configuration.getJmxPort());
    node.setClustered(configuration.isClustered());
    node.setRunning(true);
    node.setLastCheckInTime(getCurrentTime());
    node.setBuild(getBuildInformation());
    generateInternalNodeIdentifier(node);
    return nodePrism;
}
Also used : PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) SystemException(com.evolveum.midpoint.util.exception.SystemException) NodeType(com.evolveum.midpoint.xml.ns._public.common.common_3.NodeType)

Example 49 with PolyStringType

use of com.evolveum.prism.xml.ns._public.types_3.PolyStringType in project midpoint by Evolveum.

the class AbstractWebserviceTest method createPolyStringType.

/**
     *  Creates polystring type with String value passed in argument
     * */
protected static PolyStringType createPolyStringType(String string, Document doc) {
    PolyStringType polyStringType = new PolyStringType();
    Element origElement = createTextElement(TYPES_POLYSTRING_ORIG, string, doc);
    polyStringType.getContent().add(origElement);
    return polyStringType;
}
Also used : PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) JAXBElement(javax.xml.bind.JAXBElement)

Example 50 with PolyStringType

use of com.evolveum.prism.xml.ns._public.types_3.PolyStringType in project midpoint by Evolveum.

the class TestWSSecurity method test141ModifyTitleAsDarthAdder.

@Test
public void test141ModifyTitleAsDarthAdder() throws Exception {
    final String TEST_NAME = "test141ModifyTitleAsDarthAdder";
    displayTestTitle(TEST_NAME);
    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(USER_DARTHADDER_USERNAME, USER_DARTHADDER_PASSWORD, WSConstants.PW_DIGEST);
    ObjectDeltaListType deltaList = ModelClientUtil.createModificationDeltaList(UserType.class, USER_DARTHADDER_OID, "title", ModificationTypeType.REPLACE, ModelClientUtil.createPolyStringType("Dark Lord"));
    // WHEN
    ObjectDeltaOperationListType deltaOpList = modelPort.executeChanges(deltaList, null);
    // THEN
    assertSuccess(deltaOpList);
    tailer.tail();
    displayAudit(tailer);
    assertAuditLoginLogout(tailer);
    assertAuditIds(tailer);
    assertAuditOperation(tailer, "MODIFY_OBJECT");
    tailer.assertAudit(4);
    UserType user = getObject(UserType.class, USER_DARTHADDER_OID);
    PolyStringType title = user.getTitle();
    assertEquals("Wrong title", "Dark Lord", ModelClientUtil.getOrig(title));
}
Also used : LogfileTestTailer(com.evolveum.midpoint.test.util.LogfileTestTailer) PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) ObjectDeltaOperationListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Aggregations

PolyStringType (com.evolveum.prism.xml.ns._public.types_3.PolyStringType)94 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)28 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)26 Test (org.testng.annotations.Test)23 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)20 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)14 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)12 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)12 QName (javax.xml.namespace.QName)11 Task (com.evolveum.midpoint.task.api.Task)10 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)10 File (java.io.File)10 PrismObject (com.evolveum.midpoint.prism.PrismObject)9 OrgType (com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType)8 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)7 ArrayList (java.util.ArrayList)7 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)5 AbstractInternalModelIntegrationTest (com.evolveum.midpoint.model.impl.AbstractInternalModelIntegrationTest)4 ObjectAlreadyExistsException (com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)4 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)4