RepositoryService repository = this.context.getRepository();
RepositoryService repository = context.getRepository(); repository.deleteObject(prismObject.getCompileTimeClass(), prismObject.getOid(), operationResult); RepositoryService repository = context.getRepository(); repository.searchObjectsIterative(type.getClassDefinition(), query, handler, opts, true, result);
@Test public void setupRepositoryViaMidpointHome() throws Exception { JCommander jc = NinjaUtils.setupCommandLineParser(); jc.parse("-m", "./target/midpoint-home", "-U", "jdbc:postgresql://localhost/midpoint", "-u", "midpoint", "-p", "qwe123"); ConnectionOptions options = NinjaUtils.getOptions(jc, ConnectionOptions.class); NinjaContext ctx = new NinjaContext(null); ctx.init(options); RepositoryService service = ctx.getRepository(); OperationResult result = new OperationResult("get user"); PrismObject obj = service.getObject(UserType.class, SystemObjectsType.USER_ADMINISTRATOR.value(), null, result); System.out.println(obj.debugDump()); } }
RepositoryService repository = context.getRepository(); repository.addObject(object, opts, new OperationResult("Import object"));
@Test public void importByOid() { String[] input = new String[]{"-m", getMidpointHome(), "import", "-o", "00000000-0000-0000-0000-111100000002", "-i", RESOURCES_FOLDER + "/objects.zip", "-z"}; ByteArrayOutputStream bos = new ByteArrayOutputStream(); executeTest(null, context -> { RepositoryService repo = context.getRepository(); OperationResult result = new OperationResult("count objects"); int count = repo.countObjects(ObjectType.class, null, null, result); AssertJUnit.assertEquals(0, count); }, context -> { RepositoryService repo = context.getRepository(); OperationResult result = new OperationResult("count users"); int count = repo.countObjects(UserType.class, null, null, result); AssertJUnit.assertEquals(1, count); }, true, true, input); List<String> out = getSystemOut(); AssertJUnit.assertEquals(out.toString(), 5, out.size()); AssertJUnit.assertTrue(getSystemErr().isEmpty()); }
@Override public void execute() throws Exception { RepositoryService repository = context.getRepository(); FileReference fileReference = options.getFilter(); if (fileReference != null && options.getFilter() == null) { throw new NinjaException("Type must be defined"); } List<ObjectTypes> types = NinjaUtils.getTypes(options.getType()); int total = 0; OperationResult result = new OperationResult(OPERATION_COUNT); for (ObjectTypes type : types) { ObjectQuery query = NinjaUtils.createObjectQuery(options.getFilter(), context, type.getClassDefinition()); int count = repository.countObjects(type.getClassDefinition(), query, new ArrayList<>(), result); if (count == 0 && options.getType() == null) { continue; } log.info("{}:\t{}", type.name(), count); total += count; } log.info("===\nTotal:\t{}", total); } }
}; RepositoryService repository = context.getRepository(); repository.searchObjectsIterative(type.getClassDefinition(), query, handler, optionsBuilder.build(), true, operation.getResult()); } catch (SchemaException ex) {
RepositoryService repo = context.getRepository(); RepositoryService repo = context.getRepository(); try { repo.getObject(ObjectTypes.ROLE.getClassDefinition(), oid,