Skip to content

Commit

Permalink
little refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Oct 16, 2015
1 parent 06656b3 commit 69df053
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
Expand Up @@ -15,6 +15,8 @@
import com.evolveum.midpoint.util.exception.ObjectNotFoundException;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.logging.LoggingUtils;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.application.AuthorizationAction;
import com.evolveum.midpoint.web.application.PageDescriptor;
import com.evolveum.midpoint.web.component.AjaxSubmitButton;
Expand Down Expand Up @@ -65,6 +67,8 @@ public class PageSelfCredentials extends PageSelf {
private static final String ID_SAVE_BUTTON = "save";
private static final String ID_CANCEL_BUTTON = "cancel";
private static final String ID_PANEL = "panel";

private static final Trace LOGGER = TraceManager.getTrace(PageSelfCredentials.class);
private static final String DOT_CLASS = PageSelfCredentials.class.getName() + ".";
private static final String OPERATION_LOAD_USER_WITH_ACCOUNTS = DOT_CLASS + "loadUserWithAccounts";
private static final String OPERATION_LOAD_USER = DOT_CLASS + "loadUser";
Expand Down Expand Up @@ -101,7 +105,7 @@ protected MyPasswordsDto load() {
}

private MyPasswordsDto loadPageModel() {
// LOGGER.debug("Loading user and accounts.");
LOGGER.debug("Loading user and accounts.");
MyPasswordsDto dto = new MyPasswordsDto();
OperationResult result = new OperationResult(OPERATION_LOAD_USER_WITH_ACCOUNTS);
try {
Expand All @@ -115,7 +119,7 @@ private MyPasswordsDto loadPageModel() {

PrismReference reference = user.findReference(UserType.F_LINK_REF);
if (reference == null || reference.getValues() == null) {
// LOGGER.debug("No accounts found for user {}.", new Object[]{userOid});
LOGGER.debug("No accounts found for user {}.", new Object[]{userOid});
return dto;
}

Expand All @@ -136,17 +140,14 @@ private MyPasswordsDto loadPageModel() {
dto.getAccounts().add(createPasswordAccountDto(account));
subResult.recordSuccessIfUnknown();
} catch (Exception ex) {
// LoggingUtils.logException(LOGGER, "Couldn't load account", ex);
LoggingUtils.logException(LOGGER, "Couldn't load account", ex);
subResult.recordFatalError("Couldn't load account.", ex);
}
}

List<ShadowType> shadowTypeList = loadShadowTypeList();


result.recordSuccessIfUnknown();
} catch (Exception ex) {
// LoggingUtils.logException(LOGGER, "Couldn't load accounts", ex);
LoggingUtils.logException(LOGGER, "Couldn't load accounts", ex);
result.recordFatalError("Couldn't load accounts", ex);
} finally {
result.recomputeStatus();
Expand Down Expand Up @@ -294,7 +295,7 @@ private void onSavePerformed(AjaxRequestTarget target) {

result.recordSuccess();
} catch (Exception ex) {
// LoggingUtils.logException(LOGGER, "Couldn't save password changes", ex);
LoggingUtils.logException(LOGGER, "Couldn't save password changes", ex);
result.recordFatalError("Couldn't save password changes.", ex);
} finally {
result.recomputeStatus();
Expand Down Expand Up @@ -350,6 +351,7 @@ private List<ShadowType> loadShadowTypeList() {
PrismObject<ShadowType> shadow = WebModelUtils.loadObject(ShadowType.class, reference.getOid(), options, this, task, subResult);
shadowTypeList.add(shadow.asObjectable());
} catch (Exception ex) {
LoggingUtils.logException(LOGGER, "Couldn't load account", ex);
subResult.recordFatalError("Couldn't load account." + ex.getMessage(), ex);
} finally {
subResult.computeStatus();
Expand Down
Expand Up @@ -38,12 +38,6 @@ public class ChangePasswordPanel extends SimplePanel<MyPasswordsDto> {
public static final String SELECTED_ACCOUNT_ICON_CSS = "fa fa-check-square-o";
public static final String DESELECTED_ACCOUNT_ICON_CSS = "fa fa-square-o";
public static final String PROPAGATED_ACCOUNT_ICON_CSS = "fa fa-sign-out";
private static final Trace LOGGER = TraceManager.getTrace(ChangePasswordPanel.class);

private static final String DOT_CLASS = ChangePasswordPanel.class.getName() + ".";
private static final String OPERATION_LOAD_USER_WITH_ACCOUNTS = DOT_CLASS + "loadUserWithAccounts";
private static final String OPERATION_LOAD_USER = DOT_CLASS + "loadUser";
private static final String OPERATION_LOAD_ACCOUNT = DOT_CLASS + "loadAccount";

private LoadableModel<MyPasswordsDto> model;
private boolean midpointAccountSelected = true;
Expand Down

0 comments on commit 69df053

Please sign in to comment.