Merge branch 'ticket/1' of ssh://dev.hostsharing.net:29418/hsadmin/hs.hsadmin.jee into ticket/1

This commit is contained in:
Michael Hierweck 2017-07-07 18:53:15 +02:00
commit 63ae4117cd
13 changed files with 163 additions and 30 deletions

View File

@ -18,3 +18,38 @@ und Ihrer Rolle für die Genossenschaft (technischer oder kaufmännischer Anspre
## pac
Das neue Paket-Modul ist in Entwicklung https://dev.hostsharing.net/doc/hsadmin!hs.hsadmin.jee.git/master/services!doc!package.md
## run locally
Alles bauen und Eclise Konfiguration erzeugen:
```bash
mvn clean install eclipse:clean eclipse
```
Backend auf localhost:8080 starten:
```bash
cd cust-services
# entweder:
mvn tomee:run
# oder:
mvn tomee:debug
```
Frontend auf localhost:8081 starten:
```bash
cd ../web
# entweder:
mvn tomcat7:run
# oder:
mvnDebug tomcat7:run
```
Sobald der Debugger unter dem in der Programmausgabe genannten Port verbunden ist, startet der Server.
Login unter http://localhost:8081/ mit ad/ad.
Im Webfrontend funktioniert natürlich nur der Customer-Teil,
weil sich die anderen Module im Legacy Backend befinden.

View File

@ -79,14 +79,14 @@ public class MemberShareService extends AbstractModule<MemberShareVO> implements
@RequiredScope({@ScopePolicy(Role.SYSTEM)})
public List<MemberShareVO> update(final RequestContext requestContext, final MemberShareVO criteria, final MemberShareVO prototype)
throws UserException, TechnicalException {
throw new TechnicalException(new NotImplementedException("MemberShares are immuatable"));
throw new TechnicalException(new NotImplementedException("MemberShares are immutable"));
}
@Override
@RequiredScope({@ScopePolicy(Role.SYSTEM)})
public void delete(final RequestContext requestContext, final MemberShareVO criteria)
throws UserException, TechnicalException {
throw new TechnicalException(new NotImplementedException("MemberShares are immuatable"));
throw new TechnicalException(new NotImplementedException("MemberShares are immutable"));
}
// macht diese Klasse Unit-testbar

View File

@ -101,8 +101,12 @@ public class PropertyInfo implements Serializable {
this.searchable = SearchPolicy.valueOf(searchable.toUpperCase());
}
public String getResourceId() {
return module + "." + name;
}
@Override
public String toString() {
return "PropertyInfo " + module + "." + name;
return "PropertyInfo " + getResourceId();
}
}

View File

@ -34,12 +34,20 @@ public class CustomerPanel extends CustomComponent implements IHSPanel, Selected
tabsheet.addSelectedTabChangeListener(this);
tabsheet.addSelectedTabChangeListener(this);
tabsheet.addTab(new GenericForm("customer", session, itemId, "name"), I18N.getText("customer"));
final HSTab usersTab = new HSTab("contact", session, "customer", itemId, "email");
usersTab.fillTable();
tabsheet.addTab(usersTab, I18N.getText("contact"));
HSTab aliasTab = new HSTab("mandat", session, "customer", itemId, "mandatRef");
final HSTab aliasTab = new HSTab("mandat", session, "customer", itemId, "mandatRef");
tabsheet.addTab(aliasTab, I18N.getText("mandat"));
HSTab pacTab = new HSTab("pac", session, "customer", itemId, "name");
final HSTab assetsTab = new HSTab("memberShare", session, "customer", itemId, "id");
assetsTab.getPanelToolbar().setUpdateEnabled(false);
assetsTab.getPanelToolbar().setDeleteEnabled(false);
tabsheet.addTab(assetsTab, I18N.getText("memberShare"));
final HSTab pacTab = new HSTab("pac", session, "customer", itemId, "name");
tabsheet.addTab(pacTab, I18N.getText("pac"));
return tabsheet;
}

View File

@ -50,6 +50,11 @@ public class GenericEditorFactory implements IEditorFactory, Serializable {
return getSelectFromRemote(action, propertyInfo, session, "postgresqluser", whereContext);
}
}
if ("memberShare".equals(module)) {
if ("action".equals(inputName)) {
return getMemberShareActionEditor(action, propertyInfo, session, whereContext);
}
}
return getEditor(action, propertyInfo);
}
@ -58,6 +63,13 @@ public class GenericEditorFactory implements IEditorFactory, Serializable {
return PanelToolbar.ACTION_EDIT.equals(action) ? new DomainOptionsEditor(propertyInfo, session, whereContext) : new NullEditor();
}
private IHSEditor getMemberShareActionEditor(String action, PropertyInfo propertyInfo, HSAdminSession session, Map<String, String> whereContext) {
final String[] items = new String[] { "SUBSCRIPTION", "UNSUBSCRIPTION" };
final HSSelect field = new HSSelect(propertyInfo, 0, Arrays.asList(items));
field.setWidth("100%");
field.setEnabled(isWriteAble(propertyInfo, action));
return field;
}
private IHSEditor getEMailTargetEditor(final String action, final PropertyInfo propertyInfo, final HSAdminSession session, final Map<String, String> whereContext)
{
@ -75,6 +87,9 @@ public class GenericEditorFactory implements IEditorFactory, Serializable {
if ("shell".equals(inputName)) {
return getShellSelect(action, propertyInfo);
}
if ("date".equals(inputName)) {
return getDateSelect(action, propertyInfo);
}
final String module = propertyInfo.getModule();
if ("user".equals(module) || "emailalias".equals(module)) {
if ("name".equals(inputName)) {
@ -99,7 +114,7 @@ public class GenericEditorFactory implements IEditorFactory, Serializable {
private IHSEditor getSelectField(final String action, final PropertyInfo propertyInfo, final String... items)
{
final HSSelect field = new HSSelect(propertyInfo.getName(), Arrays.asList(items));
final HSSelect field = new HSSelect(propertyInfo, 0, Arrays.asList(items));
field.setWidth("100%");
field.setEnabled(isWriteAble(propertyInfo, action));
return field;
@ -108,7 +123,7 @@ public class GenericEditorFactory implements IEditorFactory, Serializable {
private IHSEditor getPacPrefixedField(final String action, final PropertyInfo propertyInfo, final char delimiter)
{
final HSPacPrefixedField field = new HSPacPrefixedField(propertyInfo.getName(), delimiter);
final HSPacPrefixedField field = new HSPacPrefixedField(propertyInfo, delimiter);
field.setWidth("100%");
field.setValue("xyz00-");
enableAndValidate(action, propertyInfo, field);
@ -118,7 +133,15 @@ public class GenericEditorFactory implements IEditorFactory, Serializable {
private IHSEditor getShellSelect(final String action, final PropertyInfo propertyInfo)
{
final String[] items = new String[] { "/bin/false", "/bin/bash", "/bin/csh", "/bin/dash", "/bin/ksh", "/bin/tcsh", "/bin/zsh", "/usr/bin/passwd", "/usr/bin/scponly" };
final HSSelect field = new HSSelect(propertyInfo.getName(), 7, Arrays.asList(items));
final HSSelect field = new HSSelect(propertyInfo, 7, Arrays.asList(items));
field.setWidth("100%");
field.setEnabled(isWriteAble(propertyInfo, action));
return field;
}
private IHSEditor getDateSelect(final String action, final PropertyInfo propertyInfo)
{
final HSDateSelect field = new HSDateSelect(propertyInfo);
field.setWidth("100%");
field.setEnabled(isWriteAble(propertyInfo, action));
return field;
@ -142,7 +165,7 @@ public class GenericEditorFactory implements IEditorFactory, Serializable {
// TODO Auto-generated catch block
e.printStackTrace();
}
final HSSelect field = new HSSelect(propertyInfo.getName(), selectList);
final HSSelect field = new HSSelect(propertyInfo, 0, selectList);
field.setEnabled(isWriteAble(propertyInfo, action));
field.setWidth("100%");
return field;
@ -158,7 +181,7 @@ public class GenericEditorFactory implements IEditorFactory, Serializable {
private IHSEditor getTextField(final String action, final PropertyInfo propertyInfo)
{
final HSTextField field = new HSTextField(propertyInfo.getName());
final HSTextField field = new HSTextField(propertyInfo);
field.setWidth("100%");
enableAndValidate(action, propertyInfo, field);
return field;

View File

@ -0,0 +1,26 @@
package de.hsadmin.web;
import java.util.Map;
import com.vaadin.data.util.converter.StringToDateConverter;
import com.vaadin.ui.DateField;
import de.hsadmin.rpc.PropertyInfo;
public class HSDateSelect extends DateField implements IHSEditor {
private static final long serialVersionUID = 1L;
private String field;
public HSDateSelect(PropertyInfo propertyInfo) {
super(I18N.getText(propertyInfo.getResourceId()));
field = propertyInfo.getName();
setConverter(StringToDateConverter.class);
}
@Override
public void setValues(Map<String, Object> valuesMap) {
setConvertedValue( valuesMap.get(field) );
}
}

View File

@ -2,6 +2,8 @@ package de.hsadmin.web;
import java.util.Map;
import de.hsadmin.rpc.PropertyInfo;
public class HSPacPrefixedField extends HSTextField implements PacNamePrefixed {
@ -11,8 +13,8 @@ public class HSPacPrefixedField extends HSTextField implements PacNamePrefixed {
private String pacName;
public HSPacPrefixedField(final String name, final char delimiter) {
super(name);
public HSPacPrefixedField(final PropertyInfo propertyInfo, final char delimiter) {
super(propertyInfo);
pacName = "xyz00";
this.delimiter = delimiter;
addValidator(new PacNamePrefixValidator(this));

View File

@ -5,19 +5,17 @@ import java.util.Map;
import com.vaadin.ui.NativeSelect;
import de.hsadmin.rpc.PropertyInfo;
public class HSSelect extends NativeSelect implements IHSEditor {
private static final long serialVersionUID = 1L;
private final String propertyName;
public HSSelect(final String label, final List<String> values) {
this(label, 0, values);
}
public HSSelect(final String label, final int defaultIndex, final List<String> values) {
super(I18N.getText(label));
this.propertyName = label;
public HSSelect(final PropertyInfo propertyInfo, final int defaultIndex, final List<String> values) {
super(I18N.getText(propertyInfo.getResourceId()));
this.propertyName = propertyInfo.getName();
super.addItems(values);
if (values != null && values.size() > defaultIndex) {
super.setValue(values.get(defaultIndex));

View File

@ -32,7 +32,7 @@ public class HSTab extends CustomComponent {
private final Object selectPropertyValue;
private final String selectPropertyName;
private final String rowIdPropertyName;
private final HorizontalLayout panelToolbar;
private final PanelToolbar panelToolbar;
private Table grid;
@ -166,4 +166,8 @@ public class HSTab extends CustomComponent {
return selectPropertyName;
}
public PanelToolbar getPanelToolbar() {
return panelToolbar;
}
}

View File

@ -4,15 +4,17 @@ import java.util.Map;
import com.vaadin.ui.TextField;
import de.hsadmin.rpc.PropertyInfo;
public class HSTextField extends TextField implements IHSEditor {
private static final long serialVersionUID = 1L;
private final String propertyName;
public HSTextField(final String name) {
super(I18N.getText(name));
this.propertyName = name;
public HSTextField(final PropertyInfo propertyInfo) {
super(I18N.getText(propertyInfo.getResourceId()));
this.propertyName = propertyInfo.getName();
}
@Override

View File

@ -7,14 +7,29 @@ public class I18N {
private static final ResourceBundle TEXTS = ResourceBundle.getBundle("de.hsadmin.web.main");
public static String getText(final String textProperty) {
String textValue;
try{
textValue = I18N.TEXTS.getString(textProperty);
}catch(MissingResourceException e){
textValue = "./. " + textProperty;
/**
* Loads a String resource from the *.properties files.
*
* @param optionallyQualifiedTextProperty
* ID of the resource, optionally qualified module the module name,
* e.g. "customer.name" (preferred) or simply "name" (legacy).
* @return the String resource, e.g. a label or message, usually to be displayed to the user
*/
public static String getText(final String optionallyQualifiedTextProperty) {
String textValue = getTextImpl(optionallyQualifiedTextProperty);
return textValue != null ? textValue : "./. " + optionallyQualifiedTextProperty;
}
public static String getTextImpl(final String optionallyQualifiedTextProperty) {
try {
return I18N.TEXTS.getString(optionallyQualifiedTextProperty);
} catch(MissingResourceException e1) {
String[] parts = optionallyQualifiedTextProperty.split(".", 2);
if ( parts.length > 1 ) {
return getTextImpl(parts[1]);
}
}
return textValue;
return null;
}
}

View File

@ -126,4 +126,14 @@ public class PanelToolbar extends HorizontalLayout implements ClickListener {
}
}
public void setUpdateEnabled(boolean updateEnabled) {
editBtn.setEnabled(updateEnabled);
}
public void setDeleteEnabled(boolean deleteEnabled) {
deleteBtn.setEnabled(deleteEnabled);
}
}

View File

@ -80,6 +80,12 @@ contact=Ansprechpartner
cancel=abbrechen
ok=Ok
mandat=SEPA-Mandat
memberShare=Geschäftsanteile
memberShare.customer=Mitglieds-Kennung
memberShare.action=Buchungstyp
memberShare.date=Buchungsdatum
memberShare.quantity=Anzahl
memberShare.comment=Kommentar
password=Passwort
login.title=Anmeldung
login.button=anmelden