Skip to content

Commit

Permalink
typo fixes, ob(ej)ct, init(i)alize, other minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed Nov 2, 2021
1 parent 678849c commit eb6c314
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static <IW extends ItemWrapper> IW findItemWrapper(ItemWrapper<?, ?> chil
try {
return taskWrapper.findItem(ItemPath.create(absoluthPathToFind), wrapperClass);
} catch (SchemaException e) {
LoggingUtils.logUnexpectedException(LOGGER, "Cannot get obejct reference value, {}", e, e.getMessage());
LoggingUtils.logUnexpectedException(LOGGER, "Cannot get object reference value, {}", e, e.getMessage());
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ protected void onTemplateChosePerformed(CompiledObjectCollectionView collectionV
try {
assignmentHolder = getPrismContext().createObject(PageAssignmentHolderDetails.this.getType());
} catch (Throwable e) {
LOGGER.error("Cannot create prism obejct for {}. Using object from page model.", PageAssignmentHolderDetails.this.getType());
LOGGER.error("Cannot create prism object for {}. Using object from page model.", PageAssignmentHolderDetails.this.getType());
assignmentHolder = getObjectDetailsModels().getObjectWrapperModel().getObject().getObjectOld().clone();
}
List<ObjectReferenceType> archetypeRef = ObjectCollectionViewUtil.getArchetypeReferencesList(collectionViews);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ private List<QName> createObjectClassChoices(IModel<PrismObjectWrapper<ResourceT
refinedSchema = RefinedResourceSchemaImpl.getRefinedSchema(model.getObject().getObject(),
getPageBase().getPrismContext());
} catch (SchemaException e) {
warn("Could not determine defined obejct classes for resource");
warn("Could not determine defined object classes for resource");
return new ArrayList<>();
}
Collection<ObjectClassComplexTypeDefinition> defs = refinedSchema.getObjectClassDefinitions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,22 +202,22 @@ private ReadOnlyModel<List<ResourceConfigurationDto>> createResourceConfigListMo

try {
for (ResourceObjectTypeDefinitionType objectType : objectTypes) {
ObjectSynchronizationType obejctSynchronization = null;
ObjectSynchronizationType objectSynchronization = null;
if (resource.getSynchronization() != null
&& resource.getSynchronization().getObjectSynchronization() != null) {

obejctSynchronization = getSynchronizationFor(objectType,
objectSynchronization = getSynchronizationFor(objectType,
resource.getSynchronization().getObjectSynchronization(),
resource.asPrismObject());

}
List<TaskType> syncTask = new ArrayList<>();
if (obejctSynchronization != null) {
syncTask = getTaskFor(tasks, obejctSynchronization, resource.asPrismObject());
if (objectSynchronization != null) {
syncTask = getTaskFor(tasks, objectSynchronization, resource.asPrismObject());
}

ResourceConfigurationDto resourceConfig = new ResourceConfigurationDto(objectType,
obejctSynchronization != null, syncTask);
objectSynchronization != null, syncTask);
configs.add(resourceConfig);
}
} catch (SchemaException ex) {
Expand Down Expand Up @@ -418,16 +418,16 @@ private ReadOnlyModel<InfoBoxType> createSchemaStatusInfoBoxModel() {
}

private ObjectSynchronizationType getSynchronizationFor(
ResourceObjectTypeDefinitionType obejctTypesDefinition,
ResourceObjectTypeDefinitionType objectTypesDefinition,
List<ObjectSynchronizationType> synchronizationPolicies, PrismObject<ResourceType> resource)
throws SchemaException {

for (ObjectSynchronizationType synchronizationPolicy : synchronizationPolicies) {
if (SynchronizationUtils.isPolicyApplicable(obejctTypesDefinition.getObjectClass(),
obejctTypesDefinition.getKind(), obejctTypesDefinition.getIntent(), synchronizationPolicy,
if (SynchronizationUtils.isPolicyApplicable(objectTypesDefinition.getObjectClass(),
objectTypesDefinition.getKind(), objectTypesDefinition.getIntent(), synchronizationPolicy,
resource)) {
if (synchronizationPolicy.getObjectClass().isEmpty()) {
synchronizationPolicy.getObjectClass().add(obejctTypesDefinition.getObjectClass());
synchronizationPolicy.getObjectClass().add(objectTypesDefinition.getObjectClass());
}
return synchronizationPolicy;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ protected ItemMandatoryHandler getMandatoryHandler() {
return null;
}

//TODO copied from abstractObejctMainPanel
//TODO copied from abstractObjectMainPanel
public <C extends Containerable> IModel<PrismContainerWrapper<C>> createContainerModel(ItemPath path) {
return PrismContainerWrapperModel.fromContainerWrapper(getModel(), path);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ public ItemStatus findObjectStatus() {

@Override
public <OW extends PrismObjectWrapper<O>, O extends ObjectType> OW findObjectWrapper() {
throw new UnsupportedOperationException("Find obejct wrapper not supported");
throw new UnsupportedOperationException("Find object wrapper not supported");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public String getObject() {
SystemInfoDto dto = getModelObject();

//this is quite strange situation and probably it should not occur,
// but sometimes, in the development mode the model obejct is null
// but sometimes, in the development mode the model object is null
if (dto == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ private List<QName> createObjectClassChoices(IModel<PrismObject<ResourceType>> m
refinedSchema = RefinedResourceSchemaImpl.getRefinedSchema(model.getObject(),
getPageBase().getPrismContext());
} catch (SchemaException e) {
warn("Could not determine defined obejct classes for resource");
warn("Could not determine defined object classes for resource");
return new ArrayList<>();
}
Collection<ObjectClassComplexTypeDefinition> defs = refinedSchema.getObjectClassDefinitions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@
import java.util.List;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.api.prism.ItemStatus;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismObjectWrapper;
import com.evolveum.midpoint.gui.impl.page.admin.AbstractObjectMainPanel;
import com.evolveum.midpoint.gui.impl.page.admin.ObjectDetailsModels;
import com.evolveum.midpoint.gui.impl.page.admin.task.PageTask;
import com.evolveum.midpoint.web.application.PanelDisplay;
import com.evolveum.midpoint.web.application.PanelInstance;
import com.evolveum.midpoint.web.application.PanelType;
import com.evolveum.midpoint.web.component.data.column.AjaxLinkPanel;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand All @@ -37,10 +27,12 @@
import com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition;
import com.evolveum.midpoint.common.refinery.RefinedResourceSchema;
import com.evolveum.midpoint.common.refinery.RefinedResourceSchemaImpl;
import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils;
import com.evolveum.midpoint.gui.impl.page.admin.task.PageTask;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.PrismProperty;
import com.evolveum.midpoint.prism.path.ItemPath;
Expand All @@ -55,6 +47,7 @@
import com.evolveum.midpoint.web.component.box.InfoBoxPanel;
import com.evolveum.midpoint.web.component.box.InfoBoxType;
import com.evolveum.midpoint.web.component.data.BoxedTablePanel;
import com.evolveum.midpoint.web.component.data.column.AjaxLinkPanel;
import com.evolveum.midpoint.web.component.data.column.ColumnTypeDto;
import com.evolveum.midpoint.web.component.data.column.ColumnUtils;
import com.evolveum.midpoint.web.component.util.ListDataProvider;
Expand Down Expand Up @@ -136,7 +129,6 @@ public IModel<?> getDataModel(IModel<SelectableBeanImpl<ResourceType>> rowModel)
}
});


List<ColumnTypeDto<String>> columns = Arrays.asList(
new ColumnTypeDto<>("ShadowType.intent", "objectTypeDefinition.intent",
ShadowType.F_INTENT.getLocalPart()),
Expand Down Expand Up @@ -202,22 +194,22 @@ private List<ResourceConfigurationDto> createResourceConfigList(ResourceType res

try {
for (ResourceObjectTypeDefinitionType objectType : objectTypes) {
ObjectSynchronizationType obejctSynchronization = null;
ObjectSynchronizationType objectSynchronization = null;
if (resource.getSynchronization() != null
&& resource.getSynchronization().getObjectSynchronization() != null) {

obejctSynchronization = getSynchronizationFor(objectType,
objectSynchronization = getSynchronizationFor(objectType,
resource.getSynchronization().getObjectSynchronization(),
resource.asPrismObject());

}
List<TaskType> syncTask = new ArrayList<>();
if (obejctSynchronization != null) {
syncTask = getTaskFor(tasks, obejctSynchronization, resource.asPrismObject());
if (objectSynchronization != null) {
syncTask = getTaskFor(tasks, objectSynchronization, resource.asPrismObject());
}

ResourceConfigurationDto resourceConfig = new ResourceConfigurationDto(objectType,
obejctSynchronization != null, syncTask);
objectSynchronization != null, syncTask);
configs.add(resourceConfig);
}
} catch (SchemaException ex) {
Expand Down Expand Up @@ -403,16 +395,16 @@ private InfoBoxPanel createSchemaStatusInfo(ResourceType resource) {
}

private ObjectSynchronizationType getSynchronizationFor(
ResourceObjectTypeDefinitionType obejctTypesDefinition,
ResourceObjectTypeDefinitionType objectTypesDefinition,
List<ObjectSynchronizationType> synchronizationPolicies, PrismObject<ResourceType> resource)
throws SchemaException {

for (ObjectSynchronizationType synchronizationPolicy : synchronizationPolicies) {
if (SynchronizationUtils.isPolicyApplicable(obejctTypesDefinition.getObjectClass(),
obejctTypesDefinition.getKind(), obejctTypesDefinition.getIntent(), synchronizationPolicy,
if (SynchronizationUtils.isPolicyApplicable(objectTypesDefinition.getObjectClass(),
objectTypesDefinition.getKind(), objectTypesDefinition.getIntent(), synchronizationPolicy,
resource)) {
if (synchronizationPolicy.getObjectClass().isEmpty()) {
synchronizationPolicy.getObjectClass().add(obejctTypesDefinition.getObjectClass());
synchronizationPolicy.getObjectClass().add(objectTypesDefinition.getObjectClass());
}
return synchronizationPolicy;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2019 Evolveum and contributors
* Copyright (C) 2010-2021 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
Expand All @@ -12,15 +12,15 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectTypeDefinitionType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType;

public class ResourceConfigurationDto implements Serializable{
public class ResourceConfigurationDto implements Serializable {

private ResourceObjectTypeDefinitionType objectTypeDefinition;

private boolean sync;
private List<TaskType> definedTasks;

public ResourceConfigurationDto(ResourceObjectTypeDefinitionType obejctTypeDefinition, boolean sync, List<TaskType> definedTasks) {
this.objectTypeDefinition = obejctTypeDefinition;
public ResourceConfigurationDto(ResourceObjectTypeDefinitionType objectTypeDefinition, boolean sync, List<TaskType> definedTasks) {
this.objectTypeDefinition = objectTypeDefinition;
this.sync = sync;
this.definedTasks = definedTasks;
}
Expand Down Expand Up @@ -50,6 +50,4 @@ public void setObjectTypeDefinition(ResourceObjectTypeDefinitionType objectTypeD
this.objectTypeDefinition = objectTypeDefinition;
}



}
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
/*
* Copyright (c) 2010-2018 Evolveum and contributors
* Copyright (C) 2010-2021 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.web.page.login;

import com.evolveum.midpoint.common.configuration.api.MidpointConfiguration;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.panel.Fragment;
import org.apache.wicket.model.IModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;

import com.evolveum.midpoint.common.configuration.api.MidpointConfiguration;
import com.evolveum.midpoint.gui.api.component.captcha.CaptchaPanel;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.logging.Trace;
Expand Down Expand Up @@ -49,7 +47,7 @@ public abstract class PageAbstractFlow extends PageRegistrationBase {

protected PageParameters pageParameters;

public abstract void initalizeModel();
public abstract void initializeModel();
public abstract IModel<UserType> getUserModel();
public abstract boolean isCustomFormDefined();
protected abstract WebMarkupContainer initStaticLayout();
Expand All @@ -60,7 +58,7 @@ public abstract class PageAbstractFlow extends PageRegistrationBase {

public PageAbstractFlow(PageParameters pageParameters) {
this.pageParameters = pageParameters;
initalizeModel();
initializeModel();
initLayout();
}

Expand Down Expand Up @@ -209,6 +207,7 @@ private void showErrors(AjaxRequestTarget target) {
}

protected DynamicFormPanel<UserType> getDynamicFormPanel() {
//noinspection unchecked
return (DynamicFormPanel<UserType>) get(
createComponentPath(ID_MAIN_FORM, ID_CONTENT_AREA, ID_DYNAMIC_FORM));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private String getOidFromParams(PageParameters pageParameters) {
}

@Override
public void initalizeModel() {
public void initializeModel() {
final String userOid = getOidFromParams(pageParameters);

userModel = new LoadableModel<UserType>(false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ public PagePostAuthentication(PageParameters pageParameters) {
}

@Override
public void initalizeModel() {
userModel = new LoadableModel<UserType>() {
public void initializeModel() {
userModel = new LoadableModel<>() {

private static final long serialVersionUID = 1L;

Expand All @@ -105,7 +105,7 @@ protected UserType load() {
} catch (SchemaException | ConfigurationException | ObjectNotFoundException | ExpressionEvaluationException
| CommunicationException | SecurityViolationException e) {
//TODO: nothing critical even by the error. for now just log it
LoggingUtils.logException(LOGGER, "Cannot apply edited obejct definition", e);
LoggingUtils.logException(LOGGER, "Cannot apply edited object definition", e);
}

return user.asObjectable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,10 @@ public void test310modifySystemConfigurationAddCollectionView() throws Exception
//THEN
SystemConfigurationType systemConfigAfter = getSystemConfiguration();
AdminGuiConfigurationType adminGuiConfig = systemConfigAfter.getAdminGuiConfiguration();
assertNotNull("Unexpecteed empty admin gui configuration.", adminGuiConfig);
assertNotNull("Unexpected empty admin gui configuration.", adminGuiConfig);

GuiObjectListViewsType collectionViews = adminGuiConfig.getObjectCollectionViews();
assertNotNull("Unexpected empty gui obejct collection views", collectionViews);
assertNotNull("Unexpected empty gui object collection views", collectionViews);

GuiObjectListViewType myRolesCollection = null;
for (GuiObjectListViewType collectionView : collectionViews.getObjectCollectionView()) {
Expand All @@ -415,7 +415,7 @@ public void test310modifySystemConfigurationAddCollectionView() throws Exception
}

assertNotNull("Newly added collection view not present in system configuration, something strange", myRolesCollection);
assertFalse("c:RoleType should not be eqals to RoleType", RoleType.COMPLEX_TYPE.equals(myRolesCollection.getType()));
assertFalse("c:RoleType should not be equals to RoleType", RoleType.COMPLEX_TYPE.equals(myRolesCollection.getType()));
assertTrue("c:RoleType should match RoleType", QNameUtil.match(RoleType.COMPLEX_TYPE, myRolesCollection.getType()));

}
Expand Down

0 comments on commit eb6c314

Please sign in to comment.