Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Suta committed Feb 18, 2015
2 parents c406771 + 7ee4a1b commit 214420c
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 15 deletions.
@@ -0,0 +1,24 @@
/**
* Copyright (c) 2015 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.evolveum.midpoint.repo.api;

/**
* @author semancik
*
*/
public enum LookupTableSearchType {
EXACT, STARTS_WITH, SUBSTRING;
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2014 Evolveum
* Copyright (c) 2010-2015 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,9 +19,11 @@
import java.util.List;

import javax.xml.datatype.Duration;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.delta.ItemDelta;
import com.evolveum.midpoint.prism.query.ObjectPaging;
import com.evolveum.midpoint.prism.query.ObjectQuery;
import com.evolveum.midpoint.schema.GetOperationOptions;
import com.evolveum.midpoint.schema.RepositoryDiag;
Expand All @@ -36,6 +38,8 @@
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.xml.ns._public.common.common_3.CleanupPolicyType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;
Expand All @@ -48,7 +52,7 @@
* <li>Status: public</li>
* <li>Stability: stable</li>
* </ul>
* @version 3.0
* @version 3.1.1
* @author Radovan Semancik
* </p><p>
* This service provides repository for objects that are commonly found
Expand Down Expand Up @@ -163,7 +167,7 @@ public interface RepositoryService {
* @throws IllegalArgumentException
* wrong OID format, etc.
*/
public <T extends ObjectType> PrismObject<T> getObject(Class<T> type,String oid, Collection<SelectorOptions<GetOperationOptions>> options,
<T extends ObjectType> PrismObject<T> getObject(Class<T> type,String oid, Collection<SelectorOptions<GetOperationOptions>> options,
OperationResult parentResult)
throws ObjectNotFoundException, SchemaException;

Expand All @@ -188,7 +192,7 @@ public <T extends ObjectType> PrismObject<T> getObject(Class<T> type,String oid,
* @throws IllegalArgumentException
* wrong OID format, etc.
*/
public <T extends ObjectType> String getVersion(Class<T> type,String oid, OperationResult parentResult)
<T extends ObjectType> String getVersion(Class<T> type,String oid, OperationResult parentResult)
throws ObjectNotFoundException, SchemaException;

/**
Expand Down Expand Up @@ -228,7 +232,7 @@ public <T extends ObjectType> String getVersion(Class<T> type,String oid, Operat
* @throws IllegalArgumentException
* wrong OID format, etc.
*/
public <T extends ObjectType> String addObject(PrismObject<T> object, RepoAddOptions options, OperationResult parentResult)
<T extends ObjectType> String addObject(PrismObject<T> object, RepoAddOptions options, OperationResult parentResult)
throws ObjectAlreadyExistsException, SchemaException;


Expand Down Expand Up @@ -262,7 +266,7 @@ public <T extends ObjectType> String addObject(PrismObject<T> object, RepoAddOpt
* unknown property used in search query
*/

public <T extends ObjectType> SearchResultList<PrismObject<T>> searchObjects(Class<T> type, ObjectQuery query,
<T extends ObjectType> SearchResultList<PrismObject<T>> searchObjects(Class<T> type, ObjectQuery query,
Collection<SelectorOptions<GetOperationOptions>> options, OperationResult parentResult)
throws SchemaException;

Expand Down Expand Up @@ -297,7 +301,7 @@ public <T extends ObjectType> SearchResultList<PrismObject<T>> searchObjects(Cl
* unknown property used in search query
*/

public <T extends ObjectType> SearchResultMetadata searchObjectsIterative(Class<T> type, ObjectQuery query,
<T extends ObjectType> SearchResultMetadata searchObjectsIterative(Class<T> type, ObjectQuery query,
ResultHandler<T> handler, Collection<SelectorOptions<GetOperationOptions>> options, OperationResult parentResult)
throws SchemaException;

Expand All @@ -323,7 +327,7 @@ public <T extends ObjectType> SearchResultMetadata searchObjectsIterative(Class<
* @throws SchemaException
* unknown property used in search query
*/
public <T extends ObjectType> int countObjects(Class<T> type, ObjectQuery query, OperationResult parentResult)
<T extends ObjectType> int countObjects(Class<T> type, ObjectQuery query, OperationResult parentResult)
throws SchemaException;

boolean isAnySubordinate(String upperOrgOid, Collection<String> lowerObjectOids) throws SchemaException;
Expand Down Expand Up @@ -358,7 +362,7 @@ public <T extends ObjectType> int countObjects(Class<T> type, ObjectQuery query,
* @throws IllegalArgumentException
* wrong OID format, described change is not applicable
*/
public <T extends ObjectType> void modifyObject(Class<T> type, String oid, Collection<? extends ItemDelta> modifications, OperationResult parentResult)
<T extends ObjectType> void modifyObject(Class<T> type, String oid, Collection<? extends ItemDelta> modifications, OperationResult parentResult)
throws ObjectNotFoundException, SchemaException, ObjectAlreadyExistsException;

/**
Expand All @@ -377,7 +381,7 @@ public <T extends ObjectType> void modifyObject(Class<T> type, String oid, Colle
* @throws IllegalArgumentException
* wrong OID format, described change is not applicable
*/
public <T extends ObjectType> void deleteObject(Class<T> type, String oid, OperationResult parentResult) throws ObjectNotFoundException;
<T extends ObjectType> void deleteObject(Class<T> type, String oid, OperationResult parentResult) throws ObjectNotFoundException;

/**
* <p>Returns the User object representing owner of specified account (account
Expand Down Expand Up @@ -409,7 +413,7 @@ public <T extends ObjectType> void modifyObject(Class<T> type, String oid, Colle
* wrong OID format
*/
@Deprecated
public PrismObject<UserType> listAccountShadowOwner(String accountOid, OperationResult parentResult)
PrismObject<UserType> listAccountShadowOwner(String accountOid, OperationResult parentResult)
throws ObjectNotFoundException;

/**
Expand Down Expand Up @@ -440,7 +444,7 @@ public PrismObject<UserType> listAccountShadowOwner(String accountOid, Operation
* @throws IllegalArgumentException
* wrong OID format
*/
public <F extends FocusType> PrismObject<F> searchShadowOwner(String shadowOid, Collection<SelectorOptions<GetOperationOptions>> options, OperationResult parentResult)
<F extends FocusType> PrismObject<F> searchShadowOwner(String shadowOid, Collection<SelectorOptions<GetOperationOptions>> options, OperationResult parentResult)
throws ObjectNotFoundException;

/**
Expand Down Expand Up @@ -471,14 +475,37 @@ public <F extends FocusType> PrismObject<F> searchShadowOwner(String shadowOid,
* @throws IllegalArgumentException
* wrong OID format
*/
public <T extends ShadowType> List<PrismObject<T>> listResourceObjectShadows(String resourceOid,
<T extends ShadowType> List<PrismObject<T>> listResourceObjectShadows(String resourceOid,
Class<T> resourceObjectShadowType, OperationResult parentResult) throws ObjectNotFoundException,
SchemaException;

/**
* <p>Select specified rows from the lookup table.</p>
* <p>
* This operation works only on lookup tables. If OID of any other object
* is specified as a parameter it results in an error.
* </p>
*
* @param lookupTableOid OID of the lookup table
* @param column name of the column to search
* @param searchValue value to search for
* @param searchType type of search (exact, substring, ...)
* @param paging paging parameters (page offset and size)
* @return selected table rows
*
* @throws ObjectNotFoundException
* specified object does not exist
* @throws SchemaException
* object is not of type {@link LookupTableType}
*/
List<LookupTableRowType> searchLookupTable(String lookupTableOid, QName column, String searchValue,
LookupTableSearchType searchType, ObjectPaging paging) throws ObjectNotFoundException,
SchemaException;

/**
* Provide repository run-time configuration and diagnostic information.
*/
public RepositoryDiag getRepositoryDiag();
RepositoryDiag getRepositoryDiag();

/**
* Runs a short, non-descructive repository self test.
Expand All @@ -492,7 +519,7 @@ public <T extends ShadowType> List<PrismObject<T>> listResourceObjectShadows(Str
* If the repository has no self-tests then the method should return immediately
* without changing the result structure. It must not throw an exception in this case.
*/
public void repositorySelfTest(OperationResult parentResult);
void repositorySelfTest(OperationResult parentResult);

/**
* Checks a closure for consistency, repairing any problems found.
Expand Down
Expand Up @@ -18,7 +18,9 @@
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.delta.ItemDelta;
import com.evolveum.midpoint.prism.query.ObjectPaging;
import com.evolveum.midpoint.prism.query.ObjectQuery;
import com.evolveum.midpoint.repo.api.LookupTableSearchType;
import com.evolveum.midpoint.repo.api.RepoAddOptions;
import com.evolveum.midpoint.repo.api.RepositoryService;
import com.evolveum.midpoint.schema.GetOperationOptions;
Expand All @@ -34,15 +36,19 @@
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;

import org.apache.commons.lang.Validate;

import java.util.Collection;
import java.util.List;

import javax.xml.namespace.QName;

/**
* Read-through write-through per-session repository cache.
*
Expand Down Expand Up @@ -347,4 +353,11 @@ private void log(String message, Object... params) {
PERFORMANCE_ADVISOR.trace(message, params);
}
}

@Override
public List<LookupTableRowType> searchLookupTable(String lookupTableOid, QName column,
String searchValue, LookupTableSearchType searchType, ObjectPaging paging)
throws ObjectNotFoundException, SchemaException {
return repository.searchLookupTable(lookupTableOid, column, searchValue, searchType, paging);
}
}
Expand Up @@ -26,6 +26,7 @@
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.prism.polystring.PolyString;
import com.evolveum.midpoint.prism.query.*;
import com.evolveum.midpoint.repo.api.LookupTableSearchType;
import com.evolveum.midpoint.repo.api.RepoAddOptions;
import com.evolveum.midpoint.repo.api.RepositoryService;
import com.evolveum.midpoint.repo.sql.data.common.*;
Expand Down Expand Up @@ -1653,4 +1654,12 @@ private boolean isAnySubordinateAttempt(String upperOrgOid, Collection<String> l

throw new SystemException("isAnySubordinateAttempt failed somehow, this really should not happen.");
}

@Override
public List<LookupTableRowType> searchLookupTable(String lookupTableOid, QName column,
String searchValue, LookupTableSearchType searchType, ObjectPaging paging)
throws ObjectNotFoundException, SchemaException {
// TODO implement
throw new UnsupportedOperationException();
}
}

0 comments on commit 214420c

Please sign in to comment.