Exemplo n.º 1
0
  // TODO: [AH] this should be pre-initialized in ObjectTemplate
  private EnumSet<AttributeType> getAttributeTypesAfter(
      final ObjectTemplate objectTemplate, final AttributeType attributeType) {
    final EnumSet<AttributeType> beforeAttributes = EnumSet.noneOf(AttributeType.class);
    final List<AttributeTemplate> attributeTemplates = objectTemplate.getAttributeTemplates();

    for (int i = 0; i < attributeTemplates.size(); i++) {
      final AttributeType templateType = attributeTemplates.get(i).getAttributeType();

      if (templateType == attributeType) {
        for (; i < attributeTemplates.size(); i++) {
          beforeAttributes.add(attributeTemplates.get(i).getAttributeType());
        }
      }
    }
    return beforeAttributes;
  }
Exemplo n.º 2
0
  /**
   * determine type by first type attribute present in object, then add attribute according to
   * attribute order in template.
   */
  public RpslObjectBuilder addAttributeSorted(final RpslAttribute newAttribute) {
    final ObjectType objectType = getType();
    final ObjectTemplate objectTemplate = ObjectTemplate.getTemplate(objectType);
    final EnumSet<AttributeType> attributesAfter =
        getAttributeTypesAfter(objectTemplate, newAttribute.getType());

    for (int i = 0; i < attributes.size(); i++) {
      if (attributesAfter.contains(attributes.get(i).getType())) {
        attributes.add(i, newAttribute);
        return this;
      }
    }

    attributes.add(newAttribute);
    return this;
  }
Exemplo n.º 3
0
  protected void init() {
    final ArrayList<ObjectTemplateWithChanged> objectTemplates =
        Lists.newArrayList(
            new ObjectTemplateWithChanged(
                ObjectType.AS_BLOCK,
                7,
                new AttributeTemplate(AS_BLOCK, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(DESCR, OPTIONAL, MULTIPLE),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(ORG, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_LOWER, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)),
            new ObjectTemplateWithChanged(
                ObjectType.AS_SET,
                9,
                new AttributeTemplate(AS_SET, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(DESCR, MANDATORY, MULTIPLE),
                new AttributeTemplate(MEMBERS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(MBRS_BY_REF, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(ORG, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(TECH_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(ADMIN_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_LOWER, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)),
            new ObjectTemplateWithChanged(
                ObjectType.AUT_NUM,
                8,
                new AttributeTemplate(AUT_NUM, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(AS_NAME, MANDATORY, SINGLE),
                new AttributeTemplate(DESCR, MANDATORY, MULTIPLE),
                new AttributeTemplate(MEMBER_OF, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(IMPORT_VIA, OPTIONAL, MULTIPLE, USER_ORDER),
                new AttributeTemplate(IMPORT, OPTIONAL, MULTIPLE, USER_ORDER),
                new AttributeTemplate(MP_IMPORT, OPTIONAL, MULTIPLE, USER_ORDER),
                new AttributeTemplate(EXPORT_VIA, OPTIONAL, MULTIPLE, USER_ORDER),
                new AttributeTemplate(EXPORT, OPTIONAL, MULTIPLE, USER_ORDER),
                new AttributeTemplate(MP_EXPORT, OPTIONAL, MULTIPLE, USER_ORDER),
                new AttributeTemplate(DEFAULT, OPTIONAL, MULTIPLE, USER_ORDER),
                new AttributeTemplate(MP_DEFAULT, OPTIONAL, MULTIPLE, USER_ORDER),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(ORG, OPTIONAL, SINGLE, INVERSE_KEY),
                new AttributeTemplate(SPONSORING_ORG, OPTIONAL, SINGLE),
                new AttributeTemplate(ADMIN_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(TECH_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(STATUS, GENERATED, SINGLE),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_LOWER, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_ROUTES, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)),
            new ObjectTemplateWithChanged(
                ObjectType.DOMAIN,
                30,
                new AttributeTemplate(DOMAIN, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(DESCR, MANDATORY, MULTIPLE),
                new AttributeTemplate(ORG, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(ADMIN_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(TECH_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(ZONE_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(NSERVER, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(DS_RDATA, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)),
            new ObjectTemplateWithChanged(
                ObjectType.FILTER_SET,
                21,
                new AttributeTemplate(FILTER_SET, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(DESCR, MANDATORY, MULTIPLE),
                new AttributeTemplate(FILTER, OPTIONAL, SINGLE),
                new AttributeTemplate(MP_FILTER, OPTIONAL, SINGLE),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(ORG, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(TECH_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(ADMIN_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_LOWER, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)),
            new ObjectTemplateWithChanged(
                ObjectType.INET_RTR,
                15,
                new AttributeTemplate(INET_RTR, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(DESCR, MANDATORY, MULTIPLE),
                new AttributeTemplate(ALIAS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(LOCAL_AS, MANDATORY, SINGLE, INVERSE_KEY),
                new AttributeTemplate(IFADDR, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(INTERFACE, OPTIONAL, MULTIPLE),
                new AttributeTemplate(PEER, OPTIONAL, MULTIPLE),
                new AttributeTemplate(MP_PEER, OPTIONAL, MULTIPLE),
                new AttributeTemplate(MEMBER_OF, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(ORG, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(ADMIN_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(TECH_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)),
            new ObjectTemplateWithChanged(
                ObjectType.INET6NUM,
                6,
                new AttributeTemplate(INET6NUM, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(NETNAME, MANDATORY, SINGLE, LOOKUP_KEY),
                new AttributeTemplate(DESCR, MANDATORY, MULTIPLE),
                new AttributeTemplate(COUNTRY, MANDATORY, MULTIPLE),
                new AttributeTemplate(GEOLOC, OPTIONAL, SINGLE),
                new AttributeTemplate(LANGUAGE, OPTIONAL, MULTIPLE),
                new AttributeTemplate(ORG, OPTIONAL, SINGLE, INVERSE_KEY),
                new AttributeTemplate(SPONSORING_ORG, OPTIONAL, SINGLE),
                new AttributeTemplate(ADMIN_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(TECH_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(STATUS, MANDATORY, SINGLE),
                new AttributeTemplate(ASSIGNMENT_SIZE, OPTIONAL, SINGLE),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_LOWER, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_ROUTES, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_DOMAINS, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_IRT, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)),
            new ObjectTemplateWithChanged(
                ObjectType.INETNUM,
                5,
                new AttributeTemplate(INETNUM, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(NETNAME, MANDATORY, SINGLE, LOOKUP_KEY),
                new AttributeTemplate(DESCR, MANDATORY, MULTIPLE),
                new AttributeTemplate(COUNTRY, MANDATORY, MULTIPLE),
                new AttributeTemplate(GEOLOC, OPTIONAL, SINGLE),
                new AttributeTemplate(LANGUAGE, OPTIONAL, MULTIPLE),
                new AttributeTemplate(ORG, OPTIONAL, SINGLE, INVERSE_KEY),
                new AttributeTemplate(SPONSORING_ORG, OPTIONAL, SINGLE),
                new AttributeTemplate(ADMIN_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(TECH_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(STATUS, MANDATORY, SINGLE),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_LOWER, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_DOMAINS, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_ROUTES, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_IRT, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)),
            new ObjectTemplateWithChanged(
                ObjectType.IRT,
                41,
                new AttributeTemplate(IRT, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(ADDRESS, MANDATORY, MULTIPLE),
                new AttributeTemplate(PHONE, OPTIONAL, MULTIPLE),
                new AttributeTemplate(FAX_NO, OPTIONAL, MULTIPLE),
                new AttributeTemplate(E_MAIL, MANDATORY, MULTIPLE, LOOKUP_KEY),
                new AttributeTemplate(ABUSE_MAILBOX, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(SIGNATURE, OPTIONAL, MULTIPLE),
                new AttributeTemplate(ENCRYPTION, OPTIONAL, MULTIPLE),
                new AttributeTemplate(ORG, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(ADMIN_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(TECH_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(AUTH, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(IRT_NFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)),
            new ObjectTemplateWithChanged(
                ObjectType.KEY_CERT,
                45,
                new AttributeTemplate(KEY_CERT, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(METHOD, GENERATED, SINGLE),
                new AttributeTemplate(OWNER, GENERATED, MULTIPLE),
                new AttributeTemplate(FINGERPR, GENERATED, SINGLE, INVERSE_KEY),
                new AttributeTemplate(CERTIF, MANDATORY, MULTIPLE),
                new AttributeTemplate(ORG, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(ADMIN_C, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(TECH_C, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)),
            new ObjectTemplateWithChanged(
                ObjectType.MNTNER,
                40,
                new AttributeTemplate(MNTNER, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(DESCR, MANDATORY, MULTIPLE),
                new AttributeTemplate(ORG, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(ADMIN_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(TECH_C, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(UPD_TO, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_NFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(AUTH, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(ABUSE_MAILBOX, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)),
            new ObjectTemplateWithChanged(
                ObjectType.ORGANISATION,
                48,
                new AttributeTemplate(ORGANISATION, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(ORG_NAME, MANDATORY, SINGLE, LOOKUP_KEY),
                new AttributeTemplate(ORG_TYPE, MANDATORY, SINGLE),
                new AttributeTemplate(DESCR, OPTIONAL, MULTIPLE),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(ADDRESS, MANDATORY, MULTIPLE),
                new AttributeTemplate(PHONE, OPTIONAL, MULTIPLE),
                new AttributeTemplate(FAX_NO, OPTIONAL, MULTIPLE),
                new AttributeTemplate(E_MAIL, MANDATORY, MULTIPLE, LOOKUP_KEY),
                new AttributeTemplate(GEOLOC, OPTIONAL, SINGLE),
                new AttributeTemplate(LANGUAGE, OPTIONAL, MULTIPLE),
                new AttributeTemplate(ORG, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(ADMIN_C, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(TECH_C, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(ABUSE_C, OPTIONAL, SINGLE, INVERSE_KEY),
                new AttributeTemplate(REF_NFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_REF, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(ABUSE_MAILBOX, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)),
            new ObjectTemplateWithChanged(
                ObjectType.PEERING_SET,
                22,
                new AttributeTemplate(PEERING_SET, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(DESCR, MANDATORY, MULTIPLE),
                new AttributeTemplate(PEERING, OPTIONAL, MULTIPLE),
                new AttributeTemplate(MP_PEERING, OPTIONAL, MULTIPLE),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(ORG, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(TECH_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(ADMIN_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_LOWER, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)),
            new ObjectTemplateWithChanged(
                ObjectType.PERSON,
                50,
                new AttributeTemplate(PERSON, MANDATORY, SINGLE, LOOKUP_KEY),
                new AttributeTemplate(ADDRESS, MANDATORY, MULTIPLE),
                new AttributeTemplate(PHONE, MANDATORY, MULTIPLE),
                new AttributeTemplate(FAX_NO, OPTIONAL, MULTIPLE),
                new AttributeTemplate(E_MAIL, OPTIONAL, MULTIPLE, LOOKUP_KEY),
                new AttributeTemplate(ORG, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(NIC_HDL, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(ABUSE_MAILBOX, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)),
            new ObjectTemplateWithChanged(
                ObjectType.POEM,
                37,
                new AttributeTemplate(POEM, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(DESCR, OPTIONAL, MULTIPLE),
                new AttributeTemplate(FORM, MANDATORY, SINGLE, INVERSE_KEY),
                new AttributeTemplate(TEXT, MANDATORY, MULTIPLE),
                new AttributeTemplate(AUTHOR, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, SINGLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)),
            new ObjectTemplateWithChanged(
                ObjectType.POETIC_FORM,
                36,
                new AttributeTemplate(POETIC_FORM, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(DESCR, OPTIONAL, MULTIPLE),
                new AttributeTemplate(ADMIN_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)),
            new ObjectTemplateWithChanged(
                ObjectType.ROLE,
                49,
                new AttributeTemplate(ROLE, MANDATORY, SINGLE, LOOKUP_KEY),
                new AttributeTemplate(ADDRESS, MANDATORY, MULTIPLE),
                new AttributeTemplate(PHONE, OPTIONAL, MULTIPLE),
                new AttributeTemplate(FAX_NO, OPTIONAL, MULTIPLE),
                new AttributeTemplate(E_MAIL, MANDATORY, MULTIPLE, LOOKUP_KEY),
                new AttributeTemplate(ORG, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(ADMIN_C, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(TECH_C, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(NIC_HDL, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(ABUSE_MAILBOX, OPTIONAL, SINGLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)),
            new ObjectTemplateWithChanged(
                ObjectType.ROUTE_SET,
                12,
                new AttributeTemplate(ROUTE_SET, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(DESCR, MANDATORY, MULTIPLE),
                new AttributeTemplate(MEMBERS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(MP_MEMBERS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(MBRS_BY_REF, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(ORG, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(TECH_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(ADMIN_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_LOWER, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)),
            new ObjectTemplateWithChanged(
                ObjectType.ROUTE,
                10,
                new AttributeTemplate(ROUTE, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(DESCR, MANDATORY, MULTIPLE),
                new AttributeTemplate(ORIGIN, MANDATORY, SINGLE, PRIMARY_KEY, INVERSE_KEY),
                new AttributeTemplate(PINGABLE, OPTIONAL, MULTIPLE),
                new AttributeTemplate(PING_HDL, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(HOLES, OPTIONAL, MULTIPLE),
                new AttributeTemplate(ORG, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MEMBER_OF, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(INJECT, OPTIONAL, MULTIPLE),
                new AttributeTemplate(AGGR_MTD, OPTIONAL, SINGLE),
                new AttributeTemplate(AGGR_BNDRY, OPTIONAL, SINGLE),
                new AttributeTemplate(EXPORT_COMPS, OPTIONAL, SINGLE),
                new AttributeTemplate(COMPONENTS, OPTIONAL, SINGLE),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_LOWER, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_ROUTES, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)),
            new ObjectTemplateWithChanged(
                ObjectType.ROUTE6,
                11,
                new AttributeTemplate(ROUTE6, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(DESCR, MANDATORY, MULTIPLE),
                new AttributeTemplate(ORIGIN, MANDATORY, SINGLE, PRIMARY_KEY, INVERSE_KEY),
                new AttributeTemplate(PINGABLE, OPTIONAL, MULTIPLE),
                new AttributeTemplate(PING_HDL, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(HOLES, OPTIONAL, MULTIPLE),
                new AttributeTemplate(ORG, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MEMBER_OF, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(INJECT, OPTIONAL, MULTIPLE),
                new AttributeTemplate(AGGR_MTD, OPTIONAL, SINGLE),
                new AttributeTemplate(AGGR_BNDRY, OPTIONAL, SINGLE),
                new AttributeTemplate(EXPORT_COMPS, OPTIONAL, SINGLE),
                new AttributeTemplate(COMPONENTS, OPTIONAL, SINGLE),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_LOWER, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_ROUTES, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)),
            new ObjectTemplateWithChanged(
                ObjectType.RTR_SET,
                23,
                new AttributeTemplate(RTR_SET, MANDATORY, SINGLE, PRIMARY_KEY, LOOKUP_KEY),
                new AttributeTemplate(DESCR, MANDATORY, MULTIPLE),
                new AttributeTemplate(MEMBERS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(MP_MEMBERS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(MBRS_BY_REF, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(REMARKS, OPTIONAL, MULTIPLE),
                new AttributeTemplate(ORG, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(TECH_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(ADMIN_C, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(NOTIFY, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_BY, MANDATORY, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(MNT_LOWER, OPTIONAL, MULTIPLE, INVERSE_KEY),
                new AttributeTemplate(CHANGED, DEPRECATED, MULTIPLE),
                new AttributeTemplate(CREATED, GENERATED, SINGLE),
                new AttributeTemplate(LAST_MODIFIED, GENERATED, SINGLE),
                new AttributeTemplate(SOURCE, MANDATORY, SINGLE)));

    final Map<ObjectType, ObjectTemplate> templateMap = Maps.newEnumMap(ObjectType.class);
    for (final ObjectTemplate objectTemplate : objectTemplates) {
      templateMap.put(objectTemplate.getObjectType(), objectTemplate);
    }

    TEMPLATE_MAP = Collections.unmodifiableMap(templateMap);
  }
Exemplo n.º 4
0
 /**
  * determine type by first type attribute present in object, then sort attributes according to
  * attribute order in template. This sort is guaranteed to be <i>stable</i>: equal elements will
  * not be reordered as a result of the sort.
  */
 public RpslObjectBuilder sort() {
   final ObjectType objectType = getType();
   Collections.sort(
       attributes, ObjectTemplate.getTemplate(objectType).getAttributeTypeComparator());
   return this;
 }