List of usage examples for java.util SortedMap remove
V remove(Object key);
From source file:com.espertech.esper.schedule.SchedulingServiceImpl.java
public synchronized final void remove(ScheduleHandle handle, ScheduleSlot slot) { SortedMap<ScheduleSlot, ScheduleHandle> handleSet = handleSetMap.get(handle); if (handleSet == null) { // If it already has been removed then that's fine; // Such could be the case when 2 timers fireStatementStopped at the same time, and one stops the other return;// ww w .j av a 2 s.c om } handleSet.remove(slot); handleSetMap.remove(handle); }
From source file:org.shept.util.FtpFileCopy.java
/** * Compare the source path and the destination path for filenames with the filePattern * e.g. *.bak, *tmp and copy these files to the destination dir if they are not present at the * destination or if they have changed (by modifactionDate). * Copying is done from local directory into remote ftp destination directory. * /*from w w w. j a v a 2s . c o m*/ * @param destPath * @param localSourcePath * @param filePattern * @return the number of files being copied * @throws IOException */ public Integer syncPush(String localSourcePath, FTPClient ftpDest, String filePattern) throws IOException { // check for new files since the last check which need to be copied Integer number = 0; SortedMap<FileNameDate, FTPFile> destMap = fileMapByNameAndDate(ftpDest, filePattern); SortedMap<FileNameDate, File> sourceMap = FileUtils.fileMapByNameAndDate(localSourcePath, filePattern); // identify the list of source files different from their destinations for (FileNameDate fk : destMap.keySet()) { sourceMap.remove(fk); } // copy the list of files from source to destination for (File file : sourceMap.values()) { logger.debug(file.getName() + ": " + new Date(file.lastModified())); try { // only copy file that don't exist yet if (ftpDest.listNames(file.getName()).length == 0) { FileInputStream fin = new FileInputStream(file); String tmpName = "tempFile"; boolean rc = ftpDest.storeFile(tmpName, fin); fin.close(); if (rc) { rc = ftpDest.rename(tmpName, file.getName()); number++; } if (!rc) { ftpDest.deleteFile(tmpName); } } } catch (Exception ex) { logger.error("Ftp FileCopy did not succeed (using " + file.getName() + ")" + " FTP reported error " + ftpDest.getReplyString()); } } return number; }
From source file:net.sourceforge.msscodefactory.cfcore.v1_11.GenKbRam.GenKbRamISOCurrencyTable.java
public void updateISOCurrency(GenKbAuthorization Authorization, GenKbISOCurrencyBuff Buff) { GenKbISOCurrencyPKey pkey = schema.getFactoryISOCurrency().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); GenKbISOCurrencyBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateISOCurrency", "Existing record not found", "ISOCurrency", pkey); }//from w ww . j a v a2 s . c o m if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateISOCurrency", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); GenKbISOCurrencyByCcyCdIdxKey existingKeyCcyCdIdx = schema.getFactoryISOCurrency().newCcyCdIdxKey(); existingKeyCcyCdIdx.setRequiredISOCode(existing.getRequiredISOCode()); GenKbISOCurrencyByCcyCdIdxKey newKeyCcyCdIdx = schema.getFactoryISOCurrency().newCcyCdIdxKey(); newKeyCcyCdIdx.setRequiredISOCode(Buff.getRequiredISOCode()); // Check unique indexes // Validate foreign keys // Update is valid SortedMap<GenKbISOCurrencyPKey, GenKbISOCurrencyBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByCcyCdIdx.get(existingKeyCcyCdIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByCcyCdIdx.containsKey(newKeyCcyCdIdx)) { subdict = dictByCcyCdIdx.get(newKeyCcyCdIdx); } else { subdict = new TreeMap<GenKbISOCurrencyPKey, GenKbISOCurrencyBuff>(); dictByCcyCdIdx.put(newKeyCcyCdIdx, subdict); } subdict.put(pkey, Buff); }
From source file:net.sourceforge.msscodefactory.cfcore.v1_11.GenKbRam.GenKbRamContactListTable.java
public void deleteContactList(GenKbAuthorization Authorization, GenKbContactListBuff Buff) { final String S_ProcName = "GenKbRamContactListTable.deleteContactList() "; GenKbContactListPKey pkey = schema.getFactoryContactList().newPKey(); pkey.setRequiredContactListId(schema.nextContactListIdGen()); GenKbContactListBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteContactList", "Existing record not found", "ContactList", pkey); }/*from w ww . j a v a 2 s .co m*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteContactList", pkey); } GenKbContactListByTenantIdxKey keyTenantIdx = schema.getFactoryContactList().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); GenKbContactListByUDescrIdxKey keyUDescrIdx = schema.getFactoryContactList().newUDescrIdxKey(); keyUDescrIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); // Validate reverse foreign keys if (schema.getTableContact().readDerivedByContactListIdx(Authorization, existing.getRequiredContactListId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteContactList", "Container", "ContactList", "Contact", pkey); } // Delete is valid SortedMap<GenKbContactListPKey, GenKbContactListBuff> subdict; dictByPKey.remove(pkey); subdict = dictByTenantIdx.get(keyTenantIdx); subdict.remove(pkey); dictByUDescrIdx.remove(keyUDescrIdx); }
From source file:net.sourceforge.msscodefactory.cfcore.v1_11.GenKbRam.GenKbRamSecGroupTable.java
public void deleteSecGroup(GenKbAuthorization Authorization, GenKbSecGroupBuff Buff) { final String S_ProcName = "GenKbRamSecGroupTable.deleteSecGroup() "; GenKbSecGroupPKey pkey = schema.getFactorySecGroup().newPKey(); pkey.setRequiredSecGroupId(schema.nextSecGroupIdGen()); GenKbSecGroupBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteSecGroup", "Existing record not found", "SecGroup", pkey); }// w w w . j a v a 2 s .c o m if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSecGroup", pkey); } GenKbSecGroupByClusterIdxKey keyClusterIdx = schema.getFactorySecGroup().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); GenKbSecGroupByUNameIdxKey keyUNameIdx = schema.getFactorySecGroup().newUNameIdxKey(); keyUNameIdx.setRequiredClusterId(existing.getRequiredClusterId()); keyUNameIdx.setRequiredName(existing.getRequiredName()); // Validate reverse foreign keys if (schema.getTableSecGroupForm().readDerivedByGroupIdx(Authorization, existing.getRequiredSecGroupId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSecGroup", "Container", "SecGroupFormGroup", "SecGroupForm", pkey); } if (schema.getTableSecGroupInclude().readDerivedByGroupIdx(Authorization, existing.getRequiredSecGroupId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSecGroup", "Container", "SecGroupIncludeGroup", "SecGroupInclude", pkey); } if (schema.getTableSecGroupInclude().readDerivedByIncludeIdx(Authorization, existing.getRequiredSecGroupId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSecGroup", "Lookup", "SecGroupIncludeSubGroup", "SecGroupInclude", pkey); } if (schema.getTableSecGroupMember().readDerivedByGroupIdx(Authorization, existing.getRequiredSecGroupId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSecGroup", "Container", "SecGroupMemberGroup", "SecGroupMember", pkey); } // Delete is valid SortedMap<GenKbSecGroupPKey, GenKbSecGroupBuff> subdict; dictByPKey.remove(pkey); subdict = dictByClusterIdx.get(keyClusterIdx); subdict.remove(pkey); dictByUNameIdx.remove(keyUNameIdx); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamTldTable.java
public void deleteTld(CFAccAuthorization Authorization, CFAccTldBuff Buff) { final String S_ProcName = "CFAccRamTldTable.deleteTld() "; CFAccTldPKey pkey = schema.getFactoryTld().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredTLDId(Buff.getRequiredTLDId()); CFAccTldBuff existing = dictByPKey.get(pkey); if (existing == null) { return;/*w w w . j a v a 2s . c o m*/ } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteTld", pkey); } CFAccTldByTenantIdxKey keyTenantIdx = schema.getFactoryTld().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); CFAccTldByNameIdxKey keyNameIdx = schema.getFactoryTld().newNameIdxKey(); keyNameIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyNameIdx.setRequiredName(existing.getRequiredName()); // Validate reverse foreign keys // Delete is valid schema.getTableTopDomain().deleteTopDomainByTLDIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredTLDId()); SortedMap<CFAccTldPKey, CFAccTldBuff> subdict; dictByPKey.remove(pkey); subdict = dictByTenantIdx.get(keyTenantIdx); subdict.remove(pkey); dictByNameIdx.remove(keyNameIdx); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamTldTable.java
public void deleteTld(CFAstAuthorization Authorization, CFAstTldBuff Buff) { final String S_ProcName = "CFAstRamTldTable.deleteTld() "; CFAstTldPKey pkey = schema.getFactoryTld().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredTLDId(Buff.getRequiredTLDId()); CFAstTldBuff existing = dictByPKey.get(pkey); if (existing == null) { return;//from w w w . ja va2 s . co m } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteTld", pkey); } CFAstTldByTenantIdxKey keyTenantIdx = schema.getFactoryTld().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); CFAstTldByNameIdxKey keyNameIdx = schema.getFactoryTld().newNameIdxKey(); keyNameIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyNameIdx.setRequiredName(existing.getRequiredName()); // Validate reverse foreign keys // Delete is valid schema.getTableTopDomain().deleteTopDomainByTLDIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredTLDId()); SortedMap<CFAstTldPKey, CFAstTldBuff> subdict; dictByPKey.remove(pkey); subdict = dictByTenantIdx.get(keyTenantIdx); subdict.remove(pkey); dictByNameIdx.remove(keyNameIdx); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamDomainBaseTable.java
public void deleteDomainBase(CFAccAuthorization Authorization, CFAccDomainBaseBuff Buff) { final String S_ProcName = "CFAccRamDomainBaseTable.deleteDomainBase() "; CFAccDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setClassCode(Buff.getClassCode()); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFAccDomainBaseBuff existing = dictByPKey.get(pkey); if (existing == null) { return;/*w ww . ja v a 2s. c o m*/ } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteDomainBase", pkey); } CFAccDomainBaseByTenantIdxKey keyTenantIdx = schema.getFactoryDomainBase().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); // Validate reverse foreign keys if (schema.getTableTopDomain().readDerivedByIdIdx(Authorization, existing.getRequiredTenantId(), existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteDomainBase", "Superclass", "SuperClass", "TopDomain", pkey); } if (schema.getTableDomain().readDerivedByIdIdx(Authorization, existing.getRequiredTenantId(), existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteDomainBase", "Superclass", "SuperClass", "Domain", pkey); } if (schema.getTableProjectBase().readDerivedByIdIdx(Authorization, existing.getRequiredTenantId(), existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteDomainBase", "Superclass", "SuperClass", "ProjectBase", pkey); } // Delete is valid SortedMap<CFAccDomainBasePKey, CFAccDomainBaseBuff> subdict; dictByPKey.remove(pkey); subdict = dictByTenantIdx.get(keyTenantIdx); subdict.remove(pkey); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamSecAppTable.java
public void deleteSecApp(CFAccAuthorization Authorization, CFAccSecAppBuff Buff) { final String S_ProcName = "CFAccRamSecAppTable.deleteSecApp() "; CFAccSecAppPKey pkey = schema.getFactorySecApp().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecAppId(Buff.getRequiredSecAppId()); CFAccSecAppBuff existing = dictByPKey.get(pkey); if (existing == null) { return;/*from w ww . j av a 2 s . c o m*/ } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSecApp", pkey); } CFAccSecAppByClusterIdxKey keyClusterIdx = schema.getFactorySecApp().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFAccSecAppByUJEEMountIdxKey keyUJEEMountIdx = schema.getFactorySecApp().newUJEEMountIdxKey(); keyUJEEMountIdx.setRequiredClusterId(existing.getRequiredClusterId()); keyUJEEMountIdx.setRequiredJEEMountName(existing.getRequiredJEEMountName()); // Validate reverse foreign keys // Delete is valid schema.getTableSecForm().deleteSecFormBySecAppIdx(Authorization, Buff.getRequiredClusterId(), Buff.getRequiredSecAppId()); SortedMap<CFAccSecAppPKey, CFAccSecAppBuff> subdict; dictByPKey.remove(pkey); subdict = dictByClusterIdx.get(keyClusterIdx); subdict.remove(pkey); dictByUJEEMountIdx.remove(keyUJEEMountIdx); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamTagTable.java
public void deleteTag(CFAccAuthorization Authorization, CFAccTagBuff Buff) { final String S_ProcName = "CFAccRamTagTable.deleteTag() "; CFAccTagPKey pkey = schema.getFactoryTag().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFAccTagBuff existing = dictByPKey.get(pkey); if (existing == null) { return;// ww w .j av a 2 s. c om } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteTag", pkey); } CFAccTagByTenantIdxKey keyTenantIdx = schema.getFactoryTag().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); CFAccTagByNameIdxKey keyNameIdx = schema.getFactoryTag().newNameIdxKey(); keyNameIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyNameIdx.setRequiredName(existing.getRequiredName()); // Validate reverse foreign keys // Delete is valid schema.getTableAddressTag().deleteAddressTagByTagIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId()); schema.getTableAttachmentTag().deleteAttachmentTagByTagIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId()); schema.getTableContactTag().deleteContactTagByTagIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId()); schema.getTableMemoTag().deleteMemoTagByTagIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId()); schema.getTablePhoneTag().deletePhoneTagByTagIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId()); SortedMap<CFAccTagPKey, CFAccTagBuff> subdict; dictByPKey.remove(pkey); subdict = dictByTenantIdx.get(keyTenantIdx); subdict.remove(pkey); dictByNameIdx.remove(keyNameIdx); }