use of eu.esdihumboldt.hale.io.haleconnect.BasePathResolver in project hale by halestudio.
the class HaleConnectProjectWriter method prettifyTarget.
private URI prettifyTarget(URI targetUri) {
try {
BasePathResolver resolver = (BasePathResolver) haleConnect;
Owner owner = HaleConnectUrnBuilder.extractProjectOwner(targetUri);
String projectId = HaleConnectUrnBuilder.extractProjectId(targetUri);
String clientBasePath = resolver.getBasePath(HaleConnectServices.WEB_CLIENT);
return HaleConnectUrnBuilder.buildClientAccessUrl(clientBasePath, owner, projectId);
} catch (Throwable t) {
return targetUri;
}
}
use of eu.esdihumboldt.hale.io.haleconnect.BasePathResolver in project hale by halestudio.
the class HaleConnectProjectWriter method createReporter.
/**
* @see IOProvider#createReporter()
*/
@Override
public IOReporter createReporter() {
if (!(haleConnect instanceof BasePathResolver) || !HaleConnectUrnBuilder.isValidProjectUrn(getTarget().getLocation())) {
return super.createReporter();
}
try {
URI targetUri = getTarget().getLocation();
Locatable prettifiedTarget = new LocatableURI(prettifyTarget(targetUri));
return new DefaultIOReporter(prettifiedTarget, MessageFormat.format("{0} export", getTypeName()), getActionId(), true);
} catch (Throwable t) {
return super.createReporter();
}
}
use of eu.esdihumboldt.hale.io.haleconnect.BasePathResolver in project hale by halestudio.
the class HaleConnectProjectReader method createReporter.
/**
* @see eu.esdihumboldt.hale.common.core.io.impl.AbstractImportProvider#createReporter()
*/
@Override
public IOReporter createReporter() {
if (!(getSource() instanceof HaleConnectInputSupplier) || !HaleConnectUrnBuilder.isValidProjectUrn(getSource().getLocation())) {
return super.createReporter();
}
try {
BasePathResolver resolver = ((HaleConnectInputSupplier) getSource()).getBasePathResolver();
URI sourceUri = getSource().getLocation();
Owner owner = HaleConnectUrnBuilder.extractProjectOwner(sourceUri);
String projectId = HaleConnectUrnBuilder.extractProjectId(sourceUri);
String clientBasePath = resolver.getBasePath(HaleConnectServices.WEB_CLIENT);
Locatable prettifiedTarget = new LocatableURI(HaleConnectUrnBuilder.buildClientAccessUrl(clientBasePath, owner, projectId));
return new DefaultIOReporter(prettifiedTarget, MessageFormat.format("{0} import", getTypeName()), getActionId(), true);
} catch (Throwable t) {
return super.createReporter();
}
}
Aggregations