use of com.haleconnect.api.projectstore.v1.api.BucketsApi in project hale by halestudio.
the class HaleConnectInputSupplier method getLastModified.
/**
* @return details on the hale connect project
*/
public Long getLastModified() {
if (lastModified == null) {
Owner owner = HaleConnectUrnBuilder.extractProjectOwner(getLocation());
String projectId = HaleConnectUrnBuilder.extractProjectId(getLocation());
final BucketsApi api = ProjectStoreHelper.getBucketsApi(basePathResolver, apiKey);
final ApiResponse<BucketDetail> response;
try {
response = api.getBucketInfoWithHttpInfo(owner.getType().getJsonValue(), owner.getId(), projectId);
lastModified = response.getData().getLastModified();
} catch (ApiException e) {
// Not fatal
}
}
return lastModified;
}
use of com.haleconnect.api.projectstore.v1.api.BucketsApi in project hale by halestudio.
the class HaleConnectServiceImpl method setProjectSharingOptions.
@Override
public boolean setProjectSharingOptions(String projectId, Owner owner, SharingOptions options) throws HaleConnectException {
BucketsApi bucketsApi = ProjectStoreHelper.getBucketsApi(this, this.getSession().getToken());
Feedback feedback;
try {
feedback = bucketsApi.setBucketProperty(owner.getType().getJsonValue(), owner.getId(), projectId, "sharingOptions", options);
} catch (com.haleconnect.api.projectstore.v1.ApiException e) {
throw new HaleConnectException(e.getMessage(), e);
}
if (feedback.getError()) {
log.error(MessageFormat.format("Error setting sharing options for hale connect project {0}", projectId));
return false;
}
return true;
}
use of com.haleconnect.api.projectstore.v1.api.BucketsApi in project hale by halestudio.
the class HaleConnectServiceImpl method createProject.
/**
* @see eu.esdihumboldt.hale.io.haleconnect.HaleConnectService#createProject(java.lang.String,
* java.lang.String, eu.esdihumboldt.hale.io.haleconnect.Owner,
* boolean)
*/
@Override
public String createProject(String name, String author, Owner owner, boolean versionControl) throws HaleConnectException {
if (!this.isLoggedIn()) {
throw new HaleConnectException("Not logged in");
}
String apiKey = this.getSession().getToken();
NewBucket newBucket = new NewBucket();
newBucket.setName(name);
newBucket.setVersionControl(versionControl);
final BucketIdent id;
try {
BucketsApi bucketsApi = ProjectStoreHelper.getBucketsApi(this, apiKey);
// POST /buckets
id = bucketsApi.createBucketWithOwner(owner.getType().getJsonValue(), owner.getId(), newBucket);
Owner bucketOwner = UserServiceHelper.toOwner(id.getUserId(), id.getOrgId());
// PUT /buckets/{ownerType}/{ownerId}/{bucketID}/p/author
bucketsApi.setBucketProperty(bucketOwner.getType().getJsonValue(), bucketOwner.getId(), id.getTransformationproject(), "author", author);
} catch (com.haleconnect.api.projectstore.v1.ApiException e) {
throw new HaleConnectException(e.getMessage(), e);
}
return id.getTransformationproject();
}
Aggregations