/**
   * Manufacture a new SchemaPermsDescriptor.
   *
   * @param sd
   * @param selectPerm
   * @param deletePerm
   * @param insertPerm
   * @param updatePerm
   * @param referencesPerm
   * @param triggerPerm
   * @param grantor
   * @return
   * @throws StandardException
   */
  public SchemaPermsDescriptor newSchemaPermsDescriptor(
      SchemaDescriptor sd,
      String selectPerm,
      String deletePerm,
      String insertPerm,
      String updatePerm,
      String referencesPerm,
      String triggerPerm,
      String grantor)
      throws StandardException {
    if ("N".equals(selectPerm)
        && "N".equals(deletePerm)
        && "N".equals(insertPerm)
        && "N".equals(updatePerm)
        && "N".equals(referencesPerm)
        && "N".equals(triggerPerm)) return null;

    return new SchemaPermsDescriptor(
        dataDictionary,
        (String) null,
        grantor,
        sd.getUUID(),
        selectPerm,
        deletePerm,
        insertPerm,
        updatePerm,
        referencesPerm,
        triggerPerm);
  }
示例#2
0
 protected void recomputeFacet(FacetDescriptor fd) {
   Set<String> fdSchemas = SchemaDescriptor.getSchemaNames(fd.schemas);
   registerFacet(fd.name, fdSchemas);
   if (Boolean.FALSE.equals(fd.perDocumentQuery)) {
     noPerDocumentQueryFacets.add(fd.name);
   }
 }
示例#3
0
  protected DocumentType recomputeDocumentType(
      String name, DocumentTypeDescriptor dtd, DocumentType parent) {
    // find the facets and schemas names
    Set<String> facetNames = new HashSet<>();
    Set<String> schemaNames = SchemaDescriptor.getSchemaNames(dtd.schemas);
    facetNames.addAll(Arrays.asList(dtd.facets));

    // inherited
    if (parent != null) {
      facetNames.addAll(parent.getFacets());
      schemaNames.addAll(Arrays.asList(parent.getSchemaNames()));
    }

    // add schemas names from facets
    for (String facetName : facetNames) {
      CompositeType ct = facets.get(facetName);
      if (ct == null) {
        log.warn("Undeclared facet: " + facetName + " used in document type: " + name);
        // register it with no schemas
        ct = registerFacet(facetName, Collections.<String>emptySet());
      }
      schemaNames.addAll(Arrays.asList(ct.getSchemaNames()));
    }

    // find the schemas
    List<Schema> docTypeSchemas = new ArrayList<>();
    for (String schemaName : schemaNames) {
      Schema schema = schemas.get(schemaName);
      if (schema == null) {
        log.error("Document type: " + name + " uses unknown schema: " + schemaName);
        continue;
      }
      docTypeSchemas.add(schema);
    }

    // create doctype
    PrefetchInfo prefetch = dtd.prefetch == null ? prefetchInfo : new PrefetchInfo(dtd.prefetch);
    DocumentTypeImpl docType =
        new DocumentTypeImpl(name, parent, docTypeSchemas, facetNames, prefetch);
    registerDocumentType(docType);

    return docType;
  }
 /**
  * Constructor. Used when creating a trigger from SYS.SYSTRIGGERS
  *
  * @param dataDictionary the data dictionary
  * @param sd the schema descriptor for this trigger
  * @param id the trigger id
  * @param name the trigger name
  * @param eventMask TriggerDescriptor.TRIGGER_EVENT_XXXX
  * @param isBefore is this a before (as opposed to after) trigger
  * @param isRow is this a row trigger or statement trigger
  * @param isEnabled is this trigger enabled or disabled
  * @param td the table upon which this trigger is defined
  * @param whenSPSId the sps id for the when clause (may be null)
  * @param actionSPSId the spsid for the trigger action (may be null)
  * @param creationTimestamp when was this trigger created?
  * @param referencedCols what columns does this trigger reference (may be null)
  * @param triggerDefinition The original user text of the trigger action
  * @param referencingOld whether or not OLD appears in REFERENCING clause
  * @param referencingNew whether or not NEW appears in REFERENCING clause
  * @param oldReferencingName old referencing table name, if any, that appears in REFERCING clause
  * @param newReferencingName new referencing table name, if any, that appears in REFERCING clause
  */
 public TriggerDescriptor(
     DataDictionary dataDictionary,
     SchemaDescriptor sd,
     UUID id,
     String name,
     int eventMask,
     boolean isBefore,
     boolean isRow,
     boolean isEnabled,
     TableDescriptor td,
     UUID whenSPSId,
     UUID actionSPSId,
     Timestamp creationTimestamp,
     int[] referencedCols,
     String triggerDefinition,
     boolean referencingOld,
     boolean referencingNew,
     String oldReferencingName,
     String newReferencingName) {
   super(dataDictionary);
   this.id = id;
   this.sd = sd;
   this.name = name;
   this.eventMask = eventMask;
   this.isBefore = isBefore;
   this.isRow = isRow;
   this.td = td;
   this.actionSPSId = actionSPSId;
   this.whenSPSId = whenSPSId;
   this.isEnabled = isEnabled;
   this.referencedCols = referencedCols;
   this.creationTimestamp = creationTimestamp;
   this.triggerDefinition = triggerDefinition;
   this.referencingOld = referencingOld;
   this.referencingNew = referencingNew;
   this.oldReferencingName = oldReferencingName;
   this.newReferencingName = newReferencingName;
   triggerSchemaId = sd.getUUID();
   triggerTableId = td.getUUID();
 }