use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class SearchPanel method debugPerformed.
private void debugPerformed() {
Search search = getModelObject();
PageRepositoryQuery pageQuery;
if (search != null) {
ObjectTypes type = search.getTypeClass() != null ? ObjectTypes.getObjectType(search.getTypeClass().getSimpleName()) : null;
QName typeName = type != null ? type.getTypeQName() : null;
String inner = search.getAdvancedQuery();
if (StringUtils.isNotBlank(inner)) {
inner = "\n" + inner + "\n";
} else if (inner == null) {
inner = "";
}
pageQuery = new PageRepositoryQuery(typeName, "<query>" + inner + "</query>");
} else {
pageQuery = new PageRepositoryQuery();
}
SearchPanel.this.setResponsePage(pageQuery);
}
use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class AssignmentPanel method newAssignmentClickPerformed.
protected void newAssignmentClickPerformed(AjaxRequestTarget target) {
AssignmentPopup popupPanel = new AssignmentPopup(getPageBase().getMainPopupBodyId(), createAssignmentPopupModel()) {
private static final long serialVersionUID = 1L;
@Override
protected void addPerformed(AjaxRequestTarget target, List<AssignmentType> newAssignmentsList) {
super.addPerformed(target, newAssignmentsList);
addSelectedAssignmentsPerformed(target, newAssignmentsList);
}
@Override
protected List<ObjectTypes> getObjectTypesList() {
return AssignmentPanel.this.getObjectTypesList();
}
@Override
protected ObjectFilter getSubtypeFilter() {
return AssignmentPanel.this.getSubtypeFilter();
}
@Override
protected boolean isEntitlementAssignment() {
return AssignmentPanel.this.isEntitlementAssignment();
}
@Override
protected PrismContainerWrapper<AssignmentType> getAssignmentWrapperModel() {
return AssignmentPanel.this.getModelObject();
}
@Override
protected <F extends AssignmentHolderType> PrismObject<F> getFocusObject() {
return getMultivalueContainerListPanel().getFocusObject();
}
};
popupPanel.setOutputMarkupId(true);
popupPanel.setOutputMarkupPlaceholderTag(true);
getPageBase().showMainPopup(popupPanel, target);
}
use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class AbstractSearchExpressionEvaluator method transformSingleValue.
@NotNull
@Override
protected List<V> transformSingleValue(VariablesMap variables, PlusMinusZero valueDestination, boolean useNew, ExpressionEvaluationContext context, String contextDescription, Task task, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException {
QName targetTypeQName = expressionEvaluatorBean.getTargetType();
if (targetTypeQName == null) {
targetTypeQName = getDefaultTargetType();
}
if (targetTypeQName != null && QNameUtil.isUnqualified(targetTypeQName)) {
targetTypeQName = prismContext.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;
ObjectQuery query = null;
List<ItemDelta<V, D>> additionalAttributeDeltas = null;
PopulateType populateAssignmentType = expressionEvaluatorBean.getPopulate();
if (populateAssignmentType != null) {
if (outputDefinition instanceof PrismContainerDefinition) {
additionalAttributeDeltas = PopulatorUtil.computePopulateItemDeltas(populateAssignmentType, (PrismContainerDefinition<?>) outputDefinition, variables, context, contextDescription, task, result);
} else {
LOGGER.warn("Search expression {} applied to non-container target, ignoring populate definition", contextDescription);
}
}
if (expressionEvaluatorBean.getOid() != null) {
resultValues = new ArrayList<>(1);
resultValues.add(createPrismValue(expressionEvaluatorBean.getOid(), targetTypeQName, additionalAttributeDeltas, context));
} else {
SearchFilterType filterType = expressionEvaluatorBean.getFilter();
if (filterType == null) {
throw new SchemaException("No filter in " + shortDebugDump());
}
query = prismContext.getQueryConverter().createObjectQuery(targetTypeClass, filterType);
LOGGER.trace("XML query converted to: {}", query.debugDumpLazily());
query = ExpressionUtil.evaluateQueryExpressions(query, variables, context.getExpressionProfile(), context.getExpressionFactory(), prismContext, context.getContextDescription(), task, result);
LOGGER.trace("Expression in query evaluated to: {}", query.debugDumpLazily());
query = extendQuery(query, context);
LOGGER.trace("Query after extension: {}", query.debugDumpLazily());
resultValues = executeSearchUsingCache(targetTypeClass, targetTypeQName, query, additionalAttributeDeltas, context, contextDescription, task, result);
if (resultValues.isEmpty()) {
ObjectReferenceType defaultTargetRef = expressionEvaluatorBean.getDefaultTargetRef();
if (defaultTargetRef != null) {
resultValues.add(createPrismValue(defaultTargetRef.getOid(), targetTypeQName, additionalAttributeDeltas, context));
}
}
}
if (resultValues.isEmpty() && expressionEvaluatorBean.isCreateOnDemand() == Boolean.TRUE && (valueDestination == PlusMinusZero.PLUS || valueDestination == PlusMinusZero.ZERO || useNew)) {
String createdObjectOid = createOnDemand(targetTypeClass, variables, context, context.getContextDescription(), task, result);
resultValues.add(createPrismValue(createdObjectOid, targetTypeQName, additionalAttributeDeltas, context));
}
LOGGER.trace("Search expression {} (valueDestination={}) got {} results for query {}", contextDescription, valueDestination, resultValues.size(), query);
return resultValues;
}
use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method determineSynchronization.
/**
* Returns appropriate object synchronization settings for the class.
* Assumes single sync setting for now.
*/
protected ObjectSynchronizationType determineSynchronization(ResourceType resource, Class<UserType> type, String name) {
SynchronizationType synchronization = resource.getSynchronization();
if (synchronization == null) {
return null;
}
List<ObjectSynchronizationType> objectSynchronizations = synchronization.getObjectSynchronization();
if (objectSynchronizations.isEmpty()) {
return null;
}
for (ObjectSynchronizationType objSyncType : objectSynchronizations) {
QName focusTypeQName = objSyncType.getFocusType();
if (focusTypeQName == null) {
if (type != UserType.class) {
continue;
}
} else {
ObjectTypes focusType = ObjectTypes.getObjectTypeFromTypeQName(focusTypeQName);
if (type != (Class<?>) focusType.getClassDefinition()) {
continue;
}
}
if (name == null) {
// we got it
return objSyncType;
} else {
if (name.equals(objSyncType.getName())) {
return objSyncType;
}
}
}
throw new IllegalArgumentException("Synchronization setting for " + type + " and name " + name + " not found in " + resource);
}
use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.
the class NinjaUtils method getTypes.
public static List<ObjectTypes> getTypes(Set<ObjectTypes> selected) {
List<ObjectTypes> types = new ArrayList<>();
if (selected != null && !selected.isEmpty()) {
types.addAll(selected);
} else {
for (ObjectTypes type : ObjectTypes.values()) {
Class<? extends ObjectType> clazz = type.getClassDefinition();
if (Modifier.isAbstract(clazz.getModifiers())) {
continue;
}
types.add(type);
}
}
Collections.sort(types);
return types;
}
Aggregations