/** * {@inheritDoc} */ @Override public Field<Integer> field4() { return MdClassRelations.MD_CLASS_RELATIONS.TO_CLASS_ID; }
/** * {@inheritDoc} */ @Override public Field<String> field5() { return DjDeploymentRfc.DJ_DEPLOYMENT_RFC.COMMENTS; }
public boolean executeQuery(DSLContext dslContext, final List<Event> events) { InsertSetStep<?> insert = dslContext.insertInto(this.table); int mappedEvents = 0; for (Event event : events) { Map<Field<?>, Object> fieldValues = new HashMap<Field<?>, Object>(); /** * 커스텀 로직 * Log 전문에 대한 파싱을 통해 Key/Value Map을 만들고 결과를 Query에 바인딩 한다 */ Map<String, String> data = logSplitter.withKeyValueSeparator( itemSplitter ).split( new String( event.getBody(), StandardCharsets.UTF_8 ) ); for (Map.Entry<String, String> entry : data.entrySet()) { Field<?> field = table.field( entry.getKey() ); if (field == null) { log.trace("Ignoring field: {}", entry.getKey()); continue; } DataType<?> dataType = field.getDataType(); if ( dataType.getType().isAssignableFrom( Timestamp.class ) && !Strings.isNullOrEmpty( entry.getValue() ) ) { if ( entry.getValue().length() == FULL_DATE_FORMAT.length() ) { fieldValues.put(field, dataType.convert( DateTimeFormat.forPattern( FULL_DATE_FORMAT ).parseMillis( entry.getValue() ) )); } else if ( entry.getValue().length() == SEC_TIME_FORMAT.length() ) { fieldValues.put(field, dataType.convert( DateTimeFormat.forPattern( SEC_TIME_FORMAT ).parseMillis( entry.getValue() ) )); } } else { fieldValues.put(field, dataType.convert(entry.getValue())); } } if (fieldValues.isEmpty()) { log.debug("Ignoring event, no mapped fields."); } else { mappedEvents++; if (insert instanceof InsertSetMoreStep) { insert = ((InsertSetMoreStep<?>) insert).newRecord(); insert = (InsertSetStep<?>)insert.set(fieldValues); } } } if (insert instanceof InsertSetMoreStep) { int result = ((InsertSetMoreStep<?>) insert).execute(); if (result != mappedEvents) { log.warn("Mapped {} events, inserted {}.", mappedEvents, result); return false; } } else { log.debug("No insert."); } return true; }
/** * {@inheritDoc} */ @Override public Field<Timestamp> field8() { return CmCiAttributes.CM_CI_ATTRIBUTES.CREATED; }
/** * {@inheritDoc} */ @Override public Field<Integer> field3() { return DjDeploymentRfc.DJ_DEPLOYMENT_RFC.STATE_ID; }
/** * {@inheritDoc} */ @Override public Field<Boolean> field14() { return MdClassAttributes.MD_CLASS_ATTRIBUTES.IS_IMMUTABLE; }
default <Z> Observable<P> fetchObservable(Field<Z> field, Collection<Z> values) { return fetchObservable(field.in(values)); }
/** * {@inheritDoc} */ @Override public Field<Timestamp> field5() { return Groups.GROUPS.CREATED_AT; }
/** * {@inheritDoc} */ @Override public Field<String> field4() { return MdRelations.MD_RELATIONS.DESCRIPTION; }
/** * {@inheritDoc} */ @Override public Field<Short> field4() { return Something.SOMETHING.SOMESMALLNUMBER; }
/** * {@inheritDoc} */ @Override public Field<Long> field2() { return DjReleases.DJ_RELEASES.NS_ID; }
/** * {@inheritDoc} */ @Override public Field<String> field5() { return DjReleases.DJ_RELEASES.CREATED_BY; }
/** * {@inheritDoc} */ @Override public Field<Double> field6() { return Something.SOMETHING.SOMEDOUBLE; }
/** * {@inheritDoc} */ @Override public Field<Date> field4() { return Author.AUTHOR.DATE_OF_BIRTH; }
/** * {@inheritDoc} */ @Override public Field<Timestamp> field5() { return Invitations.INVITATIONS.CREATED_AT; }
private v3_Author(String alias, Table<v3_AuthorRecord> aliased, Field<?>[] parameters) { super(alias, null, aliased, parameters, ""); }
/** * {@inheritDoc} */ @Override public Field<String> field4() { return Authentications.AUTHENTICATIONS.UID; }
/** * {@inheritDoc} */ @Override public Field<String> field2() { return CmsEventType.CMS_EVENT_TYPE.EVENT_TYPE; }
/** * {@inheritDoc} */ @Override public Field<String> field4() { return v1_SchemaVersion.v1_SCHEMA_VERSION.v1_TYPE; }
/** * {@inheritDoc} */ @Override public Field<String> field4() { return SecUser.SEC_USER.S_EMAIL; }
/** * {@inheritDoc} */ @Override public Field<Integer> field9() { return SchemaVersion.SCHEMA_VERSION.EXECUTION_TIME; }
/** * {@inheritDoc} */ @Override public Field<Long> field1() { return CmCiRelations.CM_CI_RELATIONS.CI_RELATION_ID; }
/** * {@inheritDoc} */ @Override public Field<String> field2() { return DjDeploymentStates.DJ_DEPLOYMENT_STATES.STATE_NAME; }
/** * {@inheritDoc} */ @Override public Field<BigInteger> field2() { return Hashtags.HASHTAGS.TWEET_ID; }
/** * {@inheritDoc} */ @Override public Field<Integer> field9() { return v3_SchemaVersion.v3_SCHEMA_VERSION.v3_EXECUTION_TIME; }
/** * {@inheritDoc} */ @Override public Field<String> field7() { return DjRfcRelationAttributes.DJ_RFC_RELATION_ATTRIBUTES.COMMENTS; }
/** * {@inheritDoc} */ @Override public Field<String> field2() { return DjReleaseStates.DJ_RELEASE_STATES.STATE_NAME; }
/** * {@inheritDoc} */ @Override public Field<Timestamp> field6() { return MdClassActions.MD_CLASS_ACTIONS.CREATED; }
/** * {@inheritDoc} */ @Override public Field<Integer> field2() { return TeamsUsers.TEAMS_USERS.TEAM_ID; }
/** * {@inheritDoc} */ @Override public Field<Long> field1() { return DjReleaseRevLabel.DJ_RELEASE_REV_LABEL.RELEASE_ID; }
@Override public Optional<Field> getField() { return Optional.ofNullable(field); }
/** * {@inheritDoc} */ @Override public Field<String> field16() { return SecUser.SEC_USER.Z_LANGUAGE; }
private Author(String alias, Table<AuthorRecord> aliased, Field<?>[] parameters) { super(alias, null, aliased, parameters, ""); }
/** * {@inheritDoc} */ @Override public Field<Integer> field4() { return DjDeploymentStateHist.DJ_DEPLOYMENT_STATE_HIST.NEW_STATE_ID; }
/** * {@inheritDoc} */ @Override public Field<Timestamp> field11() { return CmOpsActions.CM_OPS_ACTIONS.CREATED; }
/** * {@inheritDoc} */ @Override public Field<String> field4() { return CiProxies.CI_PROXIES.CI_NAME; }
/** * {@inheritDoc} */ @Override public Field<String> field1() { return CrawlEntities.CRAWL_ENTITIES.NS_PATH; }
/** * {@inheritDoc} */ @Override public Field<Integer> field1() { return GroupMembers.GROUP_MEMBERS.ID; }
/** * {@inheritDoc} */ @Override public Field<Long> field2() { return NsOpt.NS_OPT.NS_ID; }
/** * {@inheritDoc} */ @Override public Field<String> field2() { return SchemaVersion.SCHEMA_VERSION.VERSION; }