mirror of https://github.com/apache/nifi.git
NIFI-11842 - remove getTargetUri() and code cleanup
This closes #7511 Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
parent
5cad5838c5
commit
dbb2d6905f
|
@ -40,7 +40,7 @@ public class NiFiRegRemoteProcessGroupSchemaFunction implements Function<Version
|
|||
Map<String, Object> map = new HashMap<>();
|
||||
map.put(CommonPropertyKeys.ID_KEY, versionedRemoteProcessGroup.getIdentifier());
|
||||
map.put(CommonPropertyKeys.NAME_KEY, versionedRemoteProcessGroup.getName());
|
||||
map.put(RemoteProcessGroupSchema.URL_KEY, versionedRemoteProcessGroup.getTargetUri());
|
||||
map.put(RemoteProcessGroupSchema.URL_KEY, versionedRemoteProcessGroup.getTargetUris());
|
||||
|
||||
Set<VersionedRemoteGroupPort> inputPorts = versionedRemoteProcessGroup.getInputPorts();
|
||||
if (inputPorts != null) {
|
||||
|
|
|
@ -22,7 +22,6 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import java.util.Set;
|
||||
|
||||
public class VersionedRemoteProcessGroup extends VersionedComponent {
|
||||
private String targetUri;
|
||||
private String targetUris;
|
||||
|
||||
private String communicationsTimeout;
|
||||
|
@ -38,36 +37,12 @@ public class VersionedRemoteProcessGroup extends VersionedComponent {
|
|||
private Set<VersionedRemoteGroupPort> outputPorts;
|
||||
|
||||
|
||||
@Deprecated
|
||||
@ApiModelProperty(
|
||||
value = "[DEPRECATED] The target URI of the remote process group." +
|
||||
" If target uri is not set, but uris are set, then returns the first uri in the uris." +
|
||||
" If neither target uri nor uris are set, then returns null.",
|
||||
notes = "This field is deprecated and will be removed in version 1.x of NiFi Registry." +
|
||||
" Please migrate to using targetUris only.")
|
||||
public String getTargetUri() {
|
||||
|
||||
if (!isEmpty(targetUri)) {
|
||||
return targetUri;
|
||||
}
|
||||
return !isEmpty(targetUris) ? targetUris.split(",", 2)[0] : null;
|
||||
|
||||
}
|
||||
|
||||
public void setTargetUri(final String targetUri) {
|
||||
this.targetUri = targetUri;
|
||||
}
|
||||
|
||||
@ApiModelProperty(
|
||||
value = "The target URIs of the remote process group." +
|
||||
" If target uris is not set but target uri is set, then returns the single target uri." +
|
||||
" If neither target uris nor target uri is set, then returns null.")
|
||||
public String getTargetUris() {
|
||||
|
||||
if (!isEmpty(targetUris)) {
|
||||
return targetUris;
|
||||
}
|
||||
return !isEmpty(targetUri) ? targetUri : null;
|
||||
return !isEmpty(targetUris) ? targetUris : null;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -813,7 +813,6 @@ public class NiFiRegistryFlowMapper {
|
|||
if (flowMappingOptions.isMapSensitiveConfiguration()) {
|
||||
rpg.setProxyPassword(encrypt(remoteGroup.getProxyPassword()));
|
||||
}
|
||||
rpg.setTargetUri(remoteGroup.getTargetUri());
|
||||
rpg.setTargetUris(remoteGroup.getTargetUris());
|
||||
rpg.setTransportProtocol(remoteGroup.getTransportProtocol().name());
|
||||
rpg.setYieldDuration(remoteGroup.getYieldDuration());
|
||||
|
|
|
@ -256,7 +256,7 @@ public class RunNiFiRegistry {
|
|||
fileDir = new File(nifiHome, defaultDirectory);
|
||||
}
|
||||
|
||||
FileUtils.ensureDirectoryExistAndCanAccess(fileDir);
|
||||
FileUtils.ensureDirectoryExistAndCanReadAndWrite(fileDir);
|
||||
final File statusFile = new File(fileDir, fileName);
|
||||
logger.debug("Status File: {}", statusFile);
|
||||
return statusFile;
|
||||
|
|
|
@ -28,13 +28,6 @@ public interface NiFiRegistryClient extends Closeable {
|
|||
*/
|
||||
BucketClient getBucketClient();
|
||||
|
||||
/**
|
||||
* @deprecated use getBucketClient(RequestConfig requestConfig)
|
||||
*
|
||||
* @return the client for interacting with buckets on behalf of the given proxied entities
|
||||
*/
|
||||
BucketClient getBucketClient(String ... proxiedEntity);
|
||||
|
||||
/**
|
||||
* @return the client for interacting with buckets using the given request config
|
||||
*/
|
||||
|
@ -47,13 +40,6 @@ public interface NiFiRegistryClient extends Closeable {
|
|||
*/
|
||||
FlowClient getFlowClient();
|
||||
|
||||
/**
|
||||
* @deprecated use getFlowClient(RequestConfig requestConfig)
|
||||
*
|
||||
* @return the client for interacting with flows on behalf of the given proxied entities
|
||||
*/
|
||||
FlowClient getFlowClient(String ... proxiedEntity);
|
||||
|
||||
/**
|
||||
* @return the client for interacting with flows using the given request config
|
||||
*/
|
||||
|
@ -66,13 +52,6 @@ public interface NiFiRegistryClient extends Closeable {
|
|||
*/
|
||||
FlowSnapshotClient getFlowSnapshotClient();
|
||||
|
||||
/**
|
||||
* @deprecated use getFlowSnapshotClient(RequestConfig requestConfig)
|
||||
*
|
||||
* @return the client for interacting with flows/snapshots on behalf of the given proxied entities
|
||||
*/
|
||||
FlowSnapshotClient getFlowSnapshotClient(String ... proxiedEntity);
|
||||
|
||||
/**
|
||||
* @return the client for interacting with flows/snapshots using the given request config
|
||||
*/
|
||||
|
@ -85,13 +64,6 @@ public interface NiFiRegistryClient extends Closeable {
|
|||
*/
|
||||
ItemsClient getItemsClient();
|
||||
|
||||
/**
|
||||
* @deprecated use getItemsClient(RequestConfig requestConfig)
|
||||
*
|
||||
* @return the client for interacting with bucket items on behalf of the given proxied entities
|
||||
*/
|
||||
ItemsClient getItemsClient(String ... proxiedEntity);
|
||||
|
||||
/**
|
||||
* @return the client for interacting with bucket items using the given request config
|
||||
*/
|
||||
|
@ -104,13 +76,6 @@ public interface NiFiRegistryClient extends Closeable {
|
|||
*/
|
||||
UserClient getUserClient();
|
||||
|
||||
/**
|
||||
* @deprecated use getUserClient(RequestConfig requestConfig)
|
||||
*
|
||||
* @return the client for obtaining information about the current user based on the given proxied entities
|
||||
*/
|
||||
UserClient getUserClient(String ... proxiedEntity);
|
||||
|
||||
/**
|
||||
* @return the client for obtaining information about the current user based on the request config
|
||||
*/
|
||||
|
@ -123,13 +88,6 @@ public interface NiFiRegistryClient extends Closeable {
|
|||
*/
|
||||
BundleClient getBundleClient();
|
||||
|
||||
/**
|
||||
* @deprecated use getBundleClient(RequestConfig requestConfig)
|
||||
*
|
||||
* @return the client for interacting with extension bundles on behalf of the given proxied entities
|
||||
*/
|
||||
BundleClient getBundleClient(String ... proxiedEntity);
|
||||
|
||||
/**
|
||||
* @return the client for interacting with extension bundles using the given request config
|
||||
*/
|
||||
|
@ -142,13 +100,6 @@ public interface NiFiRegistryClient extends Closeable {
|
|||
*/
|
||||
BundleVersionClient getBundleVersionClient();
|
||||
|
||||
/**
|
||||
* @deprecated use getBundleVersionClient(RequestConfig requestConfig)
|
||||
*
|
||||
* @return the client for interacting with extension bundle versions on behalf of the given proxied entities
|
||||
*/
|
||||
BundleVersionClient getBundleVersionClient(String ... proxiedEntity);
|
||||
|
||||
/**
|
||||
* @return the client for interacting with extension bundle versions using the given request config
|
||||
*/
|
||||
|
@ -161,13 +112,6 @@ public interface NiFiRegistryClient extends Closeable {
|
|||
*/
|
||||
ExtensionRepoClient getExtensionRepoClient();
|
||||
|
||||
/**
|
||||
* @deprecated use getExtensionRepoClient(RequestConfig requestConfig)
|
||||
*
|
||||
* @return the client for interacting with the extension repository on behalf of the given proxied entities
|
||||
*/
|
||||
ExtensionRepoClient getExtensionRepoClient(String ... proxiedEntity);
|
||||
|
||||
/**
|
||||
* @return the client for interacting with the extension repository using the given request config
|
||||
*/
|
||||
|
@ -180,13 +124,6 @@ public interface NiFiRegistryClient extends Closeable {
|
|||
*/
|
||||
ExtensionClient getExtensionClient();
|
||||
|
||||
/**
|
||||
* @deprecated use getExtensionClient(RequestConfig requestConfig)
|
||||
*
|
||||
* @return the client for interacting with extensions on behalf of the given proxied entities
|
||||
*/
|
||||
ExtensionClient getExtensionClient(String ... proxiedEntity);
|
||||
|
||||
/**
|
||||
* @return the client for interacting with extensions using the given request config
|
||||
*/
|
||||
|
@ -201,17 +138,6 @@ public interface NiFiRegistryClient extends Closeable {
|
|||
*/
|
||||
TenantsClient getTenantsClient();
|
||||
|
||||
/**
|
||||
* Returns client for interacting with tenants.
|
||||
*
|
||||
* @deprecated use getTenantsClient(RequestConfig requestConfig)
|
||||
*
|
||||
* @param proxiedEntity The given proxied entities.
|
||||
*
|
||||
* @return the client for interacting with tenants on behalf of the given proxied entities.
|
||||
*/
|
||||
TenantsClient getTenantsClient(String ... proxiedEntity);
|
||||
|
||||
/**
|
||||
* @return the client for interacting with tenants using the given request config
|
||||
*/
|
||||
|
@ -226,17 +152,6 @@ public interface NiFiRegistryClient extends Closeable {
|
|||
*/
|
||||
PoliciesClient getPoliciesClient();
|
||||
|
||||
/**
|
||||
* Returns client for interacting with access policies.
|
||||
*
|
||||
* @deprecated use getPoliciesClient(RequestConfig requestConfig)
|
||||
*
|
||||
* @param proxiedEntity The given proxied entities.
|
||||
*
|
||||
* @return the client for interacting with access policies on behalf of the given proxied entities.
|
||||
*/
|
||||
PoliciesClient getPoliciesClient(String ... proxiedEntity);
|
||||
|
||||
/**
|
||||
* @return the client for interacting with access policies using the given request config
|
||||
*/
|
||||
|
|
|
@ -206,7 +206,6 @@ public class JerseyFlowSnapshotClient extends AbstractJerseyClient implements Fl
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<VersionedFlowSnapshotMetadata> getSnapshotMetadata(final String bucketId, final String flowId)
|
||||
throws NiFiRegistryException, IOException {
|
||||
if (StringUtils.isBlank(bucketId)) {
|
||||
|
@ -230,7 +229,6 @@ public class JerseyFlowSnapshotClient extends AbstractJerseyClient implements Fl
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<VersionedFlowSnapshotMetadata> getSnapshotMetadata(final String flowId)
|
||||
throws NiFiRegistryException, IOException {
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ import org.apache.nifi.registry.client.PoliciesClient;
|
|||
import org.apache.nifi.registry.client.RequestConfig;
|
||||
import org.apache.nifi.registry.client.TenantsClient;
|
||||
import org.apache.nifi.registry.client.UserClient;
|
||||
import org.apache.nifi.registry.client.impl.request.ProxiedEntityRequestConfig;
|
||||
import org.glassfish.jersey.client.ClientConfig;
|
||||
import org.glassfish.jersey.client.ClientProperties;
|
||||
import org.glassfish.jersey.client.RequestEntityProcessing;
|
||||
|
@ -132,12 +131,6 @@ public class JerseyNiFiRegistryClient implements NiFiRegistryClient {
|
|||
return this.bucketClient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BucketClient getBucketClient(String... proxiedEntity) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntity);
|
||||
return new JerseyBucketClient(baseTarget, requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BucketClient getBucketClient(RequestConfig requestConfig) {
|
||||
return new JerseyBucketClient(baseTarget, requestConfig);
|
||||
|
@ -148,12 +141,6 @@ public class JerseyNiFiRegistryClient implements NiFiRegistryClient {
|
|||
return this.flowClient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowClient getFlowClient(String... proxiedEntity) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntity);
|
||||
return new JerseyFlowClient(baseTarget, requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowClient getFlowClient(RequestConfig requestConfig) {
|
||||
return new JerseyFlowClient(baseTarget, requestConfig);
|
||||
|
@ -164,12 +151,6 @@ public class JerseyNiFiRegistryClient implements NiFiRegistryClient {
|
|||
return this.flowSnapshotClient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowSnapshotClient getFlowSnapshotClient(String... proxiedEntity) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntity);
|
||||
return new JerseyFlowSnapshotClient(baseTarget, requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowSnapshotClient getFlowSnapshotClient(RequestConfig requestConfig) {
|
||||
return new JerseyFlowSnapshotClient(baseTarget, requestConfig);
|
||||
|
@ -180,12 +161,6 @@ public class JerseyNiFiRegistryClient implements NiFiRegistryClient {
|
|||
return this.itemsClient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemsClient getItemsClient(String... proxiedEntity) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntity);
|
||||
return new JerseyItemsClient(baseTarget, requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemsClient getItemsClient(RequestConfig requestConfig) {
|
||||
return new JerseyItemsClient(baseTarget, requestConfig);
|
||||
|
@ -196,12 +171,6 @@ public class JerseyNiFiRegistryClient implements NiFiRegistryClient {
|
|||
return new JerseyUserClient(baseTarget);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserClient getUserClient(String... proxiedEntity) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntity);
|
||||
return new JerseyUserClient(baseTarget, requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserClient getUserClient(RequestConfig requestConfig) {
|
||||
return new JerseyUserClient(baseTarget, requestConfig);
|
||||
|
@ -212,12 +181,6 @@ public class JerseyNiFiRegistryClient implements NiFiRegistryClient {
|
|||
return new JerseyBundleClient(baseTarget);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BundleClient getBundleClient(String... proxiedEntity) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntity);
|
||||
return new JerseyBundleClient(baseTarget, requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BundleClient getBundleClient(RequestConfig requestConfig) {
|
||||
return new JerseyBundleClient(baseTarget, requestConfig);
|
||||
|
@ -228,12 +191,6 @@ public class JerseyNiFiRegistryClient implements NiFiRegistryClient {
|
|||
return new JerseyBundleVersionClient(baseTarget);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BundleVersionClient getBundleVersionClient(String... proxiedEntity) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntity);
|
||||
return new JerseyBundleVersionClient(baseTarget, requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BundleVersionClient getBundleVersionClient(RequestConfig requestConfig) {
|
||||
return new JerseyBundleVersionClient(baseTarget, requestConfig);
|
||||
|
@ -244,12 +201,6 @@ public class JerseyNiFiRegistryClient implements NiFiRegistryClient {
|
|||
return new JerseyExtensionRepoClient(baseTarget);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExtensionRepoClient getExtensionRepoClient(String... proxiedEntity) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntity);
|
||||
return new JerseyExtensionRepoClient(baseTarget, requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExtensionRepoClient getExtensionRepoClient(RequestConfig requestConfig) {
|
||||
return new JerseyExtensionRepoClient(baseTarget, requestConfig);
|
||||
|
@ -260,12 +211,6 @@ public class JerseyNiFiRegistryClient implements NiFiRegistryClient {
|
|||
return new JerseyExtensionClient(baseTarget);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExtensionClient getExtensionClient(String... proxiedEntity) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntity);
|
||||
return new JerseyExtensionClient(baseTarget, requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExtensionClient getExtensionClient(RequestConfig requestConfig) {
|
||||
return new JerseyExtensionClient(baseTarget, requestConfig);
|
||||
|
@ -276,12 +221,6 @@ public class JerseyNiFiRegistryClient implements NiFiRegistryClient {
|
|||
return new JerseyTenantsClient(baseTarget);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TenantsClient getTenantsClient(String... proxiedEntity) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntity);
|
||||
return new JerseyTenantsClient(baseTarget, requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TenantsClient getTenantsClient(RequestConfig requestConfig) {
|
||||
return new JerseyTenantsClient(baseTarget, requestConfig);
|
||||
|
@ -292,12 +231,6 @@ public class JerseyNiFiRegistryClient implements NiFiRegistryClient {
|
|||
return new JerseyPoliciesClient(baseTarget);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PoliciesClient getPoliciesClient(String... proxiedEntity) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntity);
|
||||
return new JerseyPoliciesClient(baseTarget, requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PoliciesClient getPoliciesClient(RequestConfig requestConfig) {
|
||||
return new JerseyPoliciesClient(baseTarget, requestConfig);
|
||||
|
@ -348,7 +281,7 @@ public class JerseyNiFiRegistryClient implements NiFiRegistryClient {
|
|||
JacksonJaxbJsonProvider jacksonJaxbJsonProvider = new JacksonJaxbJsonProvider();
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.setPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL));
|
||||
mapper.setDefaultPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL));
|
||||
mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector(mapper.getTypeFactory()));
|
||||
// Ignore unknown properties so that deployed client remain compatible with future versions of NiFi Registry that add new fields
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
|
|
|
@ -31,70 +31,46 @@ public class TestVersionedRemoteProcessGroup {
|
|||
|
||||
/* targetUri is null, targetUris varies */
|
||||
|
||||
vRPG.setTargetUri(null);
|
||||
vRPG.setTargetUris(null);
|
||||
assertEquals(null, vRPG.getTargetUri());
|
||||
assertEquals(null, vRPG.getTargetUris());
|
||||
|
||||
vRPG.setTargetUri(null);
|
||||
vRPG.setTargetUris("");
|
||||
assertEquals(null, vRPG.getTargetUri());
|
||||
assertEquals(null, vRPG.getTargetUris());
|
||||
|
||||
vRPG.setTargetUri(null);
|
||||
vRPG.setTargetUris("uri-2");
|
||||
//assertEquals("uri-2", vRPG.getTargetUri());
|
||||
assertEquals("uri-2", vRPG.getTargetUris());
|
||||
|
||||
vRPG.setTargetUri(null);
|
||||
vRPG.setTargetUris("uri-2,uri-3");
|
||||
assertEquals("uri-2", vRPG.getTargetUri());
|
||||
assertEquals("uri-2,uri-3", vRPG.getTargetUris());
|
||||
|
||||
|
||||
/* targetUri is empty, targetUris varies */
|
||||
|
||||
vRPG.setTargetUri("");
|
||||
vRPG.setTargetUris(null);
|
||||
assertEquals(null, vRPG.getTargetUri());
|
||||
assertEquals(null, vRPG.getTargetUris());
|
||||
|
||||
vRPG.setTargetUri("");
|
||||
vRPG.setTargetUris("");
|
||||
assertEquals(null, vRPG.getTargetUri());
|
||||
assertEquals(null, vRPG.getTargetUris());
|
||||
|
||||
vRPG.setTargetUri("");
|
||||
vRPG.setTargetUris("uri-2");
|
||||
assertEquals("uri-2", vRPG.getTargetUri());
|
||||
assertEquals("uri-2", vRPG.getTargetUris());
|
||||
|
||||
vRPG.setTargetUri("");
|
||||
vRPG.setTargetUris("uri-2,uri-3");
|
||||
assertEquals("uri-2", vRPG.getTargetUri());
|
||||
assertEquals("uri-2,uri-3", vRPG.getTargetUris());
|
||||
|
||||
|
||||
/* targetUri is set, targetUris varies */
|
||||
|
||||
vRPG.setTargetUri("uri-1");
|
||||
vRPG.setTargetUris(null);
|
||||
assertEquals("uri-1", vRPG.getTargetUri());
|
||||
assertEquals("uri-1", vRPG.getTargetUris());
|
||||
assertEquals(null, vRPG.getTargetUris());
|
||||
|
||||
vRPG.setTargetUri("uri-1");
|
||||
vRPG.setTargetUris("");
|
||||
assertEquals("uri-1", vRPG.getTargetUri());
|
||||
assertEquals("uri-1", vRPG.getTargetUris());
|
||||
assertEquals(null, vRPG.getTargetUris());
|
||||
|
||||
vRPG.setTargetUri("uri-1");
|
||||
vRPG.setTargetUris("uri-2");
|
||||
assertEquals("uri-1", vRPG.getTargetUri());
|
||||
assertEquals("uri-2", vRPG.getTargetUris());
|
||||
|
||||
vRPG.setTargetUri("uri-1");
|
||||
vRPG.setTargetUris("uri-2,uri-3");
|
||||
assertEquals("uri-1", vRPG.getTargetUri());
|
||||
assertEquals("uri-2,uri-3", vRPG.getTargetUris());
|
||||
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ public class DatabaseMetadataService implements MetadataService {
|
|||
@Override
|
||||
public List<BucketEntity> getBucketsByName(final String name) {
|
||||
final String sql = "SELECT * FROM BUCKET WHERE name = ? ORDER BY name ASC";
|
||||
return jdbcTemplate.query(sql, new Object[] {name} , new BucketEntityRowMapper());
|
||||
return jdbcTemplate.query(sql, new BucketEntityRowMapper(), name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -139,7 +139,7 @@ public class DatabaseMetadataService implements MetadataService {
|
|||
addIdentifiersInClause(sqlBuilder, "id", bucketIds);
|
||||
sqlBuilder.append("ORDER BY name ASC");
|
||||
|
||||
return jdbcTemplate.query(sqlBuilder.toString(), bucketIds.toArray(), new BucketEntityRowMapper());
|
||||
return jdbcTemplate.query(sqlBuilder.toString(), new BucketEntityRowMapper(), bucketIds.toArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -170,7 +170,7 @@ public class DatabaseMetadataService implements MetadataService {
|
|||
@Override
|
||||
public List<BucketItemEntity> getBucketItems(final String bucketIdentifier) {
|
||||
final String sql = BASE_BUCKET_ITEMS_SQL + " WHERE item.bucket_id = ?";
|
||||
final List<BucketItemEntity> items = jdbcTemplate.query(sql, new Object[] { bucketIdentifier }, new BucketItemEntityRowMapper());
|
||||
final List<BucketItemEntity> items = jdbcTemplate.query(sql, new BucketItemEntityRowMapper(), bucketIdentifier);
|
||||
return getItemsWithCounts(items);
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ public class DatabaseMetadataService implements MetadataService {
|
|||
}
|
||||
sqlBuilder.append(")");
|
||||
|
||||
final List<BucketItemEntity> items = jdbcTemplate.query(sqlBuilder.toString(), bucketIds.toArray(), new BucketItemEntityRowMapper());
|
||||
final List<BucketItemEntity> items = jdbcTemplate.query(sqlBuilder.toString(), new BucketItemEntityRowMapper(), bucketIds.toArray());
|
||||
return getItemsWithCounts(items);
|
||||
}
|
||||
|
||||
|
@ -232,9 +232,9 @@ public class DatabaseMetadataService implements MetadataService {
|
|||
private Long getFlowSnapshotCount(final String flowIdentifier) {
|
||||
final String sql = "SELECT count(*) FROM FLOW_SNAPSHOT WHERE flow_id = ?";
|
||||
|
||||
return jdbcTemplate.queryForObject(sql, new Object[] {flowIdentifier}, (rs, num) -> {
|
||||
return jdbcTemplate.queryForObject(sql, (rs, num) -> {
|
||||
return rs.getLong(1);
|
||||
});
|
||||
}, flowIdentifier);
|
||||
}
|
||||
|
||||
private Map<String,Long> getExtensionBundleVersionCounts() {
|
||||
|
@ -250,9 +250,9 @@ public class DatabaseMetadataService implements MetadataService {
|
|||
private Long getExtensionBundleVersionCount(final String extensionBundleIdentifier) {
|
||||
final String sql = "SELECT count(*) FROM BUNDLE_VERSION WHERE bundle_id = ?";
|
||||
|
||||
return jdbcTemplate.queryForObject(sql, new Object[] {extensionBundleIdentifier}, (rs, num) -> {
|
||||
return jdbcTemplate.queryForObject(sql, (rs, num) -> {
|
||||
return rs.getLong(1);
|
||||
});
|
||||
}, extensionBundleIdentifier);
|
||||
}
|
||||
|
||||
//----------------- Flows ---------------------------------
|
||||
|
@ -305,19 +305,19 @@ public class DatabaseMetadataService implements MetadataService {
|
|||
@Override
|
||||
public List<FlowEntity> getFlowsByName(final String name) {
|
||||
final String sql = "SELECT * FROM FLOW f, BUCKET_ITEM item WHERE item.name = ? AND item.id = f.id";
|
||||
return jdbcTemplate.query(sql, new Object[] {name}, new FlowEntityRowMapper());
|
||||
return jdbcTemplate.query(sql, new FlowEntityRowMapper(), name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowEntity> getFlowsByName(final String bucketIdentifier, final String name) {
|
||||
final String sql = "SELECT * FROM FLOW f, BUCKET_ITEM item WHERE item.name = ? AND item.id = f.id AND item.bucket_id = ?";
|
||||
return jdbcTemplate.query(sql, new Object[] {name, bucketIdentifier}, new FlowEntityRowMapper());
|
||||
return jdbcTemplate.query(sql, new FlowEntityRowMapper(), name, bucketIdentifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlowEntity> getFlowsByBucket(final String bucketIdentifier) {
|
||||
final String sql = "SELECT * FROM FLOW f, BUCKET_ITEM item WHERE item.bucket_id = ? AND item.id = f.id";
|
||||
final List<FlowEntity> flows = jdbcTemplate.query(sql, new Object[] {bucketIdentifier}, new FlowEntityRowMapper());
|
||||
final List<FlowEntity> flows = jdbcTemplate.query(sql, new FlowEntityRowMapper(), bucketIdentifier);
|
||||
|
||||
final Map<String,Long> snapshotCounts = getFlowSnapshotCounts();
|
||||
for (final FlowEntity flowEntity : flows) {
|
||||
|
@ -418,8 +418,7 @@ public class DatabaseMetadataService implements MetadataService {
|
|||
"f.id = ? AND " +
|
||||
"f.id = fs.flow_id";
|
||||
|
||||
final Object[] args = new Object[] { flowIdentifier };
|
||||
return jdbcTemplate.query(sql, args, new FlowSnapshotEntityRowMapper());
|
||||
return jdbcTemplate.query(sql, new FlowSnapshotEntityRowMapper(), flowIdentifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -594,7 +593,7 @@ public class DatabaseMetadataService implements MetadataService {
|
|||
.append(" AND b.id = ?")
|
||||
.append(" ORDER BY eb.group_id ASC, eb.artifact_id ASC");
|
||||
|
||||
final List<BundleEntity> bundles = jdbcTemplate.query(sqlBuilder.toString(), new Object[]{bucketId}, new BundleEntityRowMapper());
|
||||
final List<BundleEntity> bundles = jdbcTemplate.query(sqlBuilder.toString(), new BundleEntityRowMapper(), bucketId);
|
||||
return populateVersionCounts(bundles);
|
||||
}
|
||||
|
||||
|
@ -605,7 +604,7 @@ public class DatabaseMetadataService implements MetadataService {
|
|||
.append(" AND eb.group_id = ?")
|
||||
.append(" ORDER BY eb.group_id ASC, eb.artifact_id ASC");
|
||||
|
||||
final List<BundleEntity> bundles = jdbcTemplate.query(sqlBuilder.toString(), new Object[]{bucketId, groupId}, new BundleEntityRowMapper());
|
||||
final List<BundleEntity> bundles = jdbcTemplate.query(sqlBuilder.toString(), new BundleEntityRowMapper(), bucketId, groupId);
|
||||
return populateVersionCounts(bundles);
|
||||
}
|
||||
|
||||
|
@ -786,7 +785,7 @@ public class DatabaseMetadataService implements MetadataService {
|
|||
@Override
|
||||
public List<BundleVersionEntity> getBundleVersions(final String extensionBundleId) {
|
||||
final String sql = BASE_EXTENSION_BUNDLE_VERSION_SQL + " AND ebv.bundle_id = ?";
|
||||
return jdbcTemplate.query(sql, new Object[]{extensionBundleId}, new BundleVersionEntityRowMapper());
|
||||
return jdbcTemplate.query(sql, new BundleVersionEntityRowMapper(), extensionBundleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -796,8 +795,7 @@ public class DatabaseMetadataService implements MetadataService {
|
|||
"AND eb.group_id = ? " +
|
||||
"AND eb.artifact_id = ? ";
|
||||
|
||||
final Object[] args = {bucketId, groupId, artifactId};
|
||||
return jdbcTemplate.query(sql, args, new BundleVersionEntityRowMapper());
|
||||
return jdbcTemplate.query(sql, new BundleVersionEntityRowMapper(), bucketId, groupId, artifactId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -807,8 +805,7 @@ public class DatabaseMetadataService implements MetadataService {
|
|||
"AND eb.artifact_id = ? " +
|
||||
"AND ebv.version = ?";
|
||||
|
||||
final Object[] args = {groupId, artifactId, version};
|
||||
return jdbcTemplate.query(sql, args, new BundleVersionEntityRowMapper());
|
||||
return jdbcTemplate.query(sql, new BundleVersionEntityRowMapper(), groupId, artifactId, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -849,8 +846,7 @@ public class DatabaseMetadataService implements MetadataService {
|
|||
@Override
|
||||
public List<BundleVersionDependencyEntity> getDependenciesForBundleVersion(final String extensionBundleVersionId) {
|
||||
final String sql = "SELECT * FROM BUNDLE_VERSION_DEPENDENCY WHERE bundle_version_id = ?";
|
||||
final Object[] args = {extensionBundleVersionId};
|
||||
return jdbcTemplate.query(sql, args, new BundleVersionDependencyEntityRowMapper());
|
||||
return jdbcTemplate.query(sql, new BundleVersionDependencyEntityRowMapper(), extensionBundleVersionId);
|
||||
}
|
||||
|
||||
|
||||
|
@ -962,13 +958,12 @@ public class DatabaseMetadataService implements MetadataService {
|
|||
public ExtensionAdditionalDetailsEntity getExtensionAdditionalDetails(final String bundleVersionId, final String name) {
|
||||
final String selectSql = "SELECT id, additional_details FROM EXTENSION WHERE bundle_version_id = ? AND name = ?";
|
||||
try {
|
||||
final Object[] args = {bundleVersionId, name};
|
||||
return jdbcTemplate.queryForObject(selectSql, args, (rs, i) -> {
|
||||
return jdbcTemplate.queryForObject(selectSql, (rs, i) -> {
|
||||
final ExtensionAdditionalDetailsEntity entity = new ExtensionAdditionalDetailsEntity();
|
||||
entity.setExtensionId(rs.getString("ID"));
|
||||
entity.setAdditionalDetails(Optional.ofNullable(rs.getString("ADDITIONAL_DETAILS")));
|
||||
return entity;
|
||||
});
|
||||
}, bundleVersionId, name);
|
||||
} catch (EmptyResultDataAccessException e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1057,7 +1052,7 @@ public class DatabaseMetadataService implements MetadataService {
|
|||
public List<ExtensionEntity> getExtensionsByBundleVersionId(final String bundleVersionId) {
|
||||
final String selectSql = BASE_EXTENSION_SQL + " AND e.bundle_version_id = ?";
|
||||
final Object[] args = { bundleVersionId };
|
||||
return jdbcTemplate.query(selectSql, args, new ExtensionEntityRowMapper());
|
||||
return jdbcTemplate.query(selectSql, new ExtensionEntityRowMapper(), bundleVersionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -59,10 +59,10 @@ public class DatabaseFlowPersistenceProvider implements FlowPersistenceProvider
|
|||
final List<byte[]> results = new ArrayList<>();
|
||||
final String sql = "SELECT FLOW_CONTENT FROM FLOW_PERSISTENCE_PROVIDER WHERE BUCKET_ID = ? and FLOW_ID = ? and VERSION = ?";
|
||||
|
||||
jdbcTemplate.query(sql, new Object[] {bucketId, flowId, version}, (rs) -> {
|
||||
jdbcTemplate.query(sql, (rs) -> {
|
||||
final byte[] content = rs.getBytes("FLOW_CONTENT");
|
||||
results.add(content);
|
||||
});
|
||||
}, bucketId, flowId, version);
|
||||
|
||||
if (results.isEmpty()) {
|
||||
return null;
|
||||
|
|
|
@ -137,9 +137,9 @@ class GitFlowMetaData {
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
private static boolean hasAtLeastOneReference(Repository repo) {
|
||||
private static boolean hasAtLeastOneReference(Repository repo) throws IOException {
|
||||
logger.info("Checking references for repository {}", repo.toString());
|
||||
for (Ref ref : repo.getAllRefs().values()) {
|
||||
for (Ref ref : repo.getRefDatabase().getRefs()) {
|
||||
if (ref.getObjectId() == null) {
|
||||
continue;
|
||||
}
|
||||
|
@ -205,7 +205,6 @@ class GitFlowMetaData {
|
|||
.call();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void loadGitRepository(File gitProjectRootDir) throws IOException, GitAPIException {
|
||||
gitRepo = openRepository(gitProjectRootDir);
|
||||
|
||||
|
@ -419,7 +418,7 @@ class GitFlowMetaData {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean validateRequiredValue(final Map map, String nameOfMap, Object ... keys) {
|
||||
private boolean validateRequiredValue(final Map<String, Object> map, String nameOfMap, Object ... keys) {
|
||||
for (Object key : keys) {
|
||||
if (!map.containsKey(key)) {
|
||||
logger.warn("{} does not have {}. Skipping it.", nameOfMap, key);
|
||||
|
|
|
@ -254,7 +254,7 @@ public class DatabaseAccessPolicyProvider extends AbstractConfigurableAccessPoli
|
|||
|
||||
final String policySql = "SELECT * FROM APP_POLICY WHERE RESOURCE = ? AND ACTION = ?";
|
||||
final Object[] args = new Object[]{resourceIdentifier, action.toString()};
|
||||
final DatabaseAccessPolicy databaseAccessPolicy = queryForObject(policySql, args, new DatabaseAccessPolicyRowMapper());
|
||||
final DatabaseAccessPolicy databaseAccessPolicy = queryForObject(policySql, new DatabaseAccessPolicyRowMapper(), args);
|
||||
if (databaseAccessPolicy == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -303,16 +303,16 @@ public class DatabaseAccessPolicyProvider extends AbstractConfigurableAccessPoli
|
|||
|
||||
protected DatabaseAccessPolicy getDatabaseAcessPolicy(final String policyIdentifier) {
|
||||
final String sql = "SELECT * FROM APP_POLICY WHERE IDENTIFIER = ?";
|
||||
return queryForObject(sql, new Object[] {policyIdentifier}, new DatabaseAccessPolicyRowMapper());
|
||||
return queryForObject(sql, new DatabaseAccessPolicyRowMapper(), policyIdentifier);
|
||||
}
|
||||
|
||||
protected Set<String> getPolicyUsers(final String policyIdentifier) {
|
||||
final String sql = "SELECT * FROM APP_POLICY_USER WHERE POLICY_IDENTIFIER = ?";
|
||||
|
||||
final Set<String> userIdentifiers = new HashSet<>();
|
||||
jdbcTemplate.query(sql, new Object[]{policyIdentifier}, (rs) -> {
|
||||
jdbcTemplate.query(sql, (rs) -> {
|
||||
userIdentifiers.add(rs.getString("USER_IDENTIFIER"));
|
||||
});
|
||||
}, policyIdentifier);
|
||||
return userIdentifiers;
|
||||
}
|
||||
|
||||
|
@ -320,9 +320,9 @@ public class DatabaseAccessPolicyProvider extends AbstractConfigurableAccessPoli
|
|||
final String sql = "SELECT * FROM APP_POLICY_GROUP WHERE POLICY_IDENTIFIER = ?";
|
||||
|
||||
final Set<String> groupIdentifiers = new HashSet<>();
|
||||
jdbcTemplate.query(sql, new Object[]{policyIdentifier}, (rs) -> {
|
||||
jdbcTemplate.query(sql, (rs) -> {
|
||||
groupIdentifiers.add(rs.getString("GROUP_IDENTIFIER"));
|
||||
});
|
||||
}, policyIdentifier);
|
||||
return groupIdentifiers;
|
||||
}
|
||||
|
||||
|
@ -390,9 +390,9 @@ public class DatabaseAccessPolicyProvider extends AbstractConfigurableAccessPoli
|
|||
|
||||
//-- util methods
|
||||
|
||||
protected <T> T queryForObject(final String sql, final Object[] args, final RowMapper<T> rowMapper) {
|
||||
protected <T> T queryForObject(final String sql, final RowMapper<T> rowMapper, final Object... args) {
|
||||
try {
|
||||
return jdbcTemplate.queryForObject(sql, args, rowMapper);
|
||||
return jdbcTemplate.queryForObject(sql, rowMapper, args);
|
||||
} catch(final EmptyResultDataAccessException e) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider
|
|||
Validate.notBlank(identity);
|
||||
|
||||
final String sql = "SELECT * FROM UGP_USER WHERE IDENTITY = ?";
|
||||
final DatabaseUser databaseUser = queryForObject(sql, new Object[] {identity}, new DatabaseUserRowMapper());
|
||||
final DatabaseUser databaseUser = queryForObject(sql, new DatabaseUserRowMapper(), identity);
|
||||
if (databaseUser == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -202,8 +202,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider
|
|||
"G.IDENTIFIER = UG.GROUP_IDENTIFIER AND " +
|
||||
"UG.USER_IDENTIFIER = ?";
|
||||
|
||||
final Object[] args = {user.getIdentifier()};
|
||||
final List<DatabaseGroup> databaseGroups = jdbcTemplate.query(userGroupSql, args, new DatabaseGroupRowMapper());
|
||||
final List<DatabaseGroup> databaseGroups = jdbcTemplate.query(userGroupSql, new DatabaseGroupRowMapper(), user.getIdentifier());
|
||||
|
||||
groups = new HashSet<>();
|
||||
databaseGroups.forEach(g -> {
|
||||
|
@ -243,7 +242,7 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider
|
|||
|
||||
private DatabaseUser getDatabaseUser(final String userIdentifier) {
|
||||
final String sql = "SELECT * FROM UGP_USER WHERE IDENTIFIER = ?";
|
||||
return queryForObject(sql, new Object[] {userIdentifier}, new DatabaseUserRowMapper());
|
||||
return queryForObject(sql, new DatabaseUserRowMapper(), userIdentifier);
|
||||
}
|
||||
|
||||
private User mapToUser(final DatabaseUser databaseUser) {
|
||||
|
@ -353,16 +352,16 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider
|
|||
|
||||
private DatabaseGroup getDatabaseGroup(final String groupIdentifier) {
|
||||
final String sql = "SELECT * FROM UGP_GROUP WHERE IDENTIFIER = ?";
|
||||
return queryForObject(sql, new Object[] {groupIdentifier}, new DatabaseGroupRowMapper());
|
||||
return queryForObject(sql, new DatabaseGroupRowMapper(), groupIdentifier);
|
||||
}
|
||||
|
||||
private Set<String> getUserIdentifiers(final String groupIdentifier) {
|
||||
final String sql = "SELECT * FROM UGP_USER_GROUP WHERE GROUP_IDENTIFIER = ?";
|
||||
|
||||
final Set<String> userIdentifiers = new HashSet<>();
|
||||
jdbcTemplate.query(sql, new Object[]{groupIdentifier}, (rs) -> {
|
||||
jdbcTemplate.query(sql, (rs) -> {
|
||||
userIdentifiers.add(rs.getString("USER_IDENTIFIER"));
|
||||
});
|
||||
}, groupIdentifier);
|
||||
|
||||
return userIdentifiers;
|
||||
}
|
||||
|
@ -377,9 +376,9 @@ public class DatabaseUserGroupProvider implements ConfigurableUserGroupProvider
|
|||
|
||||
//-- util methods
|
||||
|
||||
private <T> T queryForObject(final String sql, final Object[] args, final RowMapper<T> rowMapper) {
|
||||
private <T> T queryForObject(final String sql, final RowMapper<T> rowMapper, final Object... args) {
|
||||
try {
|
||||
return jdbcTemplate.queryForObject(sql, args, rowMapper);
|
||||
return jdbcTemplate.queryForObject(sql, rowMapper, args);
|
||||
} catch(final EmptyResultDataAccessException e) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@ import com.fasterxml.jackson.annotation.JsonInclude;
|
|||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.MapperFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.json.JsonMapper;
|
||||
import com.fasterxml.jackson.databind.type.TypeFactory;
|
||||
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
@ -31,15 +33,13 @@ import org.springframework.context.annotation.Primary;
|
|||
@Configuration
|
||||
public class ObjectMapperProvider {
|
||||
|
||||
private static final ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
static {
|
||||
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||
mapper.setDefaultPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL));
|
||||
mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector(mapper.getTypeFactory()));
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
mapper.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true);
|
||||
}
|
||||
private static final ObjectMapper mapper = JsonMapper.builder()
|
||||
.serializationInclusion(JsonInclude.Include.NON_NULL)
|
||||
.defaultPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL))
|
||||
.annotationIntrospector(new JaxbAnnotationIntrospector(TypeFactory.defaultInstance()))
|
||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
||||
.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true)
|
||||
.build();
|
||||
|
||||
public static ObjectMapper getMapper() {
|
||||
return mapper;
|
||||
|
|
|
@ -86,7 +86,7 @@ public class JdbcRevisionManager implements RevisionManager {
|
|||
private Revision retrieveRevision(final String entityId) {
|
||||
try {
|
||||
final String selectSql = "SELECT * FROM REVISION WHERE ENTITY_ID = ?";
|
||||
return jdbcTemplate.queryForObject(selectSql, new Object[] {entityId}, new RevisionRowMapper());
|
||||
return jdbcTemplate.queryForObject(selectSql, new RevisionRowMapper(), entityId);
|
||||
} catch (EmptyResultDataAccessException e) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ public class TestJdbcRevisionManager {
|
|||
@Test
|
||||
public void testGetRevisionWhenExists() {
|
||||
final String entityId = "entity1";
|
||||
final Long version = new Long(99);
|
||||
final Long version = Long.valueOf(99);
|
||||
createRevision(entityId, version, null);
|
||||
|
||||
final Revision revision = revisionManager.getRevision(entityId);
|
||||
|
@ -151,7 +151,7 @@ public class TestJdbcRevisionManager {
|
|||
assertNotNull(revisionUpdate);
|
||||
|
||||
// version should go to 100 since it was 99 before
|
||||
verifyRevisionUpdate(entityId, revisionUpdate, new Long(100), null);
|
||||
verifyRevisionUpdate(entityId, revisionUpdate, Long.valueOf(100), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -186,7 +186,7 @@ public class TestJdbcRevisionManager {
|
|||
|
||||
// client in 99 which was not latest version, but since client id was the same the update was allowed
|
||||
// and the incremented version should be based on the version in the DB which was 100, so it goes to 101
|
||||
verifyRevisionUpdate(entityId, revisionUpdate, new Long(101), clientId);
|
||||
verifyRevisionUpdate(entityId, revisionUpdate, Long.valueOf(101), clientId);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -203,7 +203,7 @@ public class TestJdbcRevisionManager {
|
|||
assertNotNull(revisionUpdate);
|
||||
|
||||
// version should go to 1 and client id should be updated to client-new
|
||||
verifyRevisionUpdate(entityId, revisionUpdate, new Long(1), clientId);
|
||||
verifyRevisionUpdate(entityId, revisionUpdate, Long.valueOf(1), clientId);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -223,7 +223,7 @@ public class TestJdbcRevisionManager {
|
|||
assertNotNull(revisionUpdate);
|
||||
|
||||
// version should go to 100 and client id should be updated to client-new
|
||||
verifyRevisionUpdate(entityId, revisionUpdate, new Long(100), clientId);
|
||||
verifyRevisionUpdate(entityId, revisionUpdate, Long.valueOf(100), clientId);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -295,8 +295,8 @@ public class TestJdbcRevisionManager {
|
|||
|
||||
@Test
|
||||
public void testGetAllAndReset() {
|
||||
createRevision("entity1", new Long(1), null);
|
||||
createRevision("entity2", new Long(1), null);
|
||||
createRevision("entity1", Long.valueOf(1), null);
|
||||
createRevision("entity2", Long.valueOf(1), null);
|
||||
|
||||
final List<Revision> allRevisions = revisionManager.getAllRevisions();
|
||||
assertNotNull(allRevisions);
|
||||
|
@ -318,8 +318,8 @@ public class TestJdbcRevisionManager {
|
|||
|
||||
@Test
|
||||
public void testGetRevisionMap() {
|
||||
createRevision("entity1", new Long(1), null);
|
||||
createRevision("entity2", new Long(1), null);
|
||||
createRevision("entity1", Long.valueOf(1), null);
|
||||
createRevision("entity2", Long.valueOf(1), null);
|
||||
|
||||
final Map<String,Revision> revisions = revisionManager.getRevisionMap();
|
||||
assertNotNull(revisions);
|
||||
|
@ -390,8 +390,6 @@ public class TestJdbcRevisionManager {
|
|||
|
||||
private String id;
|
||||
|
||||
private Revision revision;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -399,13 +397,5 @@ public class TestJdbcRevisionManager {
|
|||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Revision getRevision() {
|
||||
return revision;
|
||||
}
|
||||
|
||||
public void setRevision(Revision revision) {
|
||||
this.revision = revision;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ package org.apache.nifi.registry.security.authorization;
|
|||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
@ -34,7 +33,6 @@ public class AuthorizationRequest {
|
|||
private final Resource resource;
|
||||
private final Resource requestedResource;
|
||||
private final String identity;
|
||||
private final List<String> proxyIdentities;
|
||||
private final Set<String> groups;
|
||||
private final RequestAction action;
|
||||
private final boolean isAccessAttempt;
|
||||
|
@ -51,7 +49,6 @@ public class AuthorizationRequest {
|
|||
|
||||
this.resource = builder.resource;
|
||||
this.identity = builder.identity;
|
||||
this.proxyIdentities = builder.proxyIdentities == null ? Collections.emptyList() : Collections.unmodifiableList(builder.proxyIdentities);
|
||||
this.groups = builder.groups == null ? null : Collections.unmodifiableSet(builder.groups);
|
||||
this.action = builder.action;
|
||||
this.isAccessAttempt = builder.isAccessAttempt;
|
||||
|
@ -105,17 +102,6 @@ public class AuthorizationRequest {
|
|||
return identity;
|
||||
}
|
||||
|
||||
/**
|
||||
* The identities in the proxy chain for the request. Will be empty if the request was not proxied.
|
||||
*
|
||||
* @return The identities in the proxy chain
|
||||
*
|
||||
* @deprecated no longer populated
|
||||
*/
|
||||
public List<String> getProxyIdentities() {
|
||||
return proxyIdentities;
|
||||
}
|
||||
|
||||
/**
|
||||
* The groups the user making this request belongs to. May be null if this NiFi is not configured to load user
|
||||
* groups or empty if the user has no groups
|
||||
|
@ -188,7 +174,6 @@ public class AuthorizationRequest {
|
|||
private Resource resource;
|
||||
private Resource requestedResource;
|
||||
private String identity;
|
||||
private List<String> proxyIdentities;
|
||||
private Set<String> groups;
|
||||
private Boolean isAnonymous;
|
||||
private Boolean isAccessAttempt;
|
||||
|
@ -212,14 +197,6 @@ public class AuthorizationRequest {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated no longer populated by the framework
|
||||
*/
|
||||
public Builder proxyIdentities(final List<String> proxyIdentities) {
|
||||
this.proxyIdentities = proxyIdentities;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder groups(final Set<String> groups) {
|
||||
this.groups = groups;
|
||||
return this;
|
||||
|
|
|
@ -19,6 +19,8 @@ package org.apache.nifi.registry.web.api;
|
|||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.json.JsonMapper;
|
||||
import com.fasterxml.jackson.databind.type.TypeFactory;
|
||||
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
|
||||
import org.apache.nifi.registry.client.NiFiRegistryClientConfig;
|
||||
import org.apache.nifi.registry.db.DatabaseProfileValueSource;
|
||||
|
@ -28,8 +30,8 @@ import org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonP
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.test.context.TestConfiguration;
|
||||
import org.springframework.boot.test.web.server.LocalServerPort;
|
||||
import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory;
|
||||
import org.springframework.boot.web.server.LocalServerPort;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.test.annotation.ProfileValueSourceConfiguration;
|
||||
|
||||
|
@ -210,11 +212,12 @@ public abstract class IntegrationTestBase {
|
|||
private static JacksonJaxbJsonProvider jacksonJaxbJsonProvider() {
|
||||
JacksonJaxbJsonProvider jacksonJaxbJsonProvider = new JacksonJaxbJsonProvider();
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.setPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL));
|
||||
mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector(mapper.getTypeFactory()));
|
||||
// Ignore unknown properties so that deployed client remain compatible with future versions of NiFi Registry that add new fields
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
ObjectMapper mapper = JsonMapper.builder()
|
||||
.defaultPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL))
|
||||
.annotationIntrospector(new JaxbAnnotationIntrospector(TypeFactory.defaultInstance()))
|
||||
// Ignore unknown properties so that deployed client remain compatible with future versions of NiFi Registry that add new fields
|
||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
||||
.build();
|
||||
|
||||
jacksonJaxbJsonProvider.setMapper(mapper);
|
||||
return jacksonJaxbJsonProvider;
|
||||
|
|
|
@ -110,7 +110,7 @@ public class SecureFileIT extends IntegrationTestBase {
|
|||
|
||||
// Given: the server has been configured with FileUserGroupProvider, which is configurable,
|
||||
// and: the initial admin client wants to create a tenant
|
||||
Long initialVersion = new Long(0);
|
||||
Long initialVersion = Long.valueOf(0);
|
||||
String clientId = UUID.randomUUID().toString();
|
||||
RevisionInfo revisionInfo = new RevisionInfo(clientId, initialVersion);
|
||||
|
||||
|
@ -152,7 +152,7 @@ public class SecureFileIT extends IntegrationTestBase {
|
|||
|
||||
// Given: the server has been configured with FileUserGroupProvider, which is configurable,
|
||||
// and: the initial admin client wants to create a tenant
|
||||
Long initialVersion = new Long(0);
|
||||
Long initialVersion = Long.valueOf(0);
|
||||
String clientId = UUID.randomUUID().toString();
|
||||
RevisionInfo revisionInfo = new RevisionInfo(clientId, initialVersion);
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ public class TenantResourceTest {
|
|||
public void testDeleteUser() {
|
||||
HttpServletRequest request = mock(HttpServletRequest.class);
|
||||
User user = new User("identifier", "identity");
|
||||
Long version = new Long(0);
|
||||
Long version = Long.valueOf(0);
|
||||
ClientIdParameter clientId = new ClientIdParameter();
|
||||
|
||||
when(serviceFacade.deleteUser(eq(user.getIdentifier()), any(RevisionInfo.class))).thenReturn(user);
|
||||
|
@ -152,7 +152,7 @@ public class TenantResourceTest {
|
|||
public void testDeleteUserGroup() {
|
||||
HttpServletRequest request = mock(HttpServletRequest.class);
|
||||
UserGroup userGroup = new UserGroup("identifier", "identity");
|
||||
Long version = new Long(0);
|
||||
Long version = Long.valueOf(0);
|
||||
ClientIdParameter clientId = new ClientIdParameter();
|
||||
|
||||
when(serviceFacade.deleteUserGroup(eq(userGroup.getIdentifier()), any(RevisionInfo.class))).thenReturn(userGroup);
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.apache.nifi.registry.client.NiFiRegistryClient;
|
|||
import org.apache.nifi.registry.client.NiFiRegistryClientConfig;
|
||||
import org.apache.nifi.registry.client.NiFiRegistryException;
|
||||
import org.apache.nifi.registry.client.impl.JerseyNiFiRegistryClient;
|
||||
import org.apache.nifi.registry.client.impl.request.ProxiedEntityRequestConfig;
|
||||
import org.apache.nifi.flow.VersionedFlowCoordinates;
|
||||
import org.apache.nifi.registry.flow.VersionedFlowSnapshot;
|
||||
import org.apache.nifi.flow.VersionedProcessGroup;
|
||||
|
@ -72,14 +73,14 @@ public class RegistryUtil {
|
|||
private FlowClient getFlowClient(final NiFiUser user) {
|
||||
final String identity = getIdentity(user);
|
||||
final NiFiRegistryClient registryClient = getRegistryClient();
|
||||
final FlowClient flowClient = identity == null ? registryClient.getFlowClient() : registryClient.getFlowClient(identity);
|
||||
final FlowClient flowClient = identity == null ? registryClient.getFlowClient() : registryClient.getFlowClient(new ProxiedEntityRequestConfig(identity));
|
||||
return flowClient;
|
||||
}
|
||||
|
||||
private FlowSnapshotClient getFlowSnapshotClient(final NiFiUser user) {
|
||||
final String identity = getIdentity(user);
|
||||
final NiFiRegistryClient registryClient = getRegistryClient();
|
||||
final FlowSnapshotClient snapshotClient = identity == null ? registryClient.getFlowSnapshotClient() : registryClient.getFlowSnapshotClient(identity);
|
||||
final FlowSnapshotClient snapshotClient = identity == null ? registryClient.getFlowSnapshotClient() : registryClient.getFlowSnapshotClient(new ProxiedEntityRequestConfig(identity));
|
||||
return snapshotClient;
|
||||
}
|
||||
|
||||
|
|
|
@ -197,12 +197,6 @@ public class NiFiRegistryClientFactory implements ClientFactory<NiFiRegistryClie
|
|||
return client.getBucketClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BucketClient getBucketClient(String... proxiedEntities) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntities);
|
||||
return client.getBucketClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BucketClient getBucketClient(RequestConfig requestConfig) {
|
||||
return client.getBucketClient(requestConfig);
|
||||
|
@ -215,12 +209,6 @@ public class NiFiRegistryClientFactory implements ClientFactory<NiFiRegistryClie
|
|||
return client.getFlowClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowClient getFlowClient(String... proxiedEntities) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntities);
|
||||
return client.getFlowClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowClient getFlowClient(RequestConfig requestConfig) {
|
||||
return client.getFlowClient(requestConfig);
|
||||
|
@ -233,12 +221,6 @@ public class NiFiRegistryClientFactory implements ClientFactory<NiFiRegistryClie
|
|||
return client.getFlowSnapshotClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowSnapshotClient getFlowSnapshotClient(String... proxiedEntities) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntities);
|
||||
return client.getFlowSnapshotClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowSnapshotClient getFlowSnapshotClient(RequestConfig requestConfig) {
|
||||
return client.getFlowSnapshotClient(requestConfig);
|
||||
|
@ -251,12 +233,6 @@ public class NiFiRegistryClientFactory implements ClientFactory<NiFiRegistryClie
|
|||
return client.getItemsClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemsClient getItemsClient(String... proxiedEntities) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntities);
|
||||
return client.getItemsClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemsClient getItemsClient(RequestConfig requestConfig) {
|
||||
return client.getItemsClient(requestConfig);
|
||||
|
@ -269,12 +245,6 @@ public class NiFiRegistryClientFactory implements ClientFactory<NiFiRegistryClie
|
|||
return client.getUserClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserClient getUserClient(String... proxiedEntities) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntities);
|
||||
return client.getUserClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserClient getUserClient(RequestConfig requestConfig) {
|
||||
return client.getUserClient(requestConfig);
|
||||
|
@ -287,12 +257,6 @@ public class NiFiRegistryClientFactory implements ClientFactory<NiFiRegistryClie
|
|||
return client.getBundleClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BundleClient getBundleClient(String... proxiedEntities) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntities);
|
||||
return client.getBundleClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BundleClient getBundleClient(RequestConfig requestConfig) {
|
||||
return client.getBundleClient(requestConfig);
|
||||
|
@ -305,12 +269,6 @@ public class NiFiRegistryClientFactory implements ClientFactory<NiFiRegistryClie
|
|||
return client.getBundleVersionClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BundleVersionClient getBundleVersionClient(String... proxiedEntities) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntities);
|
||||
return client.getBundleVersionClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BundleVersionClient getBundleVersionClient(RequestConfig requestConfig) {
|
||||
return client.getBundleVersionClient(requestConfig);
|
||||
|
@ -323,12 +281,6 @@ public class NiFiRegistryClientFactory implements ClientFactory<NiFiRegistryClie
|
|||
return client.getExtensionRepoClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExtensionRepoClient getExtensionRepoClient(String... proxiedEntities) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntities);
|
||||
return client.getExtensionRepoClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExtensionRepoClient getExtensionRepoClient(RequestConfig requestConfig) {
|
||||
return client.getExtensionRepoClient(requestConfig);
|
||||
|
@ -341,12 +293,6 @@ public class NiFiRegistryClientFactory implements ClientFactory<NiFiRegistryClie
|
|||
return client.getExtensionClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExtensionClient getExtensionClient(String... proxiedEntities) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntities);
|
||||
return client.getExtensionClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExtensionClient getExtensionClient(RequestConfig requestConfig) {
|
||||
return client.getExtensionClient(requestConfig);
|
||||
|
@ -359,12 +305,6 @@ public class NiFiRegistryClientFactory implements ClientFactory<NiFiRegistryClie
|
|||
return client.getTenantsClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TenantsClient getTenantsClient(String... proxiedEntities) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntities);
|
||||
return client.getTenantsClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TenantsClient getTenantsClient(RequestConfig requestConfig) {
|
||||
return client.getTenantsClient(requestConfig);
|
||||
|
@ -377,12 +317,6 @@ public class NiFiRegistryClientFactory implements ClientFactory<NiFiRegistryClie
|
|||
return client.getPoliciesClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PoliciesClient getPoliciesClient(String... proxiedEntities) {
|
||||
final RequestConfig requestConfig = new ProxiedEntityRequestConfig(proxiedEntities);
|
||||
return client.getPoliciesClient(requestConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PoliciesClient getPoliciesClient(RequestConfig requestConfig) {
|
||||
return client.getPoliciesClient(requestConfig);
|
||||
|
|
Loading…
Reference in New Issue