@Override public String asChars(final DocumentAbstract<?> document) { final FactoryService factoryService = document.factoryService; final Clob clob = factoryService.mixin(Document_downloadExternalUrlAsClob.class, document).$$(); final CharSequence chars = clob.getChars(); return chars instanceof String ? (String) chars : chars.toString(); } };
@Override public String asChars(final DocumentAbstract<?> document) { final FactoryService factoryService = document.factoryService; final Clob clob = factoryService.mixin(Document_downloadExternalUrlAsClob.class, document).$$(); final CharSequence chars = clob.getChars(); return chars instanceof String ? (String) chars : chars.toString(); } };
public Object getValueForDatastoreMapping(NucleusContext nucleusCtx, int index, Object value) { Clob clob = ((Clob)value); switch (index) { case 0: return clob.getName(); case 1: return clob.getMimeType().getBaseType(); case 2: return clob.getChars(); } throw new IndexOutOfBoundsException(); }
@Override public String toString() { return getName() + " [" + getMimeType().getBaseType() + "]: " + getChars().length() + " chars"; }
private static IResourceStream resourceStreamFor(final Clob clob) { final IResourceStream resourceStream = new StringResourceStream(clob.getChars(), clob.getMimeType().toString()); return resourceStream; }
private static IResourceStream resourceStreamFor(final Clob clob) { final IResourceStream resourceStream = new StringResourceStream(clob.getChars(), clob.getMimeType().toString()); return resourceStream; }
@Action( semantics = SemanticsOf.IDEMPOTENT, domainEvent = ActionDomainEvent.class ) @ActionLayout(contributed = Contributed.AS_ACTION) public DocumentTemplate $$( @ParameterLayout(named = "File") final Clob clob ) { documentTemplate.setMimeType(clob.getMimeType().toString()); documentTemplate.setClobChars(clob.getChars().toString()); return documentTemplate; }
@Action( semantics = SemanticsOf.IDEMPOTENT, domainEvent = ActionDomainEvent.class ) @ActionLayout(contributed = Contributed.AS_ACTION) public DocumentTemplate $$( @ParameterLayout(named = "File") final Clob clob ) { documentTemplate.setMimeType(clob.getMimeType().toString()); documentTemplate.setClobChars(clob.getChars().toString()); return documentTemplate; }
@Programmatic public void modifyClob(Clob clob) { setName(clob.getName()); setMimeType(clob.getMimeType().toString()); setClobChars(clob.getChars().toString()); setSort(DocumentSort.CLOB); }
@Programmatic public void modifyClob(Clob clob) { setName(clob.getName()); setMimeType(clob.getMimeType().toString()); setClobChars(clob.getChars().toString()); setSort(DocumentSort.CLOB); }
@Test public void when_clob_is_not_null() { final Clob val = new Clob("image.png", "image/png", new char[]{1,2,3,4,5}); CommonDtoUtils.setValueOn(valueDto, ValueType.CLOB, val, mockBookmarkService); final ClobDto clobDto = valueDto.getClob(); Assert.assertThat(clobDto, is(notNullValue())); Assert.assertThat(clobDto.getChars(), is(val.getChars())); Assert.assertThat(clobDto.getName(), is(val.getName())); Assert.assertThat(clobDto.getMimeType(), is(val.getMimeType().toString())); } }
public void setObject(ExecutionContext ec, PreparedStatement preparedStmt, int[] exprIndex, Object value) { Clob clob = ((Clob)value); if (clob == null) { getDatastoreMapping(0).setObject(preparedStmt, exprIndex[0], null); getDatastoreMapping(1).setObject(preparedStmt, exprIndex[1], null); getDatastoreMapping(2).setObject(preparedStmt, exprIndex[2], null); } else { getDatastoreMapping(0).setString(preparedStmt, exprIndex[0], clob.getName()); getDatastoreMapping(1).setString(preparedStmt, exprIndex[1], clob.getMimeType().getBaseType()); getDatastoreMapping(2).setObject(preparedStmt, exprIndex[2], clob.getChars().toString()); } }
@Test public void testEncode_and_decode() { String encoded = value.toEncodedString(clob); assertEquals("myfile1.xml:application/xml:abcdef", encoded); Clob decoded = value.fromEncodedString(encoded); assertThat(decoded.getName(), is("myfile1.xml")); assertThat(decoded.getMimeType().getPrimaryType(), is("application")); assertThat(decoded.getMimeType().getSubType(), is("xml")); assertThat(decoded.getChars(), is((CharSequence)"abcdef")); }
final ClobDto clobDto = new ClobDto(); clobDto.setName(clob.getName()); clobDto.setChars(clob.getChars().toString()); clobDto.setMimeType(clob.getMimeType().toString()); valueDto.setClob(clobDto);