Command implements Serializable { public String getRelativeUri(String input) { int iFirstQ = StringUtils.indexOf(input, "?"); final String searchSeq = (iFirstQ != StringUtils.INDEX_NOT_FOUND) ? StringUtils.substring(input, 0, iFirstQ) : input; if(!StringUtils.contains(searchSeq, Constants.SEGMENT_PLATFORM_MARKER.code)) { String prefix = buildUri(Type.PlatformMarker) + getRootDomainUri(); return prefix + input; } if(StringUtils.startsWith(input, Constants.SEGMENT_PLATFORM_MARKER.code)) { String prefix = buildUri(Type.AppAlias); return prefix + input; } return input; } Command(String absoluteUri);  Command(Command source); CollectionsTemplate<List<Behavior>, Behavior> templateBehaviors(); void validate(); boolean isRootDomainOnly(); CommandElementLinked root(); boolean isEvent(); Command createRootDomainCommand(); String getAliasUri(Type type); RefId<?> getRefId(Type type); String getAbsoluteUri(Type type); String getAlias(Type type); Optional<CommandElementLinked> getElement(Type type); CommandElementLinked getElementSafely(Type type); String getRelativeUri(String input); boolean isView(); String getAppAlias(); String getRootClientAlias(); CommandElement getRootDomainElement(); String getRootDomainAlias(); String getRootDomainUri(); String getAbsoluteDomainAlias(); String getAbsoluteDomainUri(); String getProcessAlias(); String getProcessUri(); String getAbsoluteAlias(); String getAbsoluteAliasWithAction(); String getAbsoluteAliasTillRootDomain(); String buildAlias(CommandElementLinked startElem); String buildAlias(Type endWhentype); String buildAlias(CommandElementLinked startElem, Type endWhentype); String buildUri(CommandElementLinked startElem); String buildUri(Type endWhenType); String buildUri(CommandElementLinked startElem, Type endWhenType); String traverseElements(CommandElementLinked startElem, BiConsumer<CommandElement, StringBuilder> cb); void traverseElements(CommandElementLinked startElem, Consumer<CommandElement> cb); String traverseElements(CommandElementLinked startElem, Type type, BiConsumer<CommandElement, StringBuilder> cb); void traverseElements(CommandElementLinked startElem, Type type, Consumer<CommandElement> cb); CommandElementLinked createRoot(Type type, String uri); String toUri(); String toRemoteUri(Type endWhenType, Action withAction, Behavior withBehavior); String[] getParameterValue(String requestParameter); String getFirstParameterValue(String requestParameter); boolean hasRawPayload(); String getRawPayload(); boolean containsFunction();  }
@Test public void t0_relativeUri_complete() { Command in = CommandBuilder.withUri("/anthem/fep/icr/p/umcase_view/pageCreateCaseInfo/tileCreateCaseInfo/sectionUMCaseInfo/formUMCaseInfo/_get").getCommand(); String configUri = "/anthem/fep/icr/p/staticCodeValue/_search?fn=lookup&where=staticCodeValue.paramCode.eq('/requestType')"; String out = in.getRelativeUri(configUri); assertEquals(configUri, out); }
@Test public void t0_relativeUri_domainRoot_provided_1() { Command in = CommandBuilder.withUri("/anthem/fep/icr/p/umcase_view/pageCreateCaseInfo/tileCreateCaseInfo/sectionUMCaseInfo/formUMCaseInfo/_get").getCommand(); String configUri = "/p/staticCodeValue/_search?fn=lookup&where=staticCodeValue.paramCode.eq('/requestType')"; String out = in.getRelativeUri(configUri); System.out.println(out); assertEquals("/anthem/fep/icr"+configUri, out); }
@Test public void t0_relativeUri_domainRoot_provided_2() { Command in = CommandBuilder.withUri("/anthem/fep/icr/p/umcase_view:100/pageCreateCaseInfo/tileCreateCaseInfo/sectionUMCaseInfo/formUMCaseInfo/_get").getCommand(); String configUri = "/p/staticCodeValue:200/_search?fn=lookup&where=staticCodeValue.paramCode.eq('/requestType')"; String out = in.getRelativeUri(configUri); System.out.println(out); assertEquals("/anthem/fep/icr"+configUri, out); }
@Test public void t0_relativeUri_domainRoot_relative_1() { Command in = CommandBuilder.withUri("/anthem/fep/icr/p/umcase_view/pageCreateCaseInfo/tileCreateCaseInfo/sectionUMCaseInfo/formUMCaseInfo/_get").getCommand(); String configUri = "/_search?fn=lookup&where=staticCodeValue.paramCode.eq('/requestType')"; String out = in.getRelativeUri(configUri); System.out.println(out); assertEquals("/anthem/fep/icr/p/umcase_view"+configUri, out); }
@Test public void t0_relativeUri_domainRoot_relative_2() { Command in = CommandBuilder.withUri("/anthem/fep/icr/p/umcase_view:100/pageCreateCaseInfo/tileCreateCaseInfo/sectionUMCaseInfo/formUMCaseInfo/_get").getCommand(); String configUri = "/_search?fn=lookup&where=staticCodeValue.paramCode.eq('/requestType')"; String out = in.getRelativeUri(configUri); System.out.println(out); assertEquals("/anthem/fep/icr/p/umcase_view:100"+configUri, out); }