Search in sources :

Example 1 with CaseType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.CaseType in project midpoint by Evolveum.

the class CertificationCaseHelper method addCertificationCampaignCases.

public void addCertificationCampaignCases(Session session, String campaignOid, Collection<PrismContainerValue> values, int currentId, List<Long> affectedIds) throws DtoTranslationException {
    for (PrismContainerValue value : values) {
        AccessCertificationCaseType caseType = new AccessCertificationCaseType();
        caseType.setupContainerValue(value);
        if (caseType.getId() == null) {
            caseType.setId((long) currentId);
            currentId++;
        }
        // we need to generate IDs but we (currently) do not use that for setting "isTransient" flag
        PrismIdentifierGenerator generator = new PrismIdentifierGenerator();
        generator.generate(caseType, PrismIdentifierGenerator.Operation.MODIFY);
        RAccessCertificationCase row = RAccessCertificationCase.toRepo(campaignOid, caseType, createRepositoryContext());
        row.setId(RUtil.toInteger(caseType.getId()));
        affectedIds.add(caseType.getId());
        session.save(row);
    }
}
Also used : AccessCertificationCaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType) PrismContainerValue(com.evolveum.midpoint.prism.PrismContainerValue) RAccessCertificationCase(com.evolveum.midpoint.repo.sql.data.common.container.RAccessCertificationCase)

Example 2 with CaseType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.CaseType in project midpoint by Evolveum.

the class ManualConnectorInstance method queryOperationStatus.

@Override
public OperationResultStatus queryOperationStatus(String asyncronousOperationReference, OperationResult parentResult) throws ObjectNotFoundException, SchemaException {
    OperationResult result = parentResult.createMinorSubresult(OPERATION_QUERY_CASE);
    PrismObject<CaseType> acase;
    try {
        acase = repositoryService.getObject(CaseType.class, asyncronousOperationReference, null, result);
    } catch (ObjectNotFoundException | SchemaException e) {
        result.recordFatalError(e);
        throw e;
    }
    CaseType caseType = acase.asObjectable();
    String state = caseType.getState();
    if (QNameUtil.matchWithUri(SchemaConstants.CASE_STATE_OPEN_QNAME, state)) {
        result.recordSuccess();
        return OperationResultStatus.IN_PROGRESS;
    } else if (QNameUtil.matchWithUri(SchemaConstants.CASE_STATE_CLOSED_QNAME, state)) {
        String outcome = caseType.getOutcome();
        OperationResultStatus status = translateOutcome(outcome);
        result.recordSuccess();
        return status;
    } else {
        SchemaException e = new SchemaException("Unknown case state " + state);
        result.recordFatalError(e);
        throw e;
    }
}
Also used : OperationResultStatus(com.evolveum.midpoint.schema.result.OperationResultStatus) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) CaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.CaseType) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Example 3 with CaseType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.CaseType in project midpoint by Evolveum.

the class ManualConnectorInstance method addCase.

private PrismObject<CaseType> addCase(String description, OperationResult result) throws SchemaException, ObjectAlreadyExistsException {
    PrismObject<CaseType> acase = getPrismContext().getSchemaRegistry().findObjectDefinitionByCompileTimeClass(CaseType.class).instantiate();
    CaseType caseType = acase.asObjectable();
    String caseOid = OidUtil.generateOid();
    caseType.setOid(caseOid);
    // TODO: human-readable case ID
    caseType.setName(new PolyStringType(caseOid));
    caseType.setDescription(description);
    // subtype
    caseType.setState(SchemaConstants.CASE_STATE_OPEN);
    // TODO: case payload
    // TODO: a lot of other things
    // TODO: move to case-manager
    LOGGER.info("CREATING CASE:\n{}", acase.debugDump(1));
    repositoryService.addObject(acase, null, result);
    return acase;
}
Also used : PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) CaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.CaseType)

Example 4 with CaseType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.CaseType in project midpoint by Evolveum.

the class ManualConnectorInstance method createTicketDelete.

@Override
protected String createTicketDelete(ObjectClassComplexTypeDefinition objectClass, Collection<? extends ResourceAttribute<?>> identifiers, OperationResult result) throws ObjectNotFoundException, CommunicationException, GenericFrameworkException, SchemaException, ConfigurationException {
    LOGGER.info("Creating case to delete account {}", identifiers);
    String description = "Please delete account " + identifiers;
    PrismObject<CaseType> acase;
    try {
        acase = addCase(description, result);
    } catch (ObjectAlreadyExistsException e) {
        // should not happen
        throw new SystemException(e.getMessage(), e);
    }
    return acase.getOid();
}
Also used : SystemException(com.evolveum.midpoint.util.exception.SystemException) CaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.CaseType) ObjectAlreadyExistsException(com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)

Aggregations

CaseType (com.evolveum.midpoint.xml.ns._public.common.common_3.CaseType)3 PrismContainerValue (com.evolveum.midpoint.prism.PrismContainerValue)1 RAccessCertificationCase (com.evolveum.midpoint.repo.sql.data.common.container.RAccessCertificationCase)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 OperationResultStatus (com.evolveum.midpoint.schema.result.OperationResultStatus)1 ObjectAlreadyExistsException (com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)1 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 SystemException (com.evolveum.midpoint.util.exception.SystemException)1 AccessCertificationCaseType (com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType)1 PolyStringType (com.evolveum.prism.xml.ns._public.types_3.PolyStringType)1