use of com.evolveum.midpoint.prism.PrismPropertyValue in project midpoint by Evolveum.
the class WebComponentUtil method encryptCredentials.
public static void encryptCredentials(ObjectDelta delta, boolean encrypt, MidPointApplication app) {
if (delta == null || delta.isEmpty()) {
return;
}
PropertyDelta propertyDelta = delta.findPropertyDelta(new ItemPath(SchemaConstantsGenerated.C_CREDENTIALS, CredentialsType.F_PASSWORD, PasswordType.F_VALUE));
if (propertyDelta == null) {
return;
}
Collection<PrismPropertyValue<ProtectedStringType>> values = propertyDelta.getValues(ProtectedStringType.class);
for (PrismPropertyValue<ProtectedStringType> value : values) {
ProtectedStringType string = value.getValue();
encryptProtectedString(string, encrypt, app);
}
}
use of com.evolveum.midpoint.prism.PrismPropertyValue in project midpoint by Evolveum.
the class FocusProjectionsTabPanel method unlockShadowPerformed.
private void unlockShadowPerformed(AjaxRequestTarget target, IModel<List<FocusSubwrapperDto<ShadowType>>> model, List<FocusSubwrapperDto<ShadowType>> selected) {
if (!isAnyProjectionSelected(target, model)) {
return;
}
for (FocusSubwrapperDto<ShadowType> account : selected) {
if (!account.isLoadedOK()) {
continue;
}
ObjectWrapper<ShadowType> wrapper = account.getObject();
wrapper.setSelected(false);
ContainerWrapper<ActivationType> activation = wrapper.findContainerWrapper(new ItemPath(ShadowType.F_ACTIVATION));
if (activation == null) {
warn(getString("pageAdminFocus.message.noActivationFound", wrapper.getDisplayName()));
continue;
}
PropertyWrapper lockedProperty = activation.findPropertyWrapper(ActivationType.F_LOCKOUT_STATUS);
if (lockedProperty == null || lockedProperty.getValues().size() != 1) {
warn(getString("pageAdminFocus.message.noLockoutStatusPropertyFound", wrapper.getDisplayName()));
continue;
}
ValueWrapper value = (ValueWrapper) lockedProperty.getValues().get(0);
((PrismPropertyValue) value.getValue()).setValue(LockoutStatusType.NORMAL);
// TODO only for really unlocked accounts
info(getString("pageAdminFocus.message.unlocked", wrapper.getDisplayName()));
}
target.add(getFeedbackPanel(), get(createComponentPath(ID_SHADOWS)));
}
use of com.evolveum.midpoint.prism.PrismPropertyValue in project midpoint by Evolveum.
the class SynchronizationUtils method getSituationFromSameChannel.
private static List<PrismPropertyValue<SynchronizationSituationDescriptionType>> getSituationFromSameChannel(PrismObject prismObject, String channel) {
ShadowType target = (ShadowType) prismObject.asObjectable();
List<SynchronizationSituationDescriptionType> syncSituationDescriptions = ((ShadowType) target).getSynchronizationSituationDescription();
List<PrismPropertyValue<SynchronizationSituationDescriptionType>> valuesToDelete = new ArrayList<PrismPropertyValue<SynchronizationSituationDescriptionType>>();
if (syncSituationDescriptions == null || syncSituationDescriptions.isEmpty()) {
return null;
}
for (SynchronizationSituationDescriptionType syncSituationDescription : syncSituationDescriptions) {
if (StringUtils.isEmpty(syncSituationDescription.getChannel()) && StringUtils.isEmpty(channel)) {
valuesToDelete.add(new PrismPropertyValue<SynchronizationSituationDescriptionType>(syncSituationDescription));
continue;
// return syncSituationDescription;
}
if ((StringUtils.isEmpty(syncSituationDescription.getChannel()) && channel != null) || (StringUtils.isEmpty(channel) && syncSituationDescription.getChannel() != null)) {
// return null;
continue;
}
if (syncSituationDescription.getChannel().equals(channel)) {
valuesToDelete.add(new PrismPropertyValue<SynchronizationSituationDescriptionType>(syncSituationDescription));
continue;
// return syncSituationDescription;
}
}
return valuesToDelete;
}
use of com.evolveum.midpoint.prism.PrismPropertyValue in project midpoint by Evolveum.
the class CryptoUtil method checkEncrypted.
// Checks that everything is encrypted
public static <T extends ObjectType> void checkEncrypted(final PrismObject<T> object) {
Visitor visitor = new Visitor() {
@Override
public void visit(Visitable visitable) {
if (!(visitable instanceof PrismPropertyValue)) {
return;
}
PrismPropertyValue<?> pval = (PrismPropertyValue<?>) visitable;
checkEncrypted(pval);
}
};
try {
object.accept(visitor);
} catch (IllegalStateException e) {
throw new IllegalStateException(e.getMessage() + " in " + object, e);
}
}
use of com.evolveum.midpoint.prism.PrismPropertyValue in project midpoint by Evolveum.
the class CryptoUtil method checkEncrypted.
// Checks that everything is encrypted
public static <T extends ObjectType> void checkEncrypted(final ObjectDelta<T> delta) {
Visitor visitor = new Visitor() {
@Override
public void visit(Visitable visitable) {
if (!(visitable instanceof PrismPropertyValue)) {
return;
}
PrismPropertyValue<?> pval = (PrismPropertyValue<?>) visitable;
checkEncrypted(pval);
}
};
try {
delta.accept(visitor);
} catch (IllegalStateException e) {
throw new IllegalStateException(e.getMessage() + " in delta " + delta, e);
}
}
Aggregations