void flushAttributedTypes(FilePartition partition) { flush(partition, IDENTITY_TYPES__FILE_NAME, partition.getIdentityTypes()); }
void flushAttributedTypes(FilePartition partition) { flush(partition, IDENTITY_TYPES__FILE_NAME, partition.getIdentityTypes()); }
private void storeIdentityType(IdentityContext context, IdentityType identityType) { FilePartition filePartition = resolve(context.getPartition().getClass(), context.getPartition().getName()); Map<String, FileIdentityType> identityTypes = filePartition.getIdentityTypes().get(identityType.getClass().getName()); if (identityTypes == null) { identityTypes = new ConcurrentHashMap<String, FileIdentityType>(); filePartition.getIdentityTypes().put(identityType.getClass().getName(), identityTypes); } identityTypes.put(identityType.getId(), new FileIdentityType(identityType)); this.fileDataSource.flushAttributedTypes(filePartition); }
private void storeIdentityType(IdentityContext context, IdentityType identityType) { FilePartition filePartition = resolve(context.getPartition().getClass(), context.getPartition().getName()); Map<String, FileIdentityType> identityTypes = filePartition.getIdentityTypes().get(identityType.getClass().getName()); if (identityTypes == null) { identityTypes = new ConcurrentHashMap<String, FileIdentityType>(); filePartition.getIdentityTypes().put(identityType.getClass().getName(), identityTypes); } identityTypes.put(identityType.getId(), new FileIdentityType(identityType)); this.fileDataSource.flushAttributedTypes(filePartition); }
private IdentityType lookupIdentityById(IdentityContext context, String id, Partition partition) { FilePartition filePartition = resolve(partition.getClass(), partition.getName()); Map<String, Map<String, FileIdentityType>> identityTypes = filePartition.getIdentityTypes(); Map<String, FileIdentityType> typedIdentityTypes = new HashMap<String, FileIdentityType>(); for (String type : identityTypes.keySet()) { typedIdentityTypes.putAll(identityTypes.get(type)); } if (id != null) { FileIdentityType fileAttributedType = typedIdentityTypes.get(id); if (fileAttributedType != null) { return cloneAttributedType(context, fileAttributedType.getEntry()); } } return null; } }
private IdentityType lookupIdentityById(IdentityContext context, String id, Partition partition) { FilePartition filePartition = resolve(partition.getClass(), partition.getName()); Map<String, Map<String, FileIdentityType>> identityTypes = filePartition.getIdentityTypes(); Map<String, FileIdentityType> typedIdentityTypes = new HashMap<String, FileIdentityType>(); for (String type : identityTypes.keySet()) { typedIdentityTypes.putAll(identityTypes.get(type)); } if (id != null) { FileIdentityType fileAttributedType = typedIdentityTypes.get(id); if (fileAttributedType != null) { return cloneAttributedType(context, fileAttributedType.getEntry()); } } return null; } }
@Override public void removeAttributedType(IdentityContext context, AttributedType attributedType) { if (IdentityType.class.isInstance(attributedType)) { IdentityType identityType = (IdentityType) attributedType; Partition partition = identityType.getPartition(); FilePartition filePartition = resolve(partition.getClass(), partition.getName()); Map<String, FileIdentityType> identityTypes = filePartition.getIdentityTypes().get(attributedType.getClass().getName()); if (identityTypes != null) { identityTypes.remove(identityType.getId()); } this.fileDataSource.flushAttributedTypes(filePartition); } else if (Relationship.class.isInstance(attributedType)) { Map<String, FileRelationship> fileRelationships = this.fileDataSource.getRelationships() .get(attributedType.getClass().getName()); for (FileRelationship fileRelationship : new HashMap<String, FileRelationship>(fileRelationships).values()) { if (fileRelationship.getId().equals(attributedType.getId())) { fileRelationships.remove(fileRelationship.getId()); } } this.fileDataSource.flushRelationships(); } else { this.fileDataSource.getAttributedTypes().remove(attributedType.getId()); this.fileDataSource.flushAttributedTypes(); } }
@Override public void removeAttributedType(IdentityContext context, AttributedType attributedType) { if (IdentityType.class.isInstance(attributedType)) { IdentityType identityType = (IdentityType) attributedType; Partition partition = identityType.getPartition(); FilePartition filePartition = resolve(partition.getClass(), partition.getName()); Map<String, FileIdentityType> identityTypes = filePartition.getIdentityTypes().get(attributedType.getClass().getName()); if (identityTypes != null) { identityTypes.remove(identityType.getId()); } this.fileDataSource.flushAttributedTypes(filePartition); } else if (Relationship.class.isInstance(attributedType)) { Map<String, FileRelationship> fileRelationships = this.fileDataSource.getRelationships() .get(attributedType.getClass().getName()); for (FileRelationship fileRelationship : new HashMap<String, FileRelationship>(fileRelationships).values()) { if (fileRelationship.getId().equals(attributedType.getId())) { fileRelationships.remove(fileRelationship.getId()); } } this.fileDataSource.flushRelationships(); } else { this.fileDataSource.getAttributedTypes().remove(attributedType.getId()); this.fileDataSource.flushAttributedTypes(); } }
Map<String, Map<String, FileIdentityType>> identityTypes = filePartition.getIdentityTypes(); Map<String, FileIdentityType> typedIdentityTypes = null;
Map<String, Map<String, FileIdentityType>> identityTypes = filePartition.getIdentityTypes(); Map<String, FileIdentityType> typedIdentityTypes = null;
FILE_STORE_LOGGER.debugf("Loaded Identity Types [%s] for Partition [%s].", filePartition.getIdentityTypes().size(), filePartition.getId());
FILE_STORE_LOGGER.debugf("Loaded Identity Types [%s] for Partition [%s].", filePartition.getIdentityTypes().size(), filePartition.getId());