use of com.haleconnect.api.projectstore.v1.model.NewBucket 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