use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class OrgMemberPanel method initSearch.
@Override
protected void initSearch(Form form) {
/// TODO: move to utils class??
List<ObjectTypes> objectTypes = Arrays.asList(ObjectTypes.values());
Collections.sort(objectTypes, new Comparator<ObjectTypes>() {
@Override
public int compare(ObjectTypes o1, ObjectTypes o2) {
Validate.notNull(o1);
Validate.notNull(o2);
String type1 = o1.getValue();
String type2 = o2.getValue();
return String.CASE_INSENSITIVE_ORDER.compare(type1, type2);
}
});
DropDownChoice<ObjectTypes> objectType = new DropDownChoice<ObjectTypes>(ID_SEARCH_BY_TYPE, Model.of(OBJECT_TYPES_DEFAULT), objectTypes, new EnumChoiceRenderer<ObjectTypes>());
objectType.add(new OnChangeAjaxBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
refreshTable(target);
}
});
objectType.setOutputMarkupId(true);
form.add(objectType);
DropDownChoice<String> seachScrope = new DropDownChoice<String>(ID_SEARCH_SCOPE, Model.of(SEARCH_SCOPE_SUBTREE), SEARCH_SCOPE_VALUES, new StringResourceChoiceRenderer("TreeTablePanel.search.scope"));
seachScrope.add(new OnChangeAjaxBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
refreshTable(target);
}
});
seachScrope.setOutputMarkupId(true);
form.add(seachScrope);
}
use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class ActionsExecutedObjectsTableLineDto method getObjectTypeLocalizationKey.
public String getObjectTypeLocalizationKey() {
ObjectTypes type = ObjectTypes.getObjectTypeFromTypeQName(entry.getObjectType());
ObjectTypeGuiDescriptor descriptor = ObjectTypeGuiDescriptor.getDescriptor(type);
if (descriptor != null) {
return descriptor.getLocalizationKey();
} else {
return null;
}
}
use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class PageDebugList method listObjectsPerformed.
private void listObjectsPerformed(ObjectQuery query, AjaxRequestTarget target) {
DebugSearchDto dto = searchModel.getObject();
ObjectTypes selected = dto.getType();
RepositoryObjectDataProvider provider = getTableDataProvider();
provider.setQuery(createQuery(query));
if (selected != null) {
provider.setType(selected.getClassDefinition());
addOrReplaceTable(provider);
}
// save object type category to session storage, used by back button
ConfigurationStorage storage = getSessionStorage().getConfiguration();
storage.setDebugSearchDto(dto);
Table table = getListTable();
target.add((Component) table);
}
use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class PageDebugList method setupSearchDto.
private void setupSearchDto(DebugSearchDto dto) {
ObjectTypes type = dto.getType();
Search search = SearchFactory.createSearch(type.getClassDefinition(), this);
dto.setSearch(search);
}
use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class AbstractSearchExpressionEvaluator method transformSingleValue.
@Override
protected List<V> transformSingleValue(ExpressionVariables variables, PlusMinusZero valueDestination, boolean useNew, ExpressionEvaluationContext context, String contextDescription, Task task, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException {
// if (LOGGER.isTraceEnabled()) {
// LOGGER.trace("transformSingleValue in {}\nvariables:\n{}\nvalueDestination: {}\nuseNew: {}",
// new Object[]{contextDescription, variables.debugDump(1), valueDestination, useNew});
// }
QName targetTypeQName = getExpressionEvaluatorType().getTargetType();
if (targetTypeQName == null) {
targetTypeQName = getDefaultTargetType();
}
if (targetTypeQName != null && QNameUtil.isUnqualified(targetTypeQName)) {
targetTypeQName = getPrismContext().getSchemaRegistry().resolveUnqualifiedTypeName(targetTypeQName);
}
ObjectTypes targetType = ObjectTypes.getObjectTypeFromTypeQName(targetTypeQName);
if (targetType == null) {
throw new SchemaException("Unknown target type " + targetTypeQName + " in " + shortDebugDump());
}
Class<? extends ObjectType> targetTypeClass = targetType.getClassDefinition();
List<V> resultValues = null;
ObjectQuery query = null;
List<ItemDelta<V, D>> additionalAttributeDeltas = null;
PopulateType populateAssignmentType = getExpressionEvaluatorType().getPopulate();
if (populateAssignmentType != null) {
additionalAttributeDeltas = collectAdditionalAttributes(populateAssignmentType, outputDefinition, variables, context, contextDescription, task, result);
}
if (getExpressionEvaluatorType().getOid() != null) {
resultValues = new ArrayList<>(1);
resultValues.add(createPrismValue(getExpressionEvaluatorType().getOid(), targetTypeQName, additionalAttributeDeltas, context));
} else {
SearchFilterType filterType = getExpressionEvaluatorType().getFilter();
if (filterType == null) {
throw new SchemaException("No filter in " + shortDebugDump());
}
query = QueryJaxbConvertor.createObjectQuery(targetTypeClass, filterType, prismContext);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("XML query converted to: {}", query.debugDump());
}
query = ExpressionUtil.evaluateQueryExpressions(query, variables, context.getExpressionFactory(), prismContext, context.getContextDescription(), task, result);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Expression in query evaluated to: {}", query.debugDump());
}
query = extendQuery(query, context);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Query after extension: {}", query.debugDump());
}
resultValues = executeSearchUsingCache(targetTypeClass, targetTypeQName, query, additionalAttributeDeltas, context, contextDescription, task, context.getResult());
if (resultValues.isEmpty()) {
ObjectReferenceType defaultTargetRef = getExpressionEvaluatorType().getDefaultTargetRef();
if (defaultTargetRef != null) {
resultValues.add(createPrismValue(defaultTargetRef.getOid(), targetTypeQName, additionalAttributeDeltas, context));
}
}
}
if (resultValues.isEmpty() && getExpressionEvaluatorType().isCreateOnDemand() == Boolean.TRUE && (valueDestination == PlusMinusZero.PLUS || valueDestination == PlusMinusZero.ZERO || useNew)) {
String createdObjectOid = createOnDemand(targetTypeClass, variables, context, context.getContextDescription(), task, context.getResult());
resultValues.add(createPrismValue(createdObjectOid, targetTypeQName, additionalAttributeDeltas, context));
}
LOGGER.trace("Search expression got {} results for query {}", resultValues == null ? "null" : resultValues.size(), query);
return (List<V>) resultValues;
}
Aggregations