Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/support-3.9' into support-3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Mar 21, 2019
2 parents c1ff689 + 7ecb810 commit f42bee9
Show file tree
Hide file tree
Showing 89 changed files with 2,383 additions and 957 deletions.
2 changes: 1 addition & 1 deletion build-system/pom.xml
Expand Up @@ -83,7 +83,7 @@
<activiti-spring.version>5.22.0</activiti-spring.version>
<commons-email.version>1.3</commons-email.version>
<xmlsec.version>2.0.6</xmlsec.version>
<connid.version>1.5.0.8</connid.version>
<connid.version>1.5.0.10</connid.version>
<jasper.version>6.5.0</jasper.version>
<derby.version>10.11.1.1</derby.version>
<wro4j.version>1.8.0</wro4j.version>
Expand Down
Expand Up @@ -57,13 +57,15 @@
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.*;
import com.evolveum.midpoint.util.exception.*;
import com.evolveum.midpoint.web.component.DateLabelComponent;
import com.evolveum.midpoint.web.component.breadcrumbs.Breadcrumb;
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.menu.cog.InlineMenuItem;
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction;
import com.evolveum.midpoint.web.component.prism.*;
import com.evolveum.midpoint.web.page.admin.reports.dto.ReportDeleteDialogDto;
import com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.collections4.CollectionUtils;
Expand Down Expand Up @@ -1530,6 +1532,48 @@ public static String getLocalizedDate(Date date, String style) {
return converter.convertToString(date, WebComponentUtil.getCurrentLocale());
}

public static String getShortDateTimeFormattedValue(XMLGregorianCalendar date, PageBase pageBase) {
return getShortDateTimeFormattedValue(XmlTypeConverter.toDate(date), pageBase);
}

public static String getShortDateTimeFormattedValue(Date date, PageBase pageBase) {
if (date == null) {
return "";
}
String shortDateTimeFortam = getShortDateTimeFormat(pageBase);
return getLocalizedDate(date, shortDateTimeFortam);
}

public static String getLongDateTimeFormattedValue(XMLGregorianCalendar date, PageBase pageBase) {
return getLongDateTimeFormattedValue(XmlTypeConverter.toDate(date), pageBase);
}

public static String getLongDateTimeFormattedValue(Date date, PageBase pageBase) {
if (date == null) {
return "";
}
String longDateTimeFormat = getLongDateTimeFormat(pageBase);
return getLocalizedDate(date, longDateTimeFormat);
}

public static String getShortDateTimeFormat(PageBase pageBase){
AdminGuiConfigurationDisplayFormatsType displayFormats = pageBase.getAdminGuiConfiguration().getDisplayFormats();
if (displayFormats == null || StringUtils.isEmpty(displayFormats.getShortDateTimeFormat())){
return DateLabelComponent.SHORT_MEDIUM_STYLE;
} else {
return displayFormats.getShortDateTimeFormat();
}
}

public static String getLongDateTimeFormat(PageBase pageBase){
AdminGuiConfigurationDisplayFormatsType displayFormats = pageBase.getAdminGuiConfiguration().getDisplayFormats();
if (displayFormats == null || StringUtils.isEmpty(displayFormats.getLongDateTimeFormat())){
return DateLabelComponent.LONG_MEDIUM_STYLE;
} else {
return displayFormats.getLongDateTimeFormat();
}
}

public static boolean isActivationEnabled(PrismObject object) {
Validate.notNull(object);

Expand Down
Expand Up @@ -152,6 +152,7 @@ protected void configure(HttpSecurity http) throws Exception {
}

http.headers().disable();
http.headers().frameOptions().deny();

if (Arrays.stream(environment.getActiveProfiles()).anyMatch(p -> p.equalsIgnoreCase("cas"))) {
http.addFilterAt(casFilter(), CasAuthenticationFilter.class);
Expand Down
Expand Up @@ -46,7 +46,8 @@ public class DateLabelComponent extends DateLabel {
public static final String MEDIUM_FULL_STYLE = "MF"; //medium style for date, full style for time
public static final String MEDIUM_NOTIME_STYLE = "M-"; //medium style for date, no time
public static final String LONG_SHORT_STYLE = "LS"; //long style for date, short style for time
public static final String LONG_MEDIUM_STYLE = "LM"; //long style for date, medium style for time
public static final String LONG_MEDIUM_STYLE = "LM"; //long style for date, medium style for time TODO ? let it be default style
//if no other is specified
public static final String LONG_FULL_STYLE = "LF"; //long style for date, full style for time
public static final String LONG_NOTIME_STYLE = "L-"; //long style for date, no time
public static final String FULL_SHORT_STYLE = "FS"; //full style for date, short style for time
Expand All @@ -58,31 +59,25 @@ public class DateLabelComponent extends DateLabel {
public static final String NODATE_LONG_STYLE = "-L"; //no date, long style for time
public static final String NODATE_FULL_STYLE = "-F"; //no date, full style for time

public DateLabelComponent(String id, IModel<Date> model){
this(id, model, (DateConverter) null);
}

public DateLabelComponent(String id, IModel<Date> model, DateConverter converter){
this(id, model, converter, null, "", "");
}

public DateLabelComponent(String id, IModel<Date> model, String style){
this(id, model, null, style, "", "");
}
public DateLabelComponent(String id, IModel<Date> model, String style){
super(id, model, new PatternDateConverter(WebComponentUtil.getLocalizedDatePattern(style == null ? LONG_MEDIUM_STYLE : style), true ));

public DateLabelComponent(String id, IModel<Date> model, DateConverter converter, String style,
String beforeDateText, String afterDateText){
super(id, model, converter == null ?
new PatternDateConverter(WebComponentUtil.getLocalizedDatePattern(style == null ? LONG_LONG_STYLE : style), true ) : converter);

setBefore(beforeDateText);
setAfter(afterDateText);
setBefore(getBeforeDateText());
setAfter(getAfterDateText());
}

public void setBeforeTextOnDateNull(String nullDateText){
if (getModel().getObject() == null){
setBefore(nullDateText);
}
}

protected String getBeforeDateText(){
return "";
}

protected String getAfterDateText(){
return "";
}
}

Expand Up @@ -18,7 +18,6 @@

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.web.component.DateLabelComponent;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;
Expand Down Expand Up @@ -104,8 +103,7 @@ public String getObject() {
PropertyModel<Object> tempModel = new PropertyModel<>(getModel(),
qname.getLocalPart());
if (tempModel.getObject() instanceof XMLGregorianCalendar){
return WebComponentUtil.getLocalizedDate((XMLGregorianCalendar)tempModel.getObject(),
DateLabelComponent.MEDIUM_MEDIUM_STYLE);
return WebComponentUtil.getLongDateTimeFormattedValue((XMLGregorianCalendar)tempModel.getObject(), getPageBase());
} else if (tempModel.getObject() instanceof ObjectReferenceType){
ObjectReferenceType ref = (ObjectReferenceType) tempModel.getObject();
return WebComponentUtil.getName(ref, getPageBase(), OPERATION_LOAD_USER);
Expand Down
Expand Up @@ -226,7 +226,7 @@ public boolean isOrderingDisabled() {
return false;
}
GuiObjectListViewType def = WebComponentUtil.getDefaultGuiObjectListType((PageBase) component.getPage());
return def != null && def.isDisableSorting();
return def != null && def.isDisableSorting() != null && def.isDisableSorting();
}

protected ObjectPaging createPaging(long offset, long pageSize) {
Expand Down
Expand Up @@ -115,7 +115,7 @@ public void populateItem(Item<ICellPopulator<WorkItemDto>> cellItem, String comp
public Date getObject() {
return rowModel.getObject().getStartedDate();
}
}, DateLabelComponent.LONG_MEDIUM_STYLE));
}, WebComponentUtil.getShortDateTimeFormat(WorkItemsPanel.this.getPageBase())));
}
});
}
Expand All @@ -131,7 +131,7 @@ public void populateItem(Item<ICellPopulator<WorkItemDto>> cellItem, String comp
public Date getObject() {
return rowModel.getObject().getCreatedDate();
}
}, DateLabelComponent.LONG_MEDIUM_STYLE));
}, WebComponentUtil.getShortDateTimeFormat(WorkItemsPanel.this.getPageBase())));
}
});
columns.add(new AbstractColumn<WorkItemDto, String>(createStringResource("WorkItemsPanel.deadline")){
Expand All @@ -146,7 +146,7 @@ public void populateItem(Item<ICellPopulator<WorkItemDto>> cellItem, String comp
public Date getObject() {
return rowModel.getObject().getDeadlineDate();
}
}, DateLabelComponent.LONG_MEDIUM_STYLE));
}, WebComponentUtil.getShortDateTimeFormat(WorkItemsPanel.this.getPageBase())));
}
});
columns.add(new PropertyColumn<>(createStringResource("WorkItemsPanel.escalationLevel"),
Expand Down
Expand Up @@ -19,6 +19,7 @@
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils;
import com.evolveum.midpoint.model.api.ModelExecuteOptions;
import com.evolveum.midpoint.model.api.context.AssignmentPath;
import com.evolveum.midpoint.model.api.context.EvaluatedAssignment;
import com.evolveum.midpoint.model.api.context.EvaluatedAssignmentTarget;
import com.evolveum.midpoint.model.api.context.EvaluatedConstruction;
Expand Down Expand Up @@ -854,16 +855,14 @@ public List<AssignmentInfoDto> showAllAssignmentsPerformed(AjaxRequestTarget aja
private AssignmentInfoDto createAssignmentsPreviewDto(EvaluatedAssignmentTarget evaluatedAbstractRole,
Task task, OperationResult result) {
return createAssignmentsPreviewDto(evaluatedAbstractRole.getTarget(), evaluatedAbstractRole.isDirectlyAssigned(),
evaluatedAbstractRole.getAssignment(), task, result);
evaluatedAbstractRole.getAssignmentPath(), evaluatedAbstractRole.getAssignment(), task, result);
}

protected AssignmentInfoDto createAssignmentsPreviewDto(ObjectReferenceType reference,
Task task, OperationResult result) {
protected AssignmentInfoDto createAssignmentsPreviewDto(ObjectReferenceType reference, Task task, OperationResult result) {
PrismObject<? extends FocusType> targetObject = WebModelServiceUtils.resolveReferenceNoFetch(reference,
PageAdminFocus.this, task, result);

return createAssignmentsPreviewDto(targetObject, true,
null, task, result);
return createAssignmentsPreviewDto(targetObject, true, null, null, task, result);
}

protected AssignmentInfoDto createDelegableAssignmentsPreviewDto(AssignmentType assignment, Task task, OperationResult result) {
Expand All @@ -878,15 +877,15 @@ protected AssignmentInfoDto createDelegableAssignmentsPreviewDto(AssignmentType
isDelegable = targetObject.getRealValue().isDelegable();
}
if (Boolean.TRUE.equals(isDelegable)) {
return createAssignmentsPreviewDto(targetObject, true, assignment, task, result);
return createAssignmentsPreviewDto(targetObject, true, null, assignment, task, result);
}
}
}
return null;
}

private AssignmentInfoDto createAssignmentsPreviewDto(PrismObject<? extends FocusType> targetObject,
boolean isDirectlyAssigned, AssignmentType assignment,
boolean isDirectlyAssigned, AssignmentPath assignmentPath, AssignmentType assignment,
Task task, OperationResult result) {
AssignmentInfoDto dto = new AssignmentInfoDto();
dto.setTargetOid(targetObject.getOid());
Expand All @@ -895,6 +894,7 @@ private AssignmentInfoDto createAssignmentsPreviewDto(PrismObject<? extends Focu
dto.setTargetClass(targetObject.getCompileTimeClass());
dto.setTargetType(WebComponentUtil.classToQName(getPrismContext(), targetObject.getCompileTimeClass()));
dto.setDirect(isDirectlyAssigned);
dto.setAssignmentParent(assignmentPath);
if (assignment != null) {
if (assignment.getTenantRef() != null) {
dto.setTenantName(nameFromReference(assignment.getTenantRef(),
Expand Down Expand Up @@ -955,6 +955,7 @@ private AssignmentInfoDto createAssignmentsPreviewDto(EvaluatedConstruction eval
dto.setTargetDescription(resource.asObjectable().getDescription());
dto.setTargetClass(resource.getCompileTimeClass());
dto.setDirect(evaluatedConstruction.isDirectlyAssigned());
dto.setAssignmentParent(evaluatedConstruction.getAssignmentPath());
dto.setKind(evaluatedConstruction.getKind());
dto.setIntent(evaluatedConstruction.getIntent());
return dto;
Expand Down
Expand Up @@ -63,7 +63,6 @@
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.AjaxButton;
import com.evolveum.midpoint.web.component.DateLabelComponent;
import com.evolveum.midpoint.web.component.data.BoxedTablePanel;
import com.evolveum.midpoint.web.component.data.Table;
import com.evolveum.midpoint.web.component.data.column.IsolatedCheckBoxPanel;
Expand Down Expand Up @@ -252,15 +251,15 @@ public void populateItem(Item<ICellPopulator<CaseWorkItemDto>> item, String comp
final Date created;
if (createdCal != null) {
created = createdCal.toGregorianCalendar().getTime();
item.add(AttributeModifier.replace("title", WebComponentUtil.getLocalizedDate(created, DateLabelComponent.LONG_MEDIUM_STYLE)));
item.add(AttributeModifier.replace("title", WebComponentUtil.getShortDateTimeFormattedValue(created, PageCaseWorkItems.this)));
item.add(new TooltipBehavior());
} else {
created = null;
}
item.add(new Label(componentId, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return WebComponentUtil.getLocalizedDate(created, DateLabelComponent.LONG_MEDIUM_STYLE);
return WebComponentUtil.getShortDateTimeFormattedValue(created, PageCaseWorkItems.this);
}
}));
}
Expand All @@ -277,15 +276,15 @@ public void populateItem(Item<ICellPopulator<CaseWorkItemDto>> item, String comp
final Date deadline;
if (deadlineCal != null) {
deadline = deadlineCal.toGregorianCalendar().getTime();
item.add(AttributeModifier.replace("title", WebComponentUtil.getLocalizedDate(deadline, DateLabelComponent.LONG_MEDIUM_STYLE)));
item.add(AttributeModifier.replace("title", WebComponentUtil.getShortDateTimeFormattedValue(deadline, PageCaseWorkItems.this)));
item.add(new TooltipBehavior());
} else {
deadline = null;
}
item.add(new Label(componentId, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return WebComponentUtil.getLocalizedDate(deadline, DateLabelComponent.LONG_MEDIUM_STYLE);
return WebComponentUtil.getShortDateTimeFormattedValue(deadline, PageCaseWorkItems.this);
}
}));
}
Expand All @@ -302,15 +301,15 @@ public void populateItem(Item<ICellPopulator<CaseWorkItemDto>> item, String comp
final Date closed;
if (closedCal != null) {
closed = closedCal.toGregorianCalendar().getTime();
item.add(AttributeModifier.replace("title", WebComponentUtil.getLocalizedDate(closed, DateLabelComponent.LONG_MEDIUM_STYLE)));
item.add(AttributeModifier.replace("title", WebComponentUtil.getShortDateTimeFormattedValue(closed, PageCaseWorkItems.this)));
item.add(new TooltipBehavior());
} else {
closed = null;
}
item.add(new Label(componentId, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return WebComponentUtil.getLocalizedDate(closed, DateLabelComponent.LONG_MEDIUM_STYLE);
return WebComponentUtil.getShortDateTimeFormattedValue(closed, PageCaseWorkItems.this);
}
}));
}
Expand Down
Expand Up @@ -4,7 +4,6 @@
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.DateLabelComponent;
import com.evolveum.midpoint.web.component.form.Form;
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem;
import com.evolveum.midpoint.web.component.util.SelectableBean;
Expand Down Expand Up @@ -175,7 +174,7 @@ public void populateItem(Item<ICellPopulator<SelectableBean<CaseType>>> cellItem
cellItem.add(new Label(componentId, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return WebComponentUtil.getLocalizedDate(created, DateLabelComponent.LONG_MEDIUM_STYLE);
return WebComponentUtil.getShortDateTimeFormattedValue(created, PageCases.this);
}
}));
}
Expand All @@ -199,7 +198,7 @@ public void populateItem(Item<ICellPopulator<SelectableBean<CaseType>>> cellItem
cellItem.add(new Label(componentId, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return WebComponentUtil.getLocalizedDate(closed, DateLabelComponent.LONG_MEDIUM_STYLE);
return WebComponentUtil.getShortDateTimeFormattedValue(closed, PageCases.this);
}
}));
}
Expand Down
Expand Up @@ -28,7 +28,6 @@
import com.evolveum.midpoint.web.application.AuthorizationAction;
import com.evolveum.midpoint.web.application.PageDescriptor;
import com.evolveum.midpoint.web.component.AjaxIconButton;
import com.evolveum.midpoint.web.component.DateLabelComponent;
import com.evolveum.midpoint.web.component.data.BoxedTablePanel;
import com.evolveum.midpoint.web.component.data.MultiButtonPanel;
import com.evolveum.midpoint.web.component.data.Table;
Expand Down Expand Up @@ -322,7 +321,7 @@ public void populateItem(Item<ICellPopulator<CertWorkItemDto>> item, String comp
CertWorkItemDto dto = rowModel.getObject();
Date started = dto.getStageStarted();
if (started != null) {
item.add(AttributeModifier.replace("title", WebComponentUtil.getLocalizedDate(started, DateLabelComponent.LONG_MEDIUM_STYLE)));
item.add(AttributeModifier.replace("title", WebComponentUtil.getShortDateTimeFormattedValue(started, PageCertDecisions.this)));
item.add(new TooltipBehavior());
}
}
Expand Down

0 comments on commit f42bee9

Please sign in to comment.