Skip to content

Commit

Permalink
Merge branch 'master' into feature/deputy
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Nov 3, 2016
2 parents 6c10435 + c784b2d commit ca18f03
Show file tree
Hide file tree
Showing 17 changed files with 440 additions and 115 deletions.
Expand Up @@ -62,6 +62,7 @@ public boolean isVisible(){
}
};
button.add(new AttributeAppender("class", getButtonCssClass(finalId)));
button.add(new AttributeAppender("title", getButtonTitle(finalId)));
buttons.add(button);
buttons.add(new Label("label"+finalId, " "));
}
Expand Down Expand Up @@ -91,6 +92,10 @@ public String getButtonSizeCssClass(int id) {
return DoubleButtonColumn.BUTTON_SIZE_CLASS.DEFAULT.toString();
}

public String getButtonTitle(int id) {
return "";
}

public String getButtonColorCssClass(int id) {
return DoubleButtonColumn.BUTTON_COLOR_CLASS.DEFAULT.toString();
}
Expand Down
Expand Up @@ -54,6 +54,11 @@ public String getCaption(int id) {
return MultiButtonColumn.this.getCaption(id);
}

@Override
public String getButtonTitle(int id) {
return MultiButtonColumn.this.getButtonTitle(id);
}

@Override
public boolean isButtonEnabled(int id, IModel<T> model) {
return MultiButtonColumn.this.isButtonEnabled(id, model);
Expand Down Expand Up @@ -126,4 +131,9 @@ public MultiButtonPanel getButtonPanel(){
public IModel<T> getRowModel(){
return rowModel;
}

public String getButtonTitle(int id) {
return "";
}

}
Expand Up @@ -46,7 +46,9 @@
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* Created by honchar.
Expand All @@ -71,17 +73,17 @@ private void initLayout(final LoadableModel<ObjectWrapper<F>> focusWrapperModel,

searchDto.setEventStage(AuditEventStageType.EXECUTION);

AuditLogViewerPanel panel = new AuditLogViewerPanel(ID_MAIN_PANEL, page, searchDto) {
@Override
protected boolean isTargetNameVisible() {
return false;
}

@Override
protected boolean isEventStageVisible() {
return false;
}

Map<String, Boolean> visibilityMap = new HashMap<>();
visibilityMap.put(AuditLogViewerPanel.TARGET_NAME_LABEL_VISIBILITY, false);
visibilityMap.put(AuditLogViewerPanel.TARGET_NAME_FIELD_VISIBILITY, false);
visibilityMap.put(AuditLogViewerPanel.TARGET_OWNER_LABEL_VISIBILITY, false);
visibilityMap.put(AuditLogViewerPanel.TARGET_OWNER_FIELD_VISIBILITY, false);
visibilityMap.put(AuditLogViewerPanel.EVENT_STAGE_LABEL_VISIBILITY, false);
visibilityMap.put(AuditLogViewerPanel.EVENT_STAGE_FIELD_VISIBILITY, false);
visibilityMap.put(AuditLogViewerPanel.EVENT_STAGE_COLUMN_VISIBILITY, false);
visibilityMap.put(AuditLogViewerPanel.TARGET_COLUMN_VISIBILITY, false);
visibilityMap.put(AuditLogViewerPanel.TARGET_OWNER_COLUMN_VISIBILITY, false);
AuditLogViewerPanel panel = new AuditLogViewerPanel(ID_MAIN_PANEL, page, searchDto, visibilityMap) {
@Override
protected List<IColumn<AuditEventRecordType, String>> initColumns() {
List<IColumn<AuditEventRecordType, String>> columns = super.initColumns();
Expand All @@ -98,6 +100,17 @@ public String getCaption(int id) {
return "";
}

@Override
public String getButtonTitle(int id) {
switch (id) {
case 0:
return page.createStringResource("ObjectHistoryTabPanel.viewHistoricalObjectDataTitle").getString();
case 1:
return page.createStringResource("ObjectHistoryTabPanel.viewHistoricalObjectXmlTitle").getString();
}
return "";
}

@Override
public String getButtonColorCssClass(int id) {
return colors[id].toString();
Expand Down
Expand Up @@ -238,7 +238,7 @@ private <O extends ObjectType, C extends Containerable> void addContainerWrapper
if (!(def instanceof PrismContainerDefinition)) {
continue;
}
if (ObjectSpecificationType.COMPLEX_TYPE.equals(def.getTypeName())) {
if (SubjectedObjectSelectorType.COMPLEX_TYPE.equals(def.getTypeName())) {
continue; // TEMPORARY FIX
}
if (TriggerType.COMPLEX_TYPE.equals(def.getTypeName())) {
Expand Down
Expand Up @@ -30,7 +30,7 @@
<div wicket:id="toField" />
<label wicket:id="targetNameLabel"></label>
<div wicket:id="targetNameField" />
<label><wicket:message key="PageAuditLogViewer.targetOwnerNameLabel" /></label>
<label wicket:id="targetOwnerNameLabel"></label>
<div wicket:id="targetOwnerNameField" />
<label><wicket:message key="PageAuditLogViewer.initiatorNameLabel" /></label>
<div wicket:id="initiatorNameField"/>
Expand Down
Expand Up @@ -68,6 +68,7 @@ public class AuditLogViewerPanel extends BasePanel{
private static final String ID_INITIATOR_NAME = "initiatorNameField";
private static final String ID_TARGET_NAME = "targetNameField";
private static final String ID_TARGET_NAME_LABEL = "targetNameLabel";
private static final String ID_TARGET_OWNER_NAME_LABEL = "targetOwnerNameLabel";
private static final String ID_TARGET_OWNER_NAME = "targetOwnerNameField";
private static final String ID_CHANNEL = "channelField";
private static final String ID_HOST_IDENTIFIER = "hostIdentifierField";
Expand All @@ -80,21 +81,37 @@ public class AuditLogViewerPanel extends BasePanel{
private static final String ID_SEARCH_BUTTON = "searchButton";
private static final String ID_FEEDBACK = "feedback";

public static final String TARGET_NAME_LABEL_VISIBILITY = "targetNameLabel";
public static final String TARGET_NAME_FIELD_VISIBILITY = "targetFieldField";
public static final String TARGET_OWNER_LABEL_VISIBILITY = "targetOwnerLabel";
public static final String TARGET_OWNER_FIELD_VISIBILITY = "targetOwnerField";
public static final String TARGET_COLUMN_VISIBILITY = "targetColumn";
public static final String TARGET_OWNER_COLUMN_VISIBILITY = "targetOwnerColumn";
public static final String EVENT_STAGE_COLUMN_VISIBILITY = "eventStageColumn";
public static final String EVENT_STAGE_LABEL_VISIBILITY = "eventStageLabel";
public static final String EVENT_STAGE_FIELD_VISIBILITY = "eventStageField";

private static final String OPERATION_RESOLVE_REFENRENCE_NAME = AuditLogViewerPanel.class.getSimpleName()
+ ".resolveReferenceName()";

private IModel<AuditSearchDto> auditSearchDto;
private AuditSearchDto searchDto;
private PageBase pageBase;
private Map<String, Boolean> visibilityMap;

public AuditLogViewerPanel(String id, PageBase pageBase){
this(id, pageBase, null);
}

public AuditLogViewerPanel(String id, PageBase pageBase, AuditSearchDto searchDto){
public AuditLogViewerPanel(String id, PageBase pageBase, AuditSearchDto searchDto) {
this(id, pageBase, searchDto, new HashMap<String, Boolean>());
}

public AuditLogViewerPanel(String id, PageBase pageBase, AuditSearchDto searchDto, Map<String, Boolean> visibilityMap){
super(id);
this.pageBase = pageBase;
this.searchDto = searchDto;
this.visibilityMap = visibilityMap;
initAuditSearchModel();
initLayout();
}
Expand Down Expand Up @@ -178,7 +195,8 @@ private void initParametersPanel(Form mainForm) {
eventStageLabel.add(new VisibleEnableBehaviour(){
@Override
public boolean isVisible(){
return isTargetNameVisible();
return visibilityMap == null || visibilityMap.get(EVENT_STAGE_LABEL_VISIBILITY) == null ?
true : visibilityMap.get(EVENT_STAGE_LABEL_VISIBILITY);
}
});
eventStageLabel.setOutputMarkupId(true);
Expand All @@ -194,7 +212,8 @@ public boolean isVisible(){
eventStage.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return isEventStageVisible();
return visibilityMap == null || visibilityMap.get(EVENT_STAGE_FIELD_VISIBILITY) == null ?
true : visibilityMap.get(EVENT_STAGE_FIELD_VISIBILITY);
}
});
eventStage.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
Expand Down Expand Up @@ -249,6 +268,16 @@ protected void replaceIfEmpty(ObjectType object) {
};
parametersPanel.add(chooseInitiatorPanel);

Label targetOwnerNameLabel = new Label(ID_TARGET_OWNER_NAME_LABEL, pageBase.createStringResource("PageAuditLogViewer.targetOwnerNameLabel"));
targetOwnerNameLabel.add(new VisibleEnableBehaviour(){
@Override
public boolean isVisible(){
return visibilityMap == null || visibilityMap.get(TARGET_OWNER_LABEL_VISIBILITY) == null ?
true : visibilityMap.get(TARGET_OWNER_LABEL_VISIBILITY);
}
});
parametersPanel.add(targetOwnerNameLabel);

ValueChooseWrapperPanel<ObjectReferenceType, UserType> chooseTargerOwnerPanel = new ValueChooseWrapperPanel<ObjectReferenceType, UserType>(
ID_TARGET_OWNER_NAME,
new PropertyModel<ObjectReferenceType>(auditSearchDto, AuditSearchDto.F_TARGET_OWNER_NAME),
Expand All @@ -260,13 +289,21 @@ protected void replaceIfEmpty(ObjectType object) {
getModel().setObject(ort);
}
};
chooseTargerOwnerPanel.add(new VisibleEnableBehaviour(){
@Override
public boolean isVisible(){
return visibilityMap == null || visibilityMap.get(TARGET_OWNER_FIELD_VISIBILITY) == null ?
true : visibilityMap.get(TARGET_OWNER_FIELD_VISIBILITY);
}
});
parametersPanel.add(chooseTargerOwnerPanel);

Label targetNameLabel = new Label(ID_TARGET_NAME_LABEL, pageBase.createStringResource("PageAuditLogViewer.targetNameLabel"));
targetNameLabel.add(new VisibleEnableBehaviour(){
@Override
public boolean isVisible(){
return searchDto.getTargetName() == null || StringUtils.isEmpty(searchDto.getTargetName().getOid());
return visibilityMap == null || visibilityMap.get(TARGET_NAME_LABEL_VISIBILITY) == null ?
true : visibilityMap.get(TARGET_NAME_LABEL_VISIBILITY);
}
});
parametersPanel.add(targetNameLabel);
Expand All @@ -286,7 +323,8 @@ protected void replaceIfEmpty(ObjectType object) {
chooseTargetPanel.add(new VisibleEnableBehaviour(){
@Override
public boolean isVisible(){
return searchDto.getTargetName() == null || StringUtils.isEmpty(searchDto.getTargetName().getOid());
return visibilityMap == null || visibilityMap.get(TARGET_NAME_FIELD_VISIBILITY) == null ?
true : visibilityMap.get(TARGET_NAME_FIELD_VISIBILITY);
}
});
parametersPanel.add(chooseTargetPanel);
Expand Down Expand Up @@ -392,7 +430,8 @@ public void populateItem(Item<ICellPopulator<AuditEventRecordType>> item, String
};
columns.add(initiatorRefColumn);

if (isEventStageVisible()) {
if (visibilityMap == null || visibilityMap.get(EVENT_STAGE_COLUMN_VISIBILITY) == null ||
visibilityMap.get(EVENT_STAGE_COLUMN_VISIBILITY)) {
IColumn<AuditEventRecordType, String> eventStageColumn = new PropertyColumn<AuditEventRecordType, String>(
createStringResource("PageAuditLogViewer.eventStageLabel"), "eventStage");
columns.add(eventStageColumn);
Expand All @@ -401,32 +440,37 @@ public void populateItem(Item<ICellPopulator<AuditEventRecordType>> item, String
createStringResource("PageAuditLogViewer.eventTypeLabel"), "eventType");
columns.add(eventTypeColumn);

PropertyColumn<AuditEventRecordType, String> targetRefColumn = new PropertyColumn<AuditEventRecordType, String>(createStringResource("AuditEventRecordType.targetRef"),
AuditEventRecordType.F_TARGET_REF.getLocalPart()) {
private static final long serialVersionUID = 1L;

@Override
public void populateItem(Item<ICellPopulator<AuditEventRecordType>> item, String componentId,
IModel<AuditEventRecordType> rowModel) {
AuditEventRecordType auditEventRecordType = (AuditEventRecordType) rowModel.getObject();
createReferenceColumn(auditEventRecordType.getTargetRef(), item, componentId);
}
};
columns.add(targetRefColumn);

PropertyColumn<AuditEventRecordType, String> targetOwnerRefColumn = new PropertyColumn<AuditEventRecordType, String>(createStringResource("AuditEventRecordType.targetOwnerRef"),
AuditEventRecordType.F_TARGET_OWNER_REF.getLocalPart()) {
private static final long serialVersionUID = 1L;

@Override
public void populateItem(Item<ICellPopulator<AuditEventRecordType>> item, String componentId,
IModel<AuditEventRecordType> rowModel) {
AuditEventRecordType auditEventRecordType = (AuditEventRecordType) rowModel.getObject();
createReferenceColumn(auditEventRecordType.getTargetOwnerRef(), item, componentId);
}
};
columns.add(targetOwnerRefColumn);
if (visibilityMap == null || visibilityMap.get(TARGET_COLUMN_VISIBILITY) == null ||
visibilityMap.get(TARGET_COLUMN_VISIBILITY)) {
PropertyColumn<AuditEventRecordType, String> targetRefColumn = new PropertyColumn<AuditEventRecordType, String>(createStringResource("AuditEventRecordType.targetRef"),
AuditEventRecordType.F_TARGET_REF.getLocalPart()) {
private static final long serialVersionUID = 1L;

@Override
public void populateItem(Item<ICellPopulator<AuditEventRecordType>> item, String componentId,
IModel<AuditEventRecordType> rowModel) {
AuditEventRecordType auditEventRecordType = (AuditEventRecordType) rowModel.getObject();
createReferenceColumn(auditEventRecordType.getTargetRef(), item, componentId);
}
};
columns.add(targetRefColumn);
}

if (visibilityMap == null || visibilityMap.get(TARGET_OWNER_COLUMN_VISIBILITY) == null ||
visibilityMap.get(TARGET_OWNER_COLUMN_VISIBILITY)) {
PropertyColumn<AuditEventRecordType, String> targetOwnerRefColumn = new PropertyColumn<AuditEventRecordType, String>(createStringResource("AuditEventRecordType.targetOwnerRef"),
AuditEventRecordType.F_TARGET_OWNER_REF.getLocalPart()) {
private static final long serialVersionUID = 1L;

@Override
public void populateItem(Item<ICellPopulator<AuditEventRecordType>> item, String componentId,
IModel<AuditEventRecordType> rowModel) {
AuditEventRecordType auditEventRecordType = (AuditEventRecordType) rowModel.getObject();
createReferenceColumn(auditEventRecordType.getTargetOwnerRef(), item, componentId);
}
};
columns.add(targetOwnerRefColumn);
}
IColumn<AuditEventRecordType, String> channelColumn = new PropertyColumn<AuditEventRecordType, String>(
createStringResource("AuditEventRecordType.channel"), "channel") {
private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -481,12 +525,4 @@ private void createReferenceColumn(ObjectReferenceType ref, Item item, String co
public WebMarkupContainer getFeedbackPanel() {
return (FeedbackPanel) get(pageBase.createComponentPath(ID_MAIN_FORM, ID_FEEDBACK));
}

protected boolean isTargetNameVisible(){
return true;
}

protected boolean isEventStageVisible(){
return true;
}
}
Expand Up @@ -3419,3 +3419,5 @@ PageXmlDataReview.title=Historical data
PageXmlDataReview.aceEditorPanelTitle='{0}' historical xml data {1}
PageLogin.selfRegistration=Sign up
PageSelfRegistration.registration.failed.unsatisfied.registration.configuration=Registration process not allowed. Please contact system administrator.
ObjectHistoryTabPanel.viewHistoricalObjectDataTitle=View object data
ObjectHistoryTabPanel.viewHistoricalObjectXmlTitle=View object xml

0 comments on commit ca18f03

Please sign in to comment.