Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Nov 23, 2016
2 parents bdcec92 + b18696f commit 539c5c9
Show file tree
Hide file tree
Showing 8 changed files with 426 additions and 55 deletions.
Expand Up @@ -226,8 +226,8 @@
</div>
</div>
</div>

</div>
<div class="row" wicket:id="metadataContainer"></div>
</div>
</div>
</wicket:panel>
</html>
Expand Up @@ -130,6 +130,7 @@ public class AssignmentEditorPanel extends BasePanel<AssignmentEditorDto> {
private static final String ID_ORG_CHOOSER = "orgRefChooser";
private static final String ID_BUTTON_SHOW_MORE = "errorLink";
private static final String ID_ERROR_ICON = "errorIcon";
private static final String ID_METADATA_CONTAINER = "metadataContainer";

private IModel<List<ACAttributeDto>> attributesModel;
protected WebMarkupContainer headerRow;
Expand Down Expand Up @@ -539,6 +540,20 @@ public void onClick(AjaxRequestTarget target) {

initAttributesLayout(constructionContainer);

MetadataPanel metadataPanel = new MetadataPanel(ID_METADATA_CONTAINER, new AbstractReadOnlyModel<MetadataType>() {
@Override
public MetadataType getObject() {
return getModel().getObject().getOldValue().getValue().getMetadata();
}
});
metadataPanel.add(new VisibleEnableBehaviour(){
@Override
public boolean isVisible(){
return !UserDtoStatus.ADD.equals(getModel().getObject().getStatus());
}
});
body.add(metadataPanel);

addAjaxOnUpdateBehavior(body);
}

Expand Down
@@ -0,0 +1,47 @@
<!--
~ Copyright (c) 2010-2016 Evolveum
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div wicket:id="metadataBlock">
<div class="container-fluid prism-container">

<div class="row prism-header">
<span class="prism-title"><wicket:message key="AssignmentEditorPanel.metadataBlock"/></span>
</div>
<div class="prism-properties">

<div wicket:id="metadataRow">
<div class="row prism-property">
<div class="col-xs-4">
<div wicket:id="metadataPropertyKey"/>
</div>
<div class="col-xs-8">
<div class="row">
<div class="col-xs-9">
<div wicket:id="metadataField"/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

</wicket:panel>
</html>
@@ -0,0 +1,105 @@
/*
* Copyright (c) 2010-2016 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.evolveum.midpoint.web.component.assignment;

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.xml.ns._public.common.common_3.MetadataType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;

import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
* Created by honchar.
*/
public class MetadataPanel extends BasePanel<MetadataType>{

private List<QName> metadataFieldsList = Arrays.asList(MetadataType.F_REQUEST_TIMESTAMP, MetadataType.F_REQUESTOR_REF,
MetadataType.F_CREATE_TIMESTAMP, MetadataType.F_CREATOR_REF,
MetadataType.F_CREATE_APPROVAL_TIMESTAMP, MetadataType.F_CREATE_APPROVER_REF,
MetadataType.F_MODIFY_TIMESTAMP, MetadataType.F_MODIFIER_REF,
MetadataType.F_MODIFY_APPROVAL_TIMESTAMP, MetadataType.F_MODIFY_APPROVER_REF);

private static final String ID_METADATA_BLOCK = "metadataBlock";
private static final String ID_METADATA_ROW = "metadataRow";
private static final String ID_METADATA_PROPERTY_KEY = "metadataPropertyKey";
private static final String ID_METADATA_FILED = "metadataField";
private static final String DOT_CLASS = MetadataPanel.class.getSimpleName() + ".";

public MetadataPanel(String id, IModel<MetadataType> model){
super(id, model);
initLayout();
}

private void initLayout(){
WebMarkupContainer metadataBlock = new WebMarkupContainer(ID_METADATA_BLOCK);
metadataBlock.setOutputMarkupId(true);
add(metadataBlock);

RepeatingView metadataRowRepeater = new RepeatingView(ID_METADATA_ROW);
metadataBlock.add(metadataRowRepeater);
for (QName qname : metadataFieldsList){
WebMarkupContainer metadataRow = new WebMarkupContainer(metadataRowRepeater.newChildId());
metadataRow.setOutputMarkupId(true);
metadataRowRepeater.add(metadataRow);

metadataRow.add(new Label(ID_METADATA_PROPERTY_KEY, createStringResource(DOT_CLASS + qname.getLocalPart())));
metadataRow.add(new Label(ID_METADATA_FILED,
new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
PropertyModel<Object> tempModel = new PropertyModel<Object>(getModel(),
qname.getLocalPart());
if (tempModel.getObject() instanceof XMLGregorianCalendar){
return WebComponentUtil.getLocalizedDate((XMLGregorianCalendar)tempModel.getObject(),
DateLabelComponent.MEDIUM_SHORT_STYLE);
} else if (tempModel.getObject() instanceof ObjectReferenceType){
ObjectReferenceType ref = (ObjectReferenceType) tempModel.getObject();
return WebComponentUtil.getName(ref);
} else if (tempModel.getObject() instanceof List){
List list = (List) tempModel.getObject();
String result = "";
for (Object o : list){
if (o instanceof ObjectReferenceType){
if (result.length() > 0){
result += ", ";
}
result += WebComponentUtil.getName((ObjectReferenceType) o);
}
}
return result;
}
return "";
}
}));

}


}
}
Expand Up @@ -59,6 +59,17 @@ AssignmentEditorPanel.targetError=Assignment target was not found. Either target
AssignmentEditorPanel.target=Target
AssignmentEditorPanel.tenantRef=Tenant
AssignmentEditorPanel.undefined=Undefined
AssignmentEditorPanel.metadataBlock=Metadata
MetadataPanel.requestTimestamp=Request timestamp
MetadataPanel.requestorRef=Requester
MetadataPanel.createTimestamp=Create timestamp
MetadataPanel.creatorRef=Creator
MetadataPanel.createApproverRef=Create approver
MetadataPanel.createApprovalTimestamp=Create Approval Timestamp
MetadataPanel.modifyTimestamp=Modify timestamp
MetadataPanel.modifierRef=Modifier
MetadataPanel.modifyApproverRef=Modify approver
MetadataPanel.modifyApprovalTimestamp=Modify approval timestamp
DelegationEditorPanel.from=From
DelegationEditorPanel.to=To
DelegationEditorPanel.meLabel=Me
Expand Down Expand Up @@ -3444,4 +3455,4 @@ PageAbstractSelfCredentials.save.password.failed=Failed to change password: {0}
PageResetPassword.title=Reset password
PageResetPasswordConfirmation=Reset password confirmation
PageResetPasswordConfirmation.confirmation.error=Reset password is not allowed. We are sorry, but probably you'll need to contact system administrator.
PageResetPasswordConfirmation.authnetication.failed=Incorrect username and/or password
PageResetPasswordConfirmation.authnetication.failed=Incorrect username and/or password
Expand Up @@ -12218,6 +12218,7 @@
</xsd:annotation>
<xsd:sequence>
<xsd:element name="maxAge" type="xsd:duration" minOccurs="0"/>
<xsd:element name="maxRecords" type="xsd:int" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>

Expand Down

0 comments on commit 539c5c9

Please sign in to comment.