public LinksBuilder( ValueBuilderFactory vbf ) { this.vbf = vbf; linksBuilder = vbf.newValueBuilder( Links.class ); linkBuilder = vbf.newValueBuilder( Link.class ); }
public TableBuilder(ValueBuilderFactory vbf) { this.vbf = vbf; tableBuilder = vbf.newValueBuilder(Table.class); }
public QueryBuilder( ValueBuilderFactory vbf ) { queryBuilder = vbf.newValueBuilder( TableQuery.class ); }
public TableBuilder row() { if (rowBuilder != null) endRow(); rowBuilder = vbf.newValueBuilder(Row.class); return this; }
public TableBuilder(ValueBuilderFactory vbf, Map<String, TableBuilderFactory.Column> columns, TableQuery tableQuery) { this.vbf = vbf; this.columns = columns; this.tableQuery = tableQuery; tableBuilder = vbf.newValueBuilder(Table.class); if (tableQuery.select().equals("*")) { for (TableBuilderFactory.Column column : columns.values()) { column(column.getId(), column.getLabel(), column.getType()); } } else { for (String columnName : tableQuery.select().split("[, ]")) { TableBuilderFactory.Column column = columns.get(columnName.trim()); if (column != null) column(column.getId(), column.getLabel(), column.getType()); } } }
@Override public RestListValue newListRepresentationValue( Reference listRef, int start, Iterable<RestValue> items ) { ValueBuilder<RestListValue> builder = vbf.newValueBuilder( RestListValue.class ); RestListValue listRepresentation = builder.prototype(); listRepresentation.uri().set( listRef.toString() ); listRepresentation.start().set( start ); for ( RestValue eachItem : items ) { listRepresentation.items().get().add( eachItem ); } return builder.newInstance(); }
public TableBuilder cell(Object v, String f) { ValueBuilder<Cell> cellBuilder = vbf.newValueBuilder(Cell.class); cellBuilder.prototype().v().set(v); cellBuilder.prototype().f().set(f); rowBuilder.prototype().c().get().add(cellBuilder.newInstance()); return this; }
profile.netscapeCertComment().set( comment ); if ( keyUsages != null ) { profile.keyUsages().set( vbf.newValueBuilder( KeyUsagesValue.class ). withPrototype( keyUsages ).newInstance() ); profile.extendedKeyUsages().set( vbf.newValueBuilder( ExtendedKeyUsagesValue.class ). withPrototype( extendedKeyUsages ).newInstance() ); profile.netscapeCertTypes().set( vbf.newValueBuilder( NetscapeCertTypesValue.class ). withPrototype( netscapeCertTypes ).newInstance() ); profile.basicConstraints().set( vbf.newValueBuilder( BasicConstraintsValue.class ). withPrototype( basicConstraints ).newInstance() ); profile.nameConstraints().set( vbf.newValueBuilder( NameConstraintsValue.class ). withPrototype( nameConstraints ).newInstance() );
public TableBuilder column(String id, String label, String type) { ValueBuilder<Column> builder = vbf.newValueBuilder(Column.class); builder.prototype().id().set(id); if (tableQuery != null && tableQuery.label() != null) { // TODO Fix label selection } builder.prototype().label().set(label); builder.prototype().columnType().set(type); tableBuilder.prototype().cols().get().add(builder.newInstance()); return this; }
ValueBuilder<UnitOfWorkDomainEventsValue> builder = vbf.newValueBuilder( UnitOfWorkDomainEventsValue.class ); builder.prototype().user().set( user ); builder.prototype().timestamp().set( System.currentTimeMillis() );
@Override public DomainEventValue createEvent( EntityComposite entity, String name, Object[] args ) ValueBuilder<DomainEventValue> builder = vbf.newValueBuilder( DomainEventValue.class );
@Override public CryptoStoreValue cryptoStore( CryptoStore cs ) { ValueBuilder<CryptoStoreValue> ksValueBuilder = vbf.newValueBuilder( CryptoStoreValue.class ); CaUriBuilder caUriBuilder = new CaUriBuilder( restApi.apiRootRef() ); CryptoStoreValue ksValue = ksValueBuilder.prototype(); ksValue.uri().set( caUriBuilder.cryptoStore().withIdentity( cs.identity().get() ).build() ); ksValue.name().set( cs.name().get() ); ksValue.storeType().set( cs.storeType().get() ); return ksValueBuilder.newInstance(); }
@Override public X509ProfileValue x509Profile( X509Profile x509Profile ) { ValueBuilder<X509ProfileValue> x509ProfileValueBuilder = vbf.newValueBuilder( X509ProfileValue.class ); CaUriBuilder caUriBuilder = new CaUriBuilder( restApi.apiRootRef() ); X509ProfileValue x509ProfileValue = x509ProfileValueBuilder.prototype(); x509ProfileValue.uri().set( caUriBuilder.x509Profile().withIdentity( x509Profile.identity().get() ).build() ); x509ProfileValue.name().set( x509Profile.name().get() ); x509ProfileValue.validityDays().set( x509Profile.validityDays().get() ); return x509ProfileValueBuilder.newInstance(); }
@Override public ApplicationEvent createEvent( String name, Object[] args ) ValueBuilder<ApplicationEvent> builder = vbf.newValueBuilder( ApplicationEvent.class );
@Override public EscrowedKeyPairValue escrowedKeyPair( EscrowedKeyPair escrowedKeyPair ) { ValueBuilder<EscrowedKeyPairValue> escrowedKeyPairValueBuilder = vbf.newValueBuilder( EscrowedKeyPairValue.class ); CaUriBuilder caUriBuilder = new CaUriBuilder( restApi.apiRootRef() ); EscrowedKeyPairValue escrowedKeyPairValue = escrowedKeyPairValueBuilder.prototype(); escrowedKeyPairValue.uri().set( caUriBuilder.escrowedKeyPair().withIdentity( escrowedKeyPair.identity().get() ).build() ); escrowedKeyPairValue.recoveryUri().set( caUriBuilder.escrowedKeyPair().withIdentity( escrowedKeyPair.identity().get() ).pem().build() ); List<String> x509sUris = new ArrayList<String>(); for ( X509 eachX509 : escrowedKeyPair.x509s() ) { x509sUris.add( caUriBuilder.x509().withIdentity( eachX509.identity().get() ).build() ); } escrowedKeyPairValue.x509sUris().set( x509sUris ); escrowedKeyPairValue.algorithm().set( escrowedKeyPair.algorithm().get() ); escrowedKeyPairValue.length().set( escrowedKeyPair.length().get() ); return escrowedKeyPairValueBuilder.newInstance(); }
@Override public RevocationValue revocation( Revocation revocation ) { ValueBuilder<RevocationValue> revocationValueBuilder = vbf.newValueBuilder( RevocationValue.class ); CaUriBuilder caUriBuilder = new CaUriBuilder( restApi.apiRootRef() ); RevocationValue revocationValue = revocationValueBuilder.prototype(); revocationValue.x509Uri().set( caUriBuilder.x509().withIdentity( revocation.x509().get().identity().get() ).build() ); revocationValue.uri().set( caUriBuilder.x509().withIdentity( revocation.x509().get().identity().get() ).revocation().build() ); revocationValue.reason().set( revocation.reason().get() ); return revocationValueBuilder.newInstance(); }
@Override public CAValue ca( CA ca ) { ValueBuilder<CAValue> caValueBuilder = vbf.newValueBuilder( CAValue.class ); CaUriBuilder caUriBuilder = new CaUriBuilder( restApi.apiRootRef() ); CAValue caValue = caValueBuilder.prototype(); caValue.uri().set( caUriBuilder.ca().withIdentity( ca.identity().get() ).build() ); caValue.exportUri().set( caUriBuilder.ca().withIdentity( ca.identity().get() ).export().build() ); caValue.crlUri().set( caUriBuilder.ca().withIdentity( ca.identity().get() ).crl().build() ); caValue.cryptoStoreUri().set( caUriBuilder.cryptoStore().withIdentity( ca.cryptoStore().get().identity().get() ).build() ); caValue.crlDistPoints().set( ca.crlDistPoints().get() ); for ( X509ProfileAssignment eachAllowedProfile : ca.allowedX509Profiles().toSet() ) { ValueBuilder<X509ProfileAssignmentValue> profileBuilder = vbf.newValueBuilder( X509ProfileAssignmentValue.class ); X509ProfileAssignmentValue profile = profileBuilder.prototype(); profile.keyEscrowPolicy().set( eachAllowedProfile.keyEscrowPolicy().get() ); profile.x509ProfileUri().set( caUriBuilder.x509Profile().withIdentity( eachAllowedProfile.x509Profile().get().identity().get() ).build() ); caValue.allowedX509Profiles().get().add( profileBuilder.newInstance() ); } caValue.name().set( ca.name().get() ); return caValueBuilder.newInstance(); }
@Override public CaApiURIsValue caApiURIs() { Reference rootRef = restApi.apiRootRef(); ValueBuilder<CaApiURIsValue> caApiBuilder = vbf.newValueBuilder( CaApiURIsValue.class ); CaUriBuilder caUriBuilder = new CaUriBuilder( rootRef ); CaApiURIsValue caApi = caApiBuilder.prototype(); // API Root caApi.uri().set( rootRef.toString() ); // Tools caApi.cryptoInspectorUri().set( caUriBuilder.tools().cryptoInspector().build() ); // Domain caApi.cryptoStoreListUri().set( caUriBuilder.cryptoStore().build() ); caApi.caListUri().set( caUriBuilder.ca().build() ); caApi.x509ProfileListUri().set( caUriBuilder.x509Profile().build() ); caApi.x509ListUri().set( caUriBuilder.x509().build() ); caApi.escrowedKeyPairListUri().set( caUriBuilder.escrowedKeyPair().build() ); return caApiBuilder.newInstance(); }
@Override public X509Value x509( X509 x509 ) { ValueBuilder<X509Value> x509ValueBuilder = vbf.newValueBuilder( X509Value.class ); CaUriBuilder caUriBuilder = new CaUriBuilder( restApi.apiRootRef() ); X509Value x509Value = x509ValueBuilder.prototype(); x509Value.uri().set( caUriBuilder.x509().withIdentity( x509.identity().get() ).build() ); x509Value.pemUri().set( caUriBuilder.x509().withIdentity( x509.identity().get() ).pem().build() ); x509Value.detailUri().set( caUriBuilder.x509().withIdentity( x509.identity().get() ).detail().build() ); x509Value.revocationUri().set( caUriBuilder.x509().withIdentity( x509.identity().get() ).revocation().build() ); x509Value.issuerUri().set( caUriBuilder.ca().withIdentity( x509.issuer().get().identity().get() ).build() ); x509Value.profileUri().set( caUriBuilder.x509Profile().withIdentity( x509.profile().get().identity().get() ).build() ); x509Value.recoveryUri().set( caUriBuilder.x509().withIdentity( x509.identity().get() ).recovery().build() ); x509Value.canonicalSubjectDN().set( x509.canonicalSubjectDN().get() ); x509Value.canonicalIssuerDN().set( x509.canonicalIssuerDN().get() ); x509Value.hexSerialNumber().set( x509.hexSerialNumber().get() ); x509Value.validityInterval().set( commonValuesFactory.buildValidityInterval( x509.validityInterval().get().notBefore().get(), x509.validityInterval().get().notAfter().get() ) ); x509Value.md5Fingerprint().set( x509.md5Fingerprint().get() ); x509Value.sha1Fingerprint().set( x509.sha1Fingerprint().get() ); x509Value.sha256Fingerprint().set( x509.sha256Fingerprint().get() ); return x509ValueBuilder.newInstance(); }
KeyInformation publicKeyInfo = cryptoToolFactory.newKeyInformationInstance( cert.getPublicKey() ); ValueBuilder<X509DetailValue> x509DetailValueBuilder = vbf.newValueBuilder( X509DetailValue.class ); CaUriBuilder caUriBuilder = new CaUriBuilder( restApi.apiRootRef() );