Skip to content

Commit

Permalink
Merge branch 'master' into feature/update-testing-libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
joerghoh authored Jan 18, 2020
2 parents d478123 + c6a4417 commit dc01443
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 11 deletions.
7 changes: 3 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ after the 3.9.0 release. All changes up until the 3.9.0 release can be found in
The format is based on [Keep a Changelog](http://keepachangelog.com)

## Unreleased ([details][unreleased changes details])

### Fixed
- #2146 - POI exception generating Excel file with too many references

<!-- Keep this up to date! After a release, change the tag name to the latest release -->
[unreleased changes details]: https://github.com/Adobe-Consulting-Services/acs-aem-commons/compare/acs-aem-commons-4.3.2...HEAD

Expand All @@ -18,10 +14,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com)
### Fixed
- #2082 - ETag filter never sends 304
- #2148 - Bugfix for displaying sizes (adresses #2132)
- #2146 - POI exception generating Excel file with too many references

### Changed
- #2164 - Adding support for page create dialog to content model framework (aka dialog resource provider)
- #2133 - Update test library dependencies


## [4.4.0] - 2019-12-17

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@
package com.adobe.acs.commons.mcp.form;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.StreamSupport;
import org.apache.commons.lang3.StringUtils;
import org.apache.sling.api.resource.AbstractResource;
import org.apache.sling.api.resource.ModifiableValueMap;
Expand Down Expand Up @@ -128,10 +130,10 @@ public Resource getChild(String relPath) {
if (current == null) {
return null;
}
} else if (current.getChild(name) == null) {
return null;
} else {
current = current.getChild(name);
return StreamSupport.stream(getChildren().spliterator(), false)
.filter(r->r.getName().equals(name))
.findFirst().orElse(null);
}
}
return current;
Expand Down Expand Up @@ -163,7 +165,11 @@ public boolean hasChildren() {

@Override
public boolean isResourceType(String type) {
return Objects.equals(getResourceType(), type);
if (getResourceResolver() != null) {
return getResourceResolver().isResourceType(this, type);
} else {
return Objects.equals(getResourceType(), type);
}
}

public void setPath(String path) {
Expand All @@ -177,7 +183,8 @@ public String getPath() {

@Override
public String getResourceType() {
return type;
Object t = meta.get("sling:resourceType");
return t == null ? null : String.valueOf(t);
}

@Override
Expand Down Expand Up @@ -214,4 +221,11 @@ public void disableMergeResourceProvider() {
getResourceMetadata().put("sling:hideChildren", "*");
children.forEach(c -> ((AbstractResourceImpl) c).disableMergeResourceProvider());
}

public Map<String, Object> convertTreeToMap() {
HashMap<String, Object> out = new HashMap<>();
out.putAll(meta);
children.forEach(c -> out.put(c.getName(), ((AbstractResourceImpl) c).convertTreeToMap()));
return out;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public final void setup(String name, AccessibleObject fieldOrMethod, FormField f
componentMetadata.put("required", formField.required());
}
componentMetadata.put("emptyText", formField.hint());
if (formField.showOnCreate()) {
componentMetadata.put("cq:showOnCreate", true);
}

Optional<String> defaultValue = getOption("default");
if (!defaultValue.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void init() {

@Override
public Resource buildComponentResource() {
getComponentMetadata().put(CLASS, getClass());
getComponentMetadata().put(CLASS, getCssClass());
return super.buildComponentResource();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@

String[] options() default {};

boolean showOnCreate() default true;

public static class Factory {
private Factory() {
// Factory cannot be instantiated
Expand Down Expand Up @@ -95,6 +97,11 @@ public String[] options() {
public Class<? extends Annotation> annotationType() {
return null;
}

@Override
public boolean showOnCreate() {
return true;
}
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/**
* Form components for MCP
*/
@Version("5.0.0")
@Version("5.1.0")
package com.adobe.acs.commons.mcp.form;

import org.osgi.annotation.versioning.Version;
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ public Class<? extends FieldComponent> component() {
public String[] options() {
return options;
}

public boolean showOnCreate() {
return true;
}
};
setup("test", null, field, null);
}
Expand Down

0 comments on commit dc01443

Please sign in to comment.