sap.prd.cmintegration.cli.GetTransportDescription Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ci-integration-cli Show documentation
Show all versions of ci-integration-cli Show documentation
SAP Change Management Integration
package sap.prd.cmintegration.cli;
import static java.lang.String.format;
import static sap.prd.cmintegration.cli.Commands.Helpers.getCommandName;
import java.util.function.Predicate;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sap.ai.st.cm.plugins.ciintegration.odataclient.CMODataTransport;
/**
* Command for retrieving the description of a transport.
*/
@CommandDescriptor(name="get-transport-description")
class GetTransportDescription extends TransportRelated {
final static private Logger logger = LoggerFactory.getLogger(GetTransportDescription.class);
GetTransportDescription(String host, String user, String password, String changeId, String transportId) {
super(host, user, password, changeId, transportId);
}
@Override
protected Predicate getOutputPredicate() {
return it -> {
String description = it.getDescription();
if(StringUtils.isBlank(description)) {
logger.debug(format("Description of transport '%s' is blank. Nothing will be emitted.", it.getTransportID()));
return false;
} else {
logger.debug(format("Description of transport '%s' is not blank. Description '%s' will be emitted.", it.getTransportID(), it.getDescription()));
System.out.println(description);
return true;}
};
}
public final static void main(String[] args) throws Exception {
logger.debug(format("%s called with arguments: '%s'.", GetTransportDescription.class.getSimpleName(), Commands.Helpers.getArgsLogString(args)));
TransportRelated.main(GetTransportDescription.class, args,
format("%s ", getCommandName(GetTransportDescription.class)),
"Returns the description for the transport represented by , .");
}
}