public Results withMetadata( UUID id, String name, Object value ) { setMetadata( id, name, value ); return this; }
public Results withMetadata( UUID id, Map<String, Object> data ) { setMetadata( id, data ); return this; }
private void setConnections( List<ConnectionRef> connections, boolean forwardConnections ) { init(); this.connections = connections; this.forwardConnections = forwardConnections; level = Level.REFS; for ( ConnectionRef connection : connections ) { if ( forwardConnections ) { this.setMetadata( connection.getTargetRefs().getUuid(), "connection", connection.getConnectionType() ); } else { this.setMetadata( connection.getSourceRefs().getUuid(), "connection", connection.getConnectionType() ); } } }
public ServiceResults getApplicationEntity( ServiceContext context ) throws Exception { checkPermissionsForPath( context, "/" ); Entity entity = em.get( em.getApplicationRef() ); Results r = Results.fromEntity( entity ); Map<String, Object> collections = em.getApplicationCollectionMetadata(); // Set<String> collections = em.getApplicationCollections(); if ( collections.size() > 0 ) { r.setMetadata( em.getApplicationRef().getUuid(), "collections", collections ); } return genericServiceResults( r ); }
@Override public ServiceResults getApplicationMetadata( UUID applicationId ) throws Exception { if ( applicationId == null ) { return ServiceResults.genericServiceResults(); } EntityManager em = emf.getEntityManager( applicationId ); Entity entity = em.get( em.getApplicationRef() ); Results r = Results.fromEntity( entity ); Map<String, Object> collections = em.getApplicationCollectionMetadata(); if ( collections.size() > 0 ) { r.setMetadata( em.getApplicationRef().getUuid(), "collections", collections ); } return genericServiceResults( r ); }
public ServiceResults updateApplicationEntity( ServiceContext context, ServicePayload payload ) throws Exception { checkPermissionsForPath( context, "/" ); Map<String, Object> properties = payload.getProperties(); Object m = properties.get( "metadata" ); if ( m instanceof Map ) { @SuppressWarnings("unchecked") Map<String, Object> metadata = ( Map<String, Object> ) m; Object c = metadata.get( "collections" ); if ( c instanceof Map ) { @SuppressWarnings("unchecked") Map<String, Object> collections = ( Map<String, Object> ) c; for ( String collection : collections.keySet() ) { if ( isReservedCollection( collection ) ) { continue; } em.createApplicationCollection( collection ); if (logger.isDebugEnabled()) { logger.debug("Created collection {} for application {}", collection, sm.getApplicationId()); } } } } Entity entity = em.get( em.getApplicationRef() ); em.updateProperties( entity, properties ); entity.addProperties( properties ); Results r = Results.fromEntity( entity ); Set<String> collections = em.getApplicationCollections(); if ( collections.size() > 0 ) { r.setMetadata( em.getApplicationRef().getUuid(), "collections", collections ); } return genericServiceResults( r ); }