use of org.walkmod.WalkModFacade in project walkmod-core by walkmod.
the class PrintTransformationsCommand method execute.
@Override
public void execute() throws Exception {
if (help) {
command.usage("transformations");
} else {
if (chain == null) {
chain = new LinkedList<String>();
}
if (chain.isEmpty()) {
chain.add("default");
}
WalkModFacade facade = new WalkModFacade(OptionsBuilder.options());
Configuration cfg = facade.getConfiguration();
if (cfg != null) {
Collection<ChainConfig> chains = cfg.getChainConfigs();
if (chains != null) {
Iterator<ChainConfig> it = chains.iterator();
ChainConfig selected = null;
while (it.hasNext() && selected == null) {
ChainConfig current = it.next();
if (current.getName().equals(chain.get(0))) {
selected = current;
}
}
if (selected != null) {
at = new V2_AsciiTable();
at.addRule();
at.addRow("TRANSFORMATION TYPE", "PARAMETERS", "NAME/ALIAS");
at.addStrongRule();
List<TransformationConfig> transformations = selected.getWalkerConfig().getTransformations();
if (transformations != null) {
for (TransformationConfig transf : transformations) {
Map<String, Object> parameters = transf.getParameters();
if (parameters == null || parameters.isEmpty()) {
at.addRow(transf.getType(), "", transf.getName());
} else {
Set<String> keys = parameters.keySet();
int i = 0;
for (String key : keys) {
if (i == 0) {
String name = transf.getName();
if (name == null) {
name = "";
}
at.addRow(transf.getType(), "-" + key + ":" + parameters.get(key), "");
} else {
at.addRow("", "-" + key + ":" + parameters.get(key), "");
}
i++;
}
}
at.addRule();
}
}
}
}
} else {
log.error("Sorry, the current directory does not contain a walkmod configuration file or it is invalid.");
at = new V2_AsciiTable();
at.addRule();
at.addRow("TRANSFORMATION TYPE", "PARAMETERS", "NAME/ALIAS");
at.addStrongRule();
at.addRule();
}
}
}
use of org.walkmod.WalkModFacade in project walkmod-core by walkmod.
the class RemoveChainCommand method execute.
@Override
public void execute() throws Exception {
if (help) {
jcommander.usage("rm-chain");
} else {
WalkModFacade facade = new WalkModFacade(OptionsBuilder.options().printErrors(printErrors));
facade.removeChains(chains, recursive);
}
}
use of org.walkmod.WalkModFacade in project walkmod-core by walkmod.
the class RemoveExcludesCommand method execute.
@Override
public void execute() throws Exception {
if (help) {
jcommander.usage("rm-excludes");
} else {
WalkModFacade facade = new WalkModFacade(OptionsBuilder.options().printErrors(printErrors));
facade.removeExcludesToChain(chain, excludes, recursive, setToReader, setToWriter);
}
}
use of org.walkmod.WalkModFacade in project walkmod-core by walkmod.
the class RemoveProviderCommand method execute.
@Override
public void execute() throws Exception {
if (help) {
command.usage("rm-provider");
} else {
WalkModFacade facade = new WalkModFacade(OptionsBuilder.options().printErrors(printErrors));
facade.removeProviders(providers, recursive);
}
}
use of org.walkmod.WalkModFacade in project walkmod-core by walkmod.
the class PatchCommand method execute.
@Override
public void execute() throws Exception {
if (isHelpNeeded()) {
command.usage("patch");
} else {
Map<String, String> dynParams = getDynamicParams();
dynParams.put("patchPerFile", Boolean.toString(patchPerFile));
dynParams.put("patchPerChange", Boolean.toString(patchPerChange));
dynParams.put("patchFormat", patchFormat);
WalkModFacade facade = new WalkModFacade(buildOptions());
String[] params = new String[getParameters().size()];
if (params.length == 0) {
facade.patch();
} else {
facade.patch(getParameters().toArray(params));
}
}
}
Aggregations