OneToManyAssociation.getCollectionSemantics
Code IndexAdd Codota to your IDE (free)

Best Java code snippets using org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation.getCollectionSemantics (Showing top 9 results out of 315)

origin: org.apache.isis.viewer/isis-viewer-restfulobjects-rendering

public static CollectionSemantics determine(final OneToManyAssociation collection) {
  return collection.getCollectionSemantics().isSet() ? CollectionSemantics.SET : CollectionSemantics.LIST;
}
origin: org.apache.isis.core/isis-core-viewer-restfulobjects-rendering

public static CollectionSemantics determine(final OneToManyAssociation collection) {
  return collection.getCollectionSemantics().isSet() ? CollectionSemantics.SET : CollectionSemantics.LIST;
}
origin: org.apache.isis.viewer/isis-viewer-restfulobjects-impl

public static CollectionSemantics determine(final ResourceContext resourceContext, final OneToManyAssociation collection) {
  return collection.getCollectionSemantics().isSet() ? CollectionSemantics.SET : CollectionSemantics.LIST;
}
origin: org.apache.isis.viewer/isis-viewer-restfulobjects-server

@Override
@POST
@Path("/{domainType}/{instanceId}/collections/{collectionId}")
@Consumes({ MediaType.WILDCARD })
@Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ERROR })
public Response addToList(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("collectionId") final String collectionId, final InputStream body) {
  init(Where.PARENTED_TABLES);
  final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, instanceId);
  final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
  final OneToManyAssociation collection = helper.getCollectionThatIsVisibleForIntent(collectionId, Intent.MUTATE, getResourceContext().getWhere());
  if (!collection.getCollectionSemantics().isListOrArray()) {
    throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.METHOD_NOT_ALLOWED, "Collection '%s' does not have list or array semantics", collectionId);
  }
  final ObjectSpecification collectionSpec = collection.getSpecification();
  final String bodyAsString = DomainResourceHelper.asStringUtf8(body);
  final ObjectAdapter argAdapter = helper.parseAsMapWithSingleValue(collectionSpec, bodyAsString);
  final Consent consent = collection.isValidToAdd(objectAdapter, argAdapter);
  if (consent.isVetoed()) {
    throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.UNAUTHORIZED, consent.getReason());
  }
  collection.addElement(objectAdapter, argAdapter);
  return helper.collectionDetails(collectionId, MemberMode.MUTATING, Caching.NONE, getResourceContext().getWhere());
}
origin: org.apache.isis.viewer/isis-viewer-restfulobjects-impl

@Override
@PUT
@Path("/{oid}/collections/{collectionId}")
@Consumes({ MediaType.WILDCARD })
@Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ERROR })
public Response addToSet(@PathParam("oid") final String oidStr, @PathParam("collectionId") final String collectionId, final InputStream body) {
  init(Where.PARENTED_TABLES);
  final ObjectAdapter objectAdapter = getObjectAdapter(oidStr);
  final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
  final OneToManyAssociation collection = helper.getCollectionThatIsVisibleAndUsable(collectionId, Intent.MUTATE, getResourceContext().getWhere());
  if (!collection.getCollectionSemantics().isSet()) {
    throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, "Collection '%s' does not have set semantics", collectionId);
  }
  final ObjectSpecification collectionSpec = collection.getSpecification();
  final String bodyAsString = DomainResourceHelper.asStringUtf8(body);
  final ObjectAdapter argAdapter = helper.parseAsMapWithSingleValue(collectionSpec, bodyAsString);
  final Consent consent = collection.isValidToAdd(objectAdapter, argAdapter);
  if (consent.isVetoed()) {
    throw RestfulObjectsApplicationException.create(HttpStatusCode.UNAUTHORIZED, consent.getReason());
  }
  collection.addElement(objectAdapter, argAdapter);
  return helper.collectionDetails(objectAdapter, collectionId, MemberMode.MUTATING, Caching.NONE, getResourceContext().getWhere());
}
origin: org.apache.isis.viewer/isis-viewer-restfulobjects-server

@Override
@PUT
@Path("/{domainType}/{instanceId}/collections/{collectionId}")
@Consumes({ MediaType.WILDCARD })
@Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ERROR })
public Response addToSet(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("collectionId") final String collectionId, final InputStream body) {
  init(Where.PARENTED_TABLES);
  final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, instanceId);
  final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
  final OneToManyAssociation collection = helper.getCollectionThatIsVisibleForIntent(collectionId, Intent.MUTATE, getResourceContext().getWhere());
  if (!collection.getCollectionSemantics().isSet()) {
    throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.BAD_REQUEST, "Collection '%s' does not have set semantics", collectionId);
  }
  final ObjectSpecification collectionSpec = collection.getSpecification();
  final String bodyAsString = DomainResourceHelper.asStringUtf8(body);
  final ObjectAdapter argAdapter = helper.parseAsMapWithSingleValue(collectionSpec, bodyAsString);
  final Consent consent = collection.isValidToAdd(objectAdapter, argAdapter);
  if (consent.isVetoed()) {
    throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.UNAUTHORIZED, consent.getReason());
  }
  collection.addElement(objectAdapter, argAdapter);
  return helper.collectionDetails(collectionId, MemberMode.MUTATING, Caching.NONE, getResourceContext().getWhere());
}
origin: org.apache.isis.core/isis-core-viewer-restfulobjects-server

@Override
@POST
@Path("/{domainType}/{instanceId}/collections/{collectionId}")
@Consumes({ MediaType.WILDCARD })
@Produces({
    MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_JSON_ERROR,
    MediaType.APPLICATION_XML, RestfulMediaType.APPLICATION_XML_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_XML_ERROR
})
public Response addToList(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("collectionId") final String collectionId, final InputStream body) {
  init(Where.PARENTED_TABLES, RepresentationService.Intent.NOT_APPLICABLE);
  final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, instanceId);
  final DomainResourceHelper helper = newDomainResourceHelper(objectAdapter);
  final ObjectAdapterAccessHelper accessHelper = new ObjectAdapterAccessHelper(getResourceContext(), objectAdapter);
  final OneToManyAssociation collection = accessHelper.getCollectionThatIsVisibleForIntent(
      collectionId, ObjectAdapterAccessHelper.Intent.MUTATE);
  if (!collection.getCollectionSemantics().isListOrArray()) {
    throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.METHOD_NOT_ALLOWED, "Collection '%s' does not have list or array semantics", collectionId);
  }
  final ObjectSpecification collectionSpec = collection.getSpecification();
  final String bodyAsString = Util.asStringUtf8(body);
  final ObjectAdapter argAdapter = new JsonParserHelper(getResourceContext(), collectionSpec).parseAsMapWithSingleValue(
      bodyAsString);
  final Consent consent = collection.isValidToAdd(objectAdapter, argAdapter, InteractionInitiatedBy.USER);
  if (consent.isVetoed()) {
    throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.UNAUTHORIZED, consent.getReason());
  }
  collection.addElement(objectAdapter, argAdapter, InteractionInitiatedBy.USER);
  return helper.collectionDetails(collectionId, MemberReprMode.WRITE);
}
origin: org.apache.isis.core/isis-core-viewer-restfulobjects-server

@Override
@PUT
@Path("/{domainType}/{instanceId}/collections/{collectionId}")
@Consumes({ MediaType.WILDCARD })
@Produces({
    MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_JSON_ERROR,
    MediaType.APPLICATION_XML, RestfulMediaType.APPLICATION_XML_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_XML_ERROR
})
public Response addToSet(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("collectionId") final String collectionId, final InputStream body) {
  init(Where.PARENTED_TABLES, RepresentationService.Intent.NOT_APPLICABLE);
  final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, instanceId);
  final DomainResourceHelper helper = newDomainResourceHelper(objectAdapter);
  final ObjectAdapterAccessHelper accessHelper = new ObjectAdapterAccessHelper(getResourceContext(), objectAdapter);
  final OneToManyAssociation collection = accessHelper.getCollectionThatIsVisibleForIntent(
      collectionId, ObjectAdapterAccessHelper.Intent.MUTATE);
  if (!collection.getCollectionSemantics().isSet()) {
    throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.BAD_REQUEST, "Collection '%s' does not have set semantics", collectionId);
  }
  final ObjectSpecification collectionSpec = collection.getSpecification();
  final String bodyAsString = Util.asStringUtf8(body);
  final ObjectAdapter argAdapter = new JsonParserHelper(getResourceContext(), collectionSpec).parseAsMapWithSingleValue(
      bodyAsString);
  final Consent consent = collection.isValidToAdd(objectAdapter, argAdapter, InteractionInitiatedBy.USER);
  if (consent.isVetoed()) {
    throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.UNAUTHORIZED, consent.getReason());
  }
  collection.addElement(objectAdapter, argAdapter, InteractionInitiatedBy.USER);
  return helper.collectionDetails(collectionId, MemberReprMode.WRITE);
}
origin: org.apache.isis.viewer/isis-viewer-restfulobjects-impl

@Override
@POST
@Path("/{oid}/collections/{collectionId}")
@Consumes({ MediaType.WILDCARD })
@Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ERROR })
public Response addToList(@PathParam("oid") final String oidStr, @PathParam("collectionId") final String collectionId, final InputStream body) {
  init(Where.PARENTED_TABLES);
  final ObjectAdapter objectAdapter = getObjectAdapter(oidStr);
  final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
  final OneToManyAssociation collection = helper.getCollectionThatIsVisibleAndUsable(collectionId, Intent.MUTATE, getResourceContext().getWhere());
  if (!collection.getCollectionSemantics().isListOrArray()) {
    throw RestfulObjectsApplicationException.create(HttpStatusCode.METHOD_NOT_ALLOWED, "Collection '%s' does not have list or array semantics", collectionId);
  }
  final ObjectSpecification collectionSpec = collection.getSpecification();
  final String bodyAsString = DomainResourceHelper.asStringUtf8(body);
  final ObjectAdapter argAdapter = helper.parseAsMapWithSingleValue(collectionSpec, bodyAsString);
  final Consent consent = collection.isValidToAdd(objectAdapter, argAdapter);
  if (consent.isVetoed()) {
    throw RestfulObjectsApplicationException.create(HttpStatusCode.UNAUTHORIZED, consent.getReason());
  }
  collection.addElement(objectAdapter, argAdapter);
  return helper.collectionDetails(objectAdapter, collectionId, MemberMode.MUTATING, Caching.NONE, getResourceContext().getWhere());
}
org.apache.isis.core.metamodel.spec.featureOneToManyAssociationgetCollectionSemantics

Popular methods of OneToManyAssociation

  • get
  • getSpecification
  • addElement
  • removeElement
  • getFacet
  • getId
  • isValidToRemove
  • getName
  • isValidToAdd
  • getIdentifier
  • createValidateAddInteractionContext
    Creates an InteractionContext that represents validation of a candidate object to be added to the co
  • isAlwaysHidden
  • createValidateAddInteractionContext,
  • isAlwaysHidden,
  • isVisible

Popular in Java

  • Updating database using SQL prepared statement
  • setContentView (Activity)
  • runOnUiThread (Activity)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble

For IntelliJ IDEA,
Android Studio or Eclipse

  • Search for JavaScript code betaCodota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutBlogContact Us
  • Plugin user guideTerms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)