Skip to content

Commit

Permalink
Simplify itemFactory method names
Browse files Browse the repository at this point in the history
Removed "prism" from them: e.g. createPrismPropertyValue
-> createPropertyValue.
  • Loading branch information
mederly committed Dec 7, 2018
1 parent 525cb4f commit 23b6f37
Show file tree
Hide file tree
Showing 107 changed files with 291 additions and 309 deletions.
Expand Up @@ -66,7 +66,6 @@
import com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageClass;
import com.evolveum.midpoint.web.component.breadcrumbs.BreadcrumbPageInstance;
import com.evolveum.midpoint.web.component.data.SelectableBeanObjectDataProvider;
import com.evolveum.midpoint.web.component.input.ExpressionValuePanel;
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem;
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction;
import com.evolveum.midpoint.web.component.prism.*;
Expand Down Expand Up @@ -3040,7 +3039,7 @@ public static ExpressionType getAssociationExpression(ContainerValueWrapper<Assi
ExpressionType expression = expressionValues.get(0).getValue().getRealValue();
if (expression == null && createIfNotExist){
expression = new ExpressionType();
PrismPropertyValue<ExpressionType> exp = prismContext.itemFactory().createPrismPropertyValue(expression);
PrismPropertyValue<ExpressionType> exp = prismContext.itemFactory().createPropertyValue(expression);
ValueWrapper<ExpressionType> val = new ValueWrapper<>(expressionWrapper, exp, prismContext);
expressionValues.remove(0);
expressionValues.add(0, val);
Expand Down
Expand Up @@ -1079,9 +1079,9 @@ private void removeValue(AjaxRequestTarget target) {
int count = countUsableValues(propertyWrapper);
if (count == 0 && !hasEmptyPlaceholder(propertyWrapper)) {
if (inputPanel instanceof ValueChoosePanel) {
values.add(new ValueWrapper(propertyWrapper, prismContext.itemFactory().createPrismReferenceValue(), ValueStatus.ADDED, prismContext));
values.add(new ValueWrapper(propertyWrapper, prismContext.itemFactory().createReferenceValue(), ValueStatus.ADDED, prismContext));
} else {
values.add(new ValueWrapper(propertyWrapper, prismContext.itemFactory().createPrismPropertyValue(), ValueStatus.ADDED, prismContext));
values.add(new ValueWrapper(propertyWrapper, prismContext.itemFactory().createPropertyValue(), ValueStatus.ADDED, prismContext));
}
}
ListView parent = findParent(ListView.class);
Expand Down
Expand Up @@ -78,11 +78,11 @@ public ValueWrapper<T> createAddedValue() {

ValueWrapper wrapper;
if (SchemaConstants.T_POLY_STRING_TYPE.equals(definition.getTypeName())) {
wrapper = new ValueWrapper(this, prismContext.itemFactory().createPrismPropertyValue(new PolyString("")),
prismContext.itemFactory().createPrismPropertyValue(new PolyString("")), ValueStatus.ADDED,
wrapper = new ValueWrapper(this, prismContext.itemFactory().createPropertyValue(new PolyString("")),
prismContext.itemFactory().createPropertyValue(new PolyString("")), ValueStatus.ADDED,
prismContext);
} else {
wrapper = new ValueWrapper(this, prismContext.itemFactory().createPrismPropertyValue(), ValueStatus.ADDED,
wrapper = new ValueWrapper(this, prismContext.itemFactory().createPropertyValue(), ValueStatus.ADDED,
prismContext);
}

Expand Down
Expand Up @@ -82,7 +82,7 @@ public List<QName> getTargetTypes() {

@Override
public ValueWrapper createAddedValue() {
PrismReferenceValue prv = prismContext.itemFactory().createPrismReferenceValue();
PrismReferenceValue prv = prismContext.itemFactory().createReferenceValue();
return new ValueWrapper(this, prv, ValueStatus.ADDED, prismContext);
}

Expand Down
Expand Up @@ -69,7 +69,7 @@ public ValueWrapper(PropertyOrReferenceWrapper propertyWrapper, PrismValue value
T val = ((PrismPropertyValue<T>) value).getValue();
if (val instanceof PolyString) {
PolyString poly = (PolyString) val;
this.value = prismContext.itemFactory().createPrismPropertyValue(new PolyString(poly.getOrig(), poly.getNorm()),
this.value = prismContext.itemFactory().createPropertyValue(new PolyString(poly.getOrig(), poly.getNorm()),
value.getOriginType(), value.getOriginObject());
} else if (val instanceof ProtectedStringType) {
this.value = value.clone();
Expand All @@ -87,11 +87,11 @@ public ValueWrapper(PropertyOrReferenceWrapper propertyWrapper, PrismValue value
}

if (oldValue == null && value instanceof PrismPropertyValue && ValueStatus.ADDED == propertyWrapper.getStatus()) {
oldValue = prismContext.itemFactory().createPrismPropertyValue();
oldValue = prismContext.itemFactory().createPropertyValue();
}

if (oldValue == null && value instanceof PrismReferenceValue && ValueStatus.ADDED == propertyWrapper.getStatus()) {
oldValue = prismContext.itemFactory().createPrismReferenceValue();
oldValue = prismContext.itemFactory().createReferenceValue();
}

if (oldValue == null && value instanceof PrismReferenceValue && ValueStatus.ADDED != propertyWrapper.getStatus()) {
Expand All @@ -104,7 +104,7 @@ public ValueWrapper(PropertyOrReferenceWrapper propertyWrapper, PrismValue value
PolyString poly = (PolyString)val;
val = (T) new PolyString(poly.getOrig(), poly.getNorm());
}
oldValue = prismContext.itemFactory().createPrismPropertyValue(CloneUtil.clone(val), this.value.getOriginType(), this.value.getOriginObject());
oldValue = prismContext.itemFactory().createPropertyValue(CloneUtil.clone(val), this.value.getOriginType(), this.value.getOriginObject());
}

this.oldValue = oldValue;
Expand Down
Expand Up @@ -670,7 +670,7 @@ private ReferenceDelta prepareUserAccountsDeltaForModify(PrismReferenceDefinitio
ObjectWrapper accountWrapper = accDto.getObject();
accountWrapper.revive(getPrismContext());
ObjectDelta delta = accountWrapper.getObjectDelta();
PrismReferenceValue refValue = getPrismContext().itemFactory().createPrismReferenceValue(null, OriginType.USER_ACTION, null);
PrismReferenceValue refValue = getPrismContext().itemFactory().createReferenceValue(null, OriginType.USER_ACTION, null);

PrismObject<ShadowType> account;
switch (accDto.getStatus()) {
Expand Down Expand Up @@ -723,7 +723,7 @@ private ReferenceDelta prepareUserOrgsDeltaForModify(PrismReferenceDefinition re
ObjectWrapper<OrgType> orgWrapper = orgDto.getObject();
orgWrapper.revive(getPrismContext());
ObjectDelta<OrgType> delta = orgWrapper.getObjectDelta();
PrismReferenceValue refValue = getPrismContext().itemFactory().createPrismReferenceValue(null, OriginType.USER_ACTION, null);
PrismReferenceValue refValue = getPrismContext().itemFactory().createReferenceValue(null, OriginType.USER_ACTION, null);

switch (orgDto.getStatus()) {
case ADD:
Expand Down
Expand Up @@ -72,7 +72,7 @@ public GenericHandlerDto(TaskDto taskDto, @NotNull List<Item> items, PageBase pa
ContainerWrapperFactory cwf = new ContainerWrapperFactory(pageBase);

final PrismContext prismContext = pageBase.getPrismContext();
PrismContainer container = prismContext.itemFactory().createPrismContainer(new QName("test"));
PrismContainer container = prismContext.itemFactory().createContainer(new QName("test"));
ComplexTypeDefinition ctd = prismContext.definitionFactory().createComplexTypeDefinition(new QName("Test"));
int displayOrder = 1;
for (Item item : items) {
Expand Down
Expand Up @@ -304,7 +304,7 @@ private List<AssignmentEditorDto> loadDelegatedByMeAssignments() {

Task task = createSimpleTask(OPERATION_LOAD_DELEGATED_BY_ME_ASSIGNMENTS);

PrismReferenceValue referenceValue = getPrismContext().itemFactory().createPrismReferenceValue(getObjectWrapper().getOid(),
PrismReferenceValue referenceValue = getPrismContext().itemFactory().createReferenceValue(getObjectWrapper().getOid(),
UserType.COMPLEX_TYPE);
referenceValue.setRelation(WebComponentUtil.getDefaultRelationOrFail(RelationKindType.DELEGATION));

Expand Down
Expand Up @@ -347,7 +347,7 @@ protected void onSavePerformed(AjaxRequestTarget target) {
PropertyDelta<ProtectedStringType> delta = getPrismContext().deltaFactory().property()
.createModificationReplaceProperty(valuePath, objDef, password);
if (oldPassword != null) {
delta.addEstimatedOldValue(getPrismContext().itemFactory().createPrismPropertyValue(oldPassword));
delta.addEstimatedOldValue(getPrismContext().itemFactory().createPropertyValue(oldPassword));
}

Class<? extends ObjectType> type = accDto.isMidpoint() ? UserType.class : ShadowType.class;
Expand Down
Expand Up @@ -814,7 +814,7 @@ private void modifyPropertyWrapper(ContainerValueWrapper<OrgType> mainContainerV
PrismPropertyValue<String> pval = (PrismPropertyValue<String>) values.get(0).getValue();
pval.setValue(newValue);
} else if (values.isEmpty()) {
PrismPropertyValue<String> pval = prismContext.itemFactory().createPrismPropertyValue(newValue);
PrismPropertyValue<String> pval = prismContext.itemFactory().createPropertyValue(newValue);
ValueWrapper newValueWrapper = new ValueWrapper<>(propertyWrapper, pval, prismContext);
values.add(newValueWrapper);
newValueWrapper.setStatus(ValueStatus.ADDED);
Expand Down
Expand Up @@ -29,45 +29,45 @@
*/
public interface ItemFactory {

PrismValue createPrismValue(Object realValue);
PrismValue createValue(Object realValue);

<T> PrismProperty<T> createPrismProperty(QName itemName);
<T> PrismProperty<T> createProperty(QName itemName);

<T> PrismProperty<T> createPrismProperty(QName itemName, PrismPropertyDefinition<T> definition);
<T> PrismProperty<T> createProperty(QName itemName, PrismPropertyDefinition<T> definition);

<T> PrismPropertyValue<T> createPrismPropertyValue();
<T> PrismPropertyValue<T> createPropertyValue();

<T> PrismPropertyValue<T> createPrismPropertyValue(T content);
<T> PrismPropertyValue<T> createPropertyValue(T content);

<T> PrismPropertyValue<T> createPrismPropertyValue(XNode rawContent);
<T> PrismPropertyValue<T> createPropertyValue(XNode rawContent);

<T> PrismPropertyValue<T> createPrismPropertyValue(T value, OriginType originType, Objectable originObject);
<T> PrismPropertyValue<T> createPropertyValue(T value, OriginType originType, Objectable originObject);

PrismReference createPrismReference(QName name);
PrismReference createReference(QName name);

PrismReference createPrismReference(QName name, PrismReferenceDefinition definition);
PrismReference createReference(QName name, PrismReferenceDefinition definition);

PrismReferenceValue createPrismReferenceValue();
PrismReferenceValue createReferenceValue();

PrismReferenceValue createPrismReferenceValue(PrismObject<?> target);
PrismReferenceValue createReferenceValue(PrismObject<?> target);

PrismReferenceValue createPrismReferenceValue(String targetOid);
PrismReferenceValue createReferenceValue(String targetOid);

PrismReferenceValue createPrismReferenceValue(String oid, OriginType originType, Objectable originObject);
PrismReferenceValue createReferenceValue(String oid, OriginType originType, Objectable originObject);

PrismReferenceValue createPrismReferenceValue(String oid, QName targetType);
PrismReferenceValue createReferenceValue(String oid, QName targetType);

PrismContainer createPrismContainer(QName name);
PrismContainer createContainer(QName name);

<C extends Containerable> PrismContainer<C> createPrismContainer(QName name, PrismContainerDefinition<C> definition);
<C extends Containerable> PrismContainer<C> createContainer(QName name, PrismContainerDefinition<C> definition);

<O extends Objectable> PrismObject<O> createPrismObject(QName name, PrismObjectDefinition<O> definition);
<O extends Objectable> PrismObject<O> createObject(QName name, PrismObjectDefinition<O> definition);

// TODO is this needed?
<O extends Objectable> PrismObjectValue<O> createPrismObjectValue(O objectable);
<O extends Objectable> PrismObjectValue<O> createObjectValue(O objectable);

// TODO is this needed?
<C extends Containerable> PrismContainerValue<C> createPrismContainerValue(C containerable);
<C extends Containerable> PrismContainerValue<C> createContainerValue(C containerable);

<C extends Containerable> PrismContainerValue<C> createPrismContainerValue();
<C extends Containerable> PrismContainerValue<C> createContainerValue();
}
Expand Up @@ -62,30 +62,30 @@ public static <T> Collection<PrismPropertyValue<T>> createCollection(PrismContex
Collection<T> realValueCollection) {
Collection<PrismPropertyValue<T>> pvalCol = new ArrayList<>(realValueCollection.size());
for (T realValue: realValueCollection) {
pvalCol.add(prismContext.itemFactory().createPrismPropertyValue(realValue));
pvalCol.add(prismContext.itemFactory().createPropertyValue(realValue));
}
return pvalCol;
}

public static <T> Collection<PrismPropertyValue<T>> createCollection(PrismContext prismContext, T[] realValueArray) {
Collection<PrismPropertyValue<T>> pvalCol = new ArrayList<>(realValueArray.length);
for (T realValue: realValueArray) {
pvalCol.add(prismContext.itemFactory().createPrismPropertyValue(realValue));
pvalCol.add(prismContext.itemFactory().createPropertyValue(realValue));
}
return pvalCol;
}

public static <T> Collection<PrismPropertyValue<T>> wrap(PrismContext prismContext, @NotNull Collection<T> realValues) {
return realValues.stream()
.map(val -> prismContext.itemFactory().createPrismPropertyValue(val))
.map(val -> prismContext.itemFactory().createPropertyValue(val))
.collect(Collectors.toList());
}

@SafeVarargs
public static <T> PrismPropertyValue<T>[] wrap(PrismContext prismContext, T... realValues) {
//noinspection unchecked
return Arrays.stream(realValues)
.map(val -> prismContext.itemFactory().createPrismPropertyValue(val))
.map(val -> prismContext.itemFactory().createPropertyValue(val))
.toArray(PrismPropertyValue[]::new);
}

Expand Down Expand Up @@ -230,7 +230,7 @@ public static <X> Collection<PrismPropertyValue<X>> toPrismPropertyValues(PrismC
Collection<PrismPropertyValue<X>> pvalues = new ArrayList<>(realValues.length);
for (X val: realValues) {
PrismUtil.recomputeRealValue(val, prismContext);
PrismPropertyValue<X> pval = prismContext.itemFactory().createPrismPropertyValue(val);
PrismPropertyValue<X> pval = prismContext.itemFactory().createPropertyValue(val);
pvalues.add(pval);
}
return pvalues;
Expand Down
Expand Up @@ -41,7 +41,7 @@ public static PrismContainerValue<?> getParentContainerValue(PrismValue value) {
public static <T> PrismProperty<T> createRaw(@NotNull XNode node, @NotNull QName itemName, PrismContext prismContext)
throws SchemaException {
Validate.isTrue(!(node instanceof RootXNode));
PrismProperty<T> property = prismContext.itemFactory().createPrismProperty(itemName);
PrismProperty<T> property = prismContext.itemFactory().createProperty(itemName);
if (node instanceof ListXNode) {
for (XNode subnode : ((ListXNode) node).asList()) {
property.add(createRaw(subnode, prismContext));
Expand All @@ -53,7 +53,7 @@ public static <T> PrismProperty<T> createRaw(@NotNull XNode node, @NotNull QName
}

private static <T> PrismPropertyValue<T> createRaw(XNode rawElement, PrismContext prismContext) {
return prismContext.itemFactory().createPrismPropertyValue(rawElement);
return prismContext.itemFactory().createPropertyValue(rawElement);
}

}
Expand Up @@ -281,7 +281,7 @@ public static <O extends Objectable> ObjectDelta<O> createModificationAddReferen
ReferenceDelta referenceDelta = objectDelta.createReferenceModification(ItemName.fromQName(propertyName), refDef);
Collection<PrismReferenceValue> valuesToReplace = new ArrayList<>(referenceObjects.length);
for (PrismObject<?> refObject: referenceObjects) {
valuesToReplace.add(prismContext.itemFactory().createPrismReferenceValue(refObject));
valuesToReplace.add(prismContext.itemFactory().createReferenceValue(refObject));
}
referenceDelta.setValuesToReplace(valuesToReplace);
return objectDelta;
Expand All @@ -292,7 +292,7 @@ public static <O extends Objectable> ObjectDelta<O> createModificationAddReferen
PrismContext prismContext, String... targetOids) {
PrismReferenceValue[] referenceValues = new PrismReferenceValue[targetOids.length];
for(int i=0; i < targetOids.length; i++) {
referenceValues[i] = prismContext.itemFactory().createPrismReferenceValue(targetOids[i]);
referenceValues[i] = prismContext.itemFactory().createReferenceValue(targetOids[i]);
}
return createModificationAddReference(type, oid, propertyName, prismContext, referenceValues);
}
Expand Down Expand Up @@ -322,7 +322,7 @@ public static <O extends Objectable> ObjectDelta<O> createModificationDeleteRefe
PrismContext prismContext, String... targetOids) {
PrismReferenceValue[] referenceValues = new PrismReferenceValue[targetOids.length];
for (int i=0; i < targetOids.length; i++) {
referenceValues[i] = prismContext.itemFactory().createPrismReferenceValue(targetOids[i]);
referenceValues[i] = prismContext.itemFactory().createReferenceValue(targetOids[i]);
}
return createModificationDeleteReference(type, oid, propertyName, prismContext, referenceValues);
}
Expand Down
Expand Up @@ -40,7 +40,7 @@ public class AbstractDelegatedPrismContainer<C extends Containerable> implements
protected PrismContainer<C> inner;

public AbstractDelegatedPrismContainer(QName name, PrismContainerDefinition<C> definition, PrismContext prismContext) {
inner = prismContext.itemFactory().createPrismContainer(name, definition);
inner = prismContext.itemFactory().createContainer(name, definition);
}

public AbstractDelegatedPrismContainer(PrismContainer<C> inner) {
Expand Down
Expand Up @@ -39,7 +39,7 @@ public class AbstractDelegatedPrismProperty<T> implements PrismProperty<T> {
protected PrismProperty<T> inner;

public AbstractDelegatedPrismProperty(QName name, PrismPropertyDefinition<T> definition, PrismContext prismContext) {
inner = prismContext.itemFactory().createPrismProperty(name, definition);
inner = prismContext.itemFactory().createProperty(name, definition);
}

public AbstractDelegatedPrismProperty(PrismProperty<T> inner) {
Expand Down
Expand Up @@ -338,7 +338,7 @@ private <X> Collection<PrismPropertyValue<X>> resolveStructuredDeltaSet(Collecti
for (PrismPropertyValue<Structured> structuredPVal: set) {
Structured structured = structuredPVal.getValue();
X outputRval = (X) structured.resolve(resolvePath);
outputSet.add(prismContext.itemFactory().createPrismPropertyValue(outputRval));
outputSet.add(prismContext.itemFactory().createPropertyValue(outputRval));
}
return outputSet;
}
Expand Down
Expand Up @@ -132,7 +132,7 @@ public static <T,X> PrismPropertyValue<X> convertPropertyValue(PrismPropertyValu
} else {
Class<X> expectedJavaType = XsdTypeMapper.toJavaType(targetDef.getTypeName());
X convertedRealValue = JavaTypeConverter.convert(expectedJavaType, srcVal.getValue());
return prismContext.itemFactory().createPrismPropertyValue(convertedRealValue);
return prismContext.itemFactory().createPropertyValue(convertedRealValue);
}
}

Expand All @@ -145,7 +145,7 @@ public static <T,X> PrismProperty<X> convertProperty(PrismProperty<T> srcProp, P
Class<X> expectedJavaType = XsdTypeMapper.toJavaType(targetDef.getTypeName());
for (PrismPropertyValue<T> srcPVal: srcProp.getValues()) {
X convertedRealValue = JavaTypeConverter.convert(expectedJavaType, srcPVal.getValue());
targetProp.add(prismContext.itemFactory().createPrismPropertyValue(convertedRealValue));
targetProp.add(prismContext.itemFactory().createPropertyValue(convertedRealValue));
}
return targetProp;
}
Expand Down
Expand Up @@ -91,7 +91,7 @@ public RawType(PrismValue parsed, QName explicitTypeName, @NotNull PrismContext
}

public static RawType fromPropertyRealValue(Object realValue, QName explicitTypeName, @NotNull PrismContext prismContext) {
return new RawType(prismContext.itemFactory().createPrismPropertyValue(realValue), explicitTypeName, prismContext);
return new RawType(prismContext.itemFactory().createPropertyValue(realValue), explicitTypeName, prismContext);
}

/**
Expand Down Expand Up @@ -178,7 +178,7 @@ public <IV extends PrismValue,ID extends ItemDefinition> IV getParsedValue(@Null
} else {
// we don't really want to set 'parsed', as we didn't performed real parsing
//noinspection unchecked
return (IV) prismContext.itemFactory().createPrismPropertyValue(xnode);
return (IV) prismContext.itemFactory().createPropertyValue(xnode);
}
} else {
return null;
Expand Down

0 comments on commit 23b6f37

Please sign in to comment.