Manual actions are mindnumbing for developers all over the world. On top of that, developers want to automate about everything.
AEMAdmin started out of frustration of having to delete several nodes in the repository manually after every deploy on my localbox. I wanted an error-free 1-click operation. So I defined the steps just once and let the program run over and over again.
In the meantime, it kept on growing and it now is a fullblown library with all kind of actions for property, node and page manipulations, querying, and so on. All commands follow the same structure and when testing is finished, you can point it to a different environment to execute the same tasks in the same order.
In this talk, I'll tell about the story how it came to be and how real-life challenges made the project grow. So expect a lot of live action and maybe some deja-vus.
17. public QueryCommand addCondition(String key,String value)
public QueryCommand setHitLimit(int limit)
public QueryCommand fullHit()
public QueryCommand propertyExists(String prefix,
String propertyName)
public int getResults()
public int getTotal()
public boolean hasMore()
19. /**
* Queries return JSON with an array called hits. This method will pro
* @param hit the result to process
*/
public abstract void postProcessOneResult(JSONObject hit);
21. LOOP OVER HITSLOOP OVER HITS
public class DifferentStatusValuesCommand extends QueryPostPro
private Set<string> statuses;
public DifferentStatusValuesCommand(WorkflowInstancesQuery
super(command);
statuses = new HashSet<>();
}
@Override
public void postProcessOneResult(JSONObject hit) {
statuses.add(hit.getString("status"));
}
public Set<string> getStatuses() {
return statuses;
}
}
23. CompositeCommand cc = new CompositeCommand();
//Enable crx/de
EnableCrxCommand ecc = new EnableCrxCommand();
cc.add(ecc);
BulkPackageInstallCommand bpic = new BulkPackageInstallCommand
//One off packages for a fresh install
bpic.addPackage("D:packages_to_installacs-aem-commons-cont
.addPackage("D:packages_to_installacs-aem-tools-content-0.
.addPackage("D:packages_to_installAEM-6.3-Service-Pack-1-6
.addPackage("D:packages_to_installcq-6.3.0-hotfix-19148-1.
.addPackage("D:packages_to_installContent_auth_PROD_CRQ000
.addPackage("D:packages_to_installContent_auth_PROD_CRQ000
.addPackage("D:packages_to_installpermissions.zip")
.addPackage("D:packages_to_installnprd_userGroups.zip");
//install the Java code