Package org.platformlayer.xaas.web.resources

Source Code of org.platformlayer.xaas.web.resources.TagsResource

package org.platformlayer.xaas.web.resources;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Produces;

import org.platformlayer.RepositoryException;
import org.platformlayer.core.model.ItemBase;
import org.platformlayer.core.model.TagChanges;
import org.platformlayer.core.model.Tags;
import org.platformlayer.xaas.services.ModelClass;

public class TagsResource extends XaasResourceBase {
  @GET
  @Produces({ XML, JSON })
  public Tags listTags() throws RepositoryException {
    boolean fetchTags = true;
    ItemBase managedItem = getManagedItem(fetchTags);

    Tags tags = managedItem.getTags();

    cleanup(tags);
    return tags;
  }

  @POST
  @Consumes({ XML, JSON })
  @Produces({ XML, JSON })
  public Tags changeTags(TagChanges changeTags) throws RepositoryException {
    ModelClass<?> modelClass = getModelClass();

    Tags tags = repository.changeTags(modelClass, getProject(), getItemId(), changeTags, null);

    cleanup(tags);
    return tags;
  }
}
TOP

Related Classes of org.platformlayer.xaas.web.resources.TagsResource

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.