Search in sources :

Example 1 with DataDeleteObjectTagging

use of com.pspace.ifs.ksan.gw.data.DataDeleteObjectTagging in project ksan by infinistor.

the class DeleteObjectTagging method process.

@Override
public void process() throws GWException {
    logger.info(GWConstants.LOG_DELETE_OBJECT_TAGGING_START);
    String bucket = s3Parameter.getBucketName();
    initBucketInfo(bucket);
    String object = s3Parameter.getObjectName();
    S3Bucket s3Bucket = new S3Bucket();
    s3Bucket.setCors(getBucketInfo().getCors());
    s3Bucket.setAccess(getBucketInfo().getAccess());
    s3Parameter.setBucket(s3Bucket);
    GWUtils.checkCors(s3Parameter);
    if (s3Parameter.isPublicAccess() && GWUtils.isIgnorePublicAcls(s3Parameter)) {
        throw new GWException(GWErrorCode.ACCESS_DENIED, s3Parameter);
    }
    DataDeleteObjectTagging dataDeleteObjectTagging = new DataDeleteObjectTagging(s3Parameter);
    dataDeleteObjectTagging.extract();
    String versionId = dataDeleteObjectTagging.getVersionId();
    Metadata objMeta = null;
    if (Strings.isNullOrEmpty(versionId)) {
        objMeta = open(bucket, object);
        versionId = objMeta.getVersionId();
    } else {
        objMeta = open(bucket, object, versionId);
    }
    objMeta.setAcl(GWUtils.makeOriginalXml(objMeta.getAcl(), s3Parameter));
    checkGrantObjectOwner(s3Parameter.isPublicAccess(), objMeta, String.valueOf(s3Parameter.getUser().getUserId()), GWConstants.GRANT_WRITE);
    objMeta.setTag("");
    updateObjectTagging(objMeta);
    s3Parameter.getResponse().addHeader(GWConstants.X_AMZ_VERSION_ID, dataDeleteObjectTagging.getVersionId());
    s3Parameter.getResponse().setStatus(HttpServletResponse.SC_NO_CONTENT);
}
Also used : S3Bucket(com.pspace.ifs.ksan.gw.identity.S3Bucket) DataDeleteObjectTagging(com.pspace.ifs.ksan.gw.data.DataDeleteObjectTagging) Metadata(com.pspace.ifs.ksan.objmanager.Metadata) GWException(com.pspace.ifs.ksan.gw.exception.GWException)

Aggregations

DataDeleteObjectTagging (com.pspace.ifs.ksan.gw.data.DataDeleteObjectTagging)1 GWException (com.pspace.ifs.ksan.gw.exception.GWException)1 S3Bucket (com.pspace.ifs.ksan.gw.identity.S3Bucket)1 Metadata (com.pspace.ifs.ksan.objmanager.Metadata)1