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);
}
}
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;
}
}
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;
}
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();
}
Aggregations