Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Apr 22, 2014
2 parents 7271408 + dbaada0 commit a4b627d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
Expand Up @@ -287,7 +287,7 @@ public void testParseResourceRoundtrip() throws Exception {
System.out.println(reparsedResource.debugDump());

// Cannot assert here. It will cause parsing of some of the raw values and diff will fail
assertResource(resource, true, false, false);
assertResource(reparsedResource, true, false, false);

PrismProperty<SchemaDefinitionType> definitionProperty = reparsedResource.findContainer(ResourceType.F_SCHEMA).findProperty(XmlSchemaType.F_DEFINITION);
SchemaDefinitionType definitionElement = definitionProperty.getValue().getValue();
Expand Down
Expand Up @@ -38,6 +38,12 @@ public static enum Operation {ADD, DELETE, MODIFY}

private static final Trace LOGGER = TraceManager.getTrace(OrgClosureManager.class);

private SqlRepositoryConfiguration repoConfiguration;

public OrgClosureManager(SqlRepositoryConfiguration repoConfiguration) {
this.repoConfiguration = repoConfiguration;
}

public <T extends ObjectType> void updateOrgClosure(Collection<? extends ItemDelta> modifications, Session session,
String oid, Class<T> type, Operation operation) {
LOGGER.debug("Starting update for org. closure for {} {}.", oid, type);
Expand Down
Expand Up @@ -91,9 +91,13 @@ public class SqlRepositoryServiceImpl extends SqlBaseService implements Reposito

public SqlRepositoryServiceImpl(SqlRepositoryFactory repositoryFactory) {
super(repositoryFactory);
}

//there maybe different implementations for different RMDBs
orgClosureManager = new OrgClosureManager();
private OrgClosureManager getOrgClosureManager() {
if (orgClosureManager == null) {
orgClosureManager = new OrgClosureManager(getConfiguration());
}
return orgClosureManager;
}

private <T extends ObjectType> PrismObject<T> getObject(Session session, Class<T> type, String oid,
Expand Down Expand Up @@ -530,7 +534,8 @@ private <T extends ObjectType> String overwriteAddObjectAttempt(PrismObject<T> o
updateFullObject(rObject, object);
RObject merged = (RObject) session.merge(rObject);
//todo finish orgClosureManager
//orgClosureManager.updateOrgClosure(modifications, session, originalOid, object.getCompileTimeClass(), operation);
// orgClosureManager.updateOrgClosure(modifications, session, merged.getOid(), object.getCompileTimeClass(),
// OrgClosureManager.Operation.ADD);

//update org. unit hierarchy based on modifications
if (modifications == null || modifications.isEmpty()) {
Expand Down Expand Up @@ -602,7 +607,6 @@ private <T extends ObjectType> String nonOverwriteAddObjectAttempt(PrismObject<T
// OrgClosureManager.Operation.ADD);



if (objectType instanceof OrgType || !objectType.getParentOrgRef().isEmpty()) {
long time = System.currentTimeMillis();
LOGGER.trace("Org. structure closure table update started.");
Expand Down Expand Up @@ -899,7 +903,7 @@ private <T extends ObjectType> int countObjectsAttempt(Class<T> type, ObjectQuer
LOGGER.trace("Selecting total count.");
longCount = (Number) rQuery.uniqueResult();
}
count = longCount.intValue();
count = longCount != null ? longCount.intValue() : 0;
} catch (QueryException | RuntimeException ex) {
handleGeneralException(ex, session, result);
} finally {
Expand Down

0 comments on commit a4b627d

Please sign in to comment.