List of usage examples for java.util UUID fromString
public static UUID fromString(String name)
From source file:hudson.scm.listtagsparameter.ListSubversionTagsParameterDefinition.java
@DataBoundConstructor public ListSubversionTagsParameterDefinition(String name, String tagsDir, String tagsFilter, String defaultValue, String maxTags, boolean reverseByDate, boolean reverseByName, String uuid) { super(name, ResourceBundleHolder.get(ListSubversionTagsParameterDefinition.class).format("TagDescription")); this.tagsDir = Util.removeTrailingSlash(tagsDir); this.tagsFilter = tagsFilter; this.reverseByDate = reverseByDate; this.reverseByName = reverseByName; this.defaultValue = defaultValue; this.maxTags = maxTags; if (uuid == null || uuid.length() == 0) { this.uuid = UUID.randomUUID(); } else {/*from ww w .j a v a 2 s.c o m*/ this.uuid = UUID.fromString(uuid); } }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmXMsgRqstHandler.CFCrmXMsgRqstSecSessionDeleteByFinishIdxHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*w w w .j av a 2 s .c o m*/ // Common XML Attributes String attrId = null; String attrSecUserId = null; String attrFinish = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstSecSessionDeleteByFinishIdx"); CFCrmXMsgRqstHandler xmsgRqstHandler = (CFCrmXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFCrmSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SecUserId")) { if (attrSecUserId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecUserId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Finish")) { if (attrFinish != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrFinish = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values$implRqstTableDeleteByHandlerCheckReqKeyAttrs$ // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types UUID natSecUserId; natSecUserId = UUID.fromString(attrSecUserId); Calendar natFinish; try { natFinish = CFLibXmlUtil.parseTimestamp(attrFinish); } catch (RuntimeException e) { throw CFLib.getDefaultExceptionFactory().newInvalidArgumentException(getClass(), S_ProcName, 0, "Finish", attrFinish, e); } // Delete the objects schemaObj.getSecSessionTableObj().deleteSecSessionByFinishIdx(natSecUserId, natFinish); String response = CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSecSessionMessageFormatter.formatSecSessionRspnDeleted() + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); ((CFCrmXMsgRqstHandler) getParser()).appendResponse(response); } catch (RuntimeException e) { String response = CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFCrmXMsgRqstHandler xmsgRqstHandler = ((CFCrmXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { String response = CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFCrmXMsgRqstHandler xmsgRqstHandler = ((CFCrmXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmXMsgRqstHandler.CFCrmXMsgRqstSecUserReadHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {// w w w.j a v a 2 s . com // Common XML Attributes String attrId = null; // Primary Key Attributes for Constant Enum support String attrSecUserId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstSecUserRead"); CFCrmXMsgRqstHandler xmsgRqstHandler = (CFCrmXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFCrmSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate a PKey buffer for the parsed information CFCrmSecUserPKey pkey = schemaObj.getBackingStore().getFactorySecUser().newPKey(); // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SecUserId")) { if (attrSecUserId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecUserId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrSecUserId == null) || (attrSecUserId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "SecUserId"); } // Get current context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. UUID natSecUserId; natSecUserId = UUID.fromString(attrSecUserId); pkey.setRequiredSecUserId(natSecUserId); pkey.setRequiredSecUserId(natSecUserId); // Read the object and prepare the XML response ICFCrmSecUserObj read = schemaObj.getSecUserTableObj().readSecUser(pkey, true); if (read != null) { String response = CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSecUserMessageFormatter.formatSecUserRspnSingleOpenTag() + CFCrmXMsgSecUserMessageFormatter.formatSecUserRspnDerivedRec("\n\t\t", read.getSecUserBuff()) + "\n" + "\t" + CFCrmXMsgSecUserMessageFormatter.formatSecUserRspnSingleCloseTag() + CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(response); } else { String response = CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSchemaMessageFormatter.formatRspnNoDataFound() + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(response); } } catch (RuntimeException e) { String response = CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFCrmXMsgRqstHandler xmsgRqstHandler = ((CFCrmXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { String response = CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFCrmXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFCrmXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFCrmXMsgRqstHandler xmsgRqstHandler = ((CFCrmXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_4.CFFreeSwitchXMsgRqstHandler.CFFreeSwitchXMsgRqstSecSessionReadBySecProxyIdxHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFFreeSwitchXMsgSchemaMessageFormatter schemaFormatter = null; try {/*from w w w.j a v a 2s . c om*/ // Common XML Attributes String attrId = null; String attrSecProxyId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstSecSessionReadBySecProxyIdx"); CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = (CFFreeSwitchXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFFreeSwitchSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("SecProxyId")) { if (attrSecProxyId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrSecProxyId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. UUID natSecProxyId; natSecProxyId = UUID.fromString(attrSecProxyId); // Read the objects List<ICFSecuritySecSessionObj> list = schemaObj.getSecSessionTableObj() .readSecSessionBySecProxyIdx(natSecProxyId); String responseOpening = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgSecSessionMessageFormatter.formatSecSessionRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFSecuritySecSessionObj> iter = list.iterator(); ICFSecuritySecSessionObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFFreeSwitchXMsgSecSessionMessageFormatter.formatSecSessionRspnDerivedRec("\n\t\t", cur.getSecSessionBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFFreeSwitchXMsgSecSessionMessageFormatter.formatSecSessionRspnListCloseTag() + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = ((CFFreeSwitchXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = ((CFFreeSwitchXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
From source file:com.skelril.aurora.jail.CSVInmateDatabase.java
public synchronized boolean load() { FileInputStream input = null; boolean successful = true; boolean needsSaved = false; try {/* w ww. j av a 2s . com*/ input = new FileInputStream(inmateFile); InputStreamReader streamReader = new InputStreamReader(input, "utf-8"); CSVReader reader = new CSVReader(new BufferedReader(streamReader)); String[] line; while ((line = reader.readNext()) != null) { if (line.length < 5) { log.warning("A jail entry with < 5 fields was found!"); continue; } try { String rawID = "null"; String prisonName = "lava-flow"; String reason = ""; long startDate = 0; long endDate = 0; boolean isMuted = false; for (int i = 0; i < line.length; i++) { switch (i) { case 0: rawID = line[i].trim().toLowerCase(); break; case 1: prisonName = line[i].trim().toLowerCase(); break; case 2: reason = line[i].trim().toLowerCase(); break; case 3: startDate = Long.parseLong(line[i]); break; case 4: endDate = Long.parseLong(line[i]); break; case 5: isMuted = Boolean.parseBoolean(line[i]); break; } } if ("".equals(rawID) || "null".equals(rawID)) rawID = null; Inmate inmate = new Inmate(prisonName, reason, startDate, endDate, isMuted); try { inmate.setID(UUID.fromString(rawID)); } catch (IllegalArgumentException ex) { logger().finest("Converting inmate " + rawID + "'s name to UUID..."); UUID creatorID = UUIDUtil.convert(rawID); if (creatorID != null) { inmate.setID(creatorID); needsSaved = true; logger().finest("Success!"); } else { inmate.setName(rawID); logger().warning("Inmate " + rawID + "'s name could not be converted!"); } } UUIDInmate.put(inmate.getID(), inmate); } catch (NumberFormatException e) { log.warning("Non-long long field found in inmate!"); } } log.info(UUIDInmate.size() + " jailed name(s) loaded."); } catch (FileNotFoundException ignored) { } catch (IOException e) { UUIDInmate = new HashMap<>(); log.warning("Failed to load " + inmateFile.getAbsolutePath() + ": " + e.getMessage()); successful = false; } finally { if (input != null) { try { input.close(); } catch (IOException ignored) { } } } if (needsSaved) save(); return successful; }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskXMsgRqstHandler.CFAsteriskXMsgRqstSecUserReadByPwdResetIdxHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFAsteriskXMsgSchemaMessageFormatter schemaFormatter = null; try {/*from ww w. j av a2 s. c o m*/ // Common XML Attributes String attrId = null; String attrPasswordResetUuid = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstSecUserReadByPwdResetIdx"); CFAsteriskXMsgRqstHandler xmsgRqstHandler = (CFAsteriskXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFAsteriskSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PasswordResetUuid")) { if (attrPasswordResetUuid != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPasswordResetUuid = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. UUID natPasswordResetUuid; natPasswordResetUuid = UUID.fromString(attrPasswordResetUuid); // Read the objects List<ICFSecuritySecUserObj> list = schemaObj.getSecUserTableObj() .readSecUserByPwdResetIdx(natPasswordResetUuid); String responseOpening = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSecUserMessageFormatter.formatSecUserRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFSecuritySecUserObj> iter = list.iterator(); ICFSecuritySecUserObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFAsteriskXMsgSecUserMessageFormatter.formatSecUserRspnDerivedRec("\n\t\t", cur.getSecUserBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFAsteriskXMsgSecUserMessageFormatter.formatSecUserRspnListCloseTag() + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { CFAsteriskXMsgRqstHandler xmsgRqstHandler = ((CFAsteriskXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFAsteriskXMsgRqstHandler xmsgRqstHandler = ((CFAsteriskXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
From source file:com.microsoft.alm.plugin.idea.git.ui.branch.CreateBranchModelTest.java
@Before public void setUp() throws Exception { PowerMockito.mockStatic(VcsNotifier.class); when(VcsNotifier.getInstance(mockProject)).thenReturn(mockVcsNotifier); PowerMockito.mockStatic(GeneralGitHelper.class); when(GeneralGitHelper.getLastCommitHash(mockProject, mockGitRepository, mockRemoteMaster)) .thenReturn("281e2d5f8ba36655570ba808055e81ff64ba14d8"); when(mockGitRepository.getRemotes()) .thenReturn(ImmutableList.of(tfsRemoteBranch1, tfsRemoteBranch2, tfsRemoteMaster)); when(mockGitRepository.getInfo()).thenReturn(mockGitRepoInfo); when(mockRemoteMaster.getRemote()).thenReturn(tfsRemoteMaster); when(mockRemoteMaster.getName()).thenReturn("master"); when(mockRemoteBranch1.getRemote()).thenReturn(tfsRemoteBranch1); when(mockRemoteBranch1.getName()).thenReturn("branch1"); when(mockRemoteBranch2.getRemote()).thenReturn(tfsRemoteBranch2); when(mockRemoteBranch2.getName()).thenReturn("branch2"); when(mockVstsRepo.getId()).thenReturn(UUID.fromString("00000000-0000-0000-0000-000000000000")); when(mockTeamProjectReference.getId()).thenReturn(UUID.fromString("00000000-0000-0000-0000-000000000000")); when(mockGitRepoInfo.getRemoteBranches()).thenReturn(ImmutableList.of(mockRemoteMaster)); when(mockContext.getUri()).thenReturn(uri); when(mockContext.getGitRepository()).thenReturn(mockVstsRepo); when(mockContext.getTeamProjectReference()).thenReturn(mockTeamProjectReference); }
From source file:occi.infrastructure.Network.java
public Network(State state, String label, int vlan, Set<Link> links, Set<String> attributes) throws URISyntaxException, SchemaViolationException { super(links, attributes); this.state = state; networkList.put(UUID.fromString(getId().toString()), this); generateActionNames();/*from w ww.ja v a 2 s .co m*/ generateAttributeList(); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskXMsgRqstHandler.CFAsteriskXMsgRqstSecUserReadByEMConfIdxHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFAsteriskXMsgSchemaMessageFormatter schemaFormatter = null; try {//from w ww. ja v a 2 s . c o m // Common XML Attributes String attrId = null; String attrEMailConfirmationUuid = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstSecUserReadByEMConfIdx"); CFAsteriskXMsgRqstHandler xmsgRqstHandler = (CFAsteriskXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFAsteriskSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("EMailConfirmationUuid")) { if (attrEMailConfirmationUuid != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrEMailConfirmationUuid = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. UUID natEMailConfirmationUuid; natEMailConfirmationUuid = UUID.fromString(attrEMailConfirmationUuid); // Read the objects List<ICFSecuritySecUserObj> list = schemaObj.getSecUserTableObj() .readSecUserByEMConfIdx(natEMailConfirmationUuid); String responseOpening = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSecUserMessageFormatter.formatSecUserRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFSecuritySecUserObj> iter = list.iterator(); ICFSecuritySecUserObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFAsteriskXMsgSecUserMessageFormatter.formatSecUserRspnDerivedRec("\n\t\t", cur.getSecUserBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFAsteriskXMsgSecUserMessageFormatter.formatSecUserRspnListCloseTag() + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { CFAsteriskXMsgRqstHandler xmsgRqstHandler = ((CFAsteriskXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFAsteriskXMsgRqstHandler xmsgRqstHandler = ((CFAsteriskXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAsteriskXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_4.CFFreeSwitchXMsgRqstHandler.CFFreeSwitchXMsgRqstSecUserReadByPwdResetIdxHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFFreeSwitchXMsgSchemaMessageFormatter schemaFormatter = null; try {/*from ww w . ja v a 2s . co m*/ // Common XML Attributes String attrId = null; String attrPasswordResetUuid = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstSecUserReadByPwdResetIdx"); CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = (CFFreeSwitchXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFFreeSwitchSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("PasswordResetUuid")) { if (attrPasswordResetUuid != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrPasswordResetUuid = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. UUID natPasswordResetUuid; natPasswordResetUuid = UUID.fromString(attrPasswordResetUuid); // Read the objects List<ICFSecuritySecUserObj> list = schemaObj.getSecUserTableObj() .readSecUserByPwdResetIdx(natPasswordResetUuid); String responseOpening = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgSecUserMessageFormatter.formatSecUserRspnListOpenTag(); xmsgRqstHandler.appendResponse(responseOpening); Iterator<ICFSecuritySecUserObj> iter = list.iterator(); ICFSecuritySecUserObj cur; String subxml; while (iter.hasNext()) { cur = iter.next(); subxml = CFFreeSwitchXMsgSecUserMessageFormatter.formatSecUserRspnDerivedRec("\n\t\t", cur.getSecUserBuff()); xmsgRqstHandler.appendResponse(subxml); } String responseClosing = "\n" + "\t" + CFFreeSwitchXMsgSecUserMessageFormatter.formatSecUserRspnListCloseTag() + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.appendResponse(responseClosing); } catch (RuntimeException e) { CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = ((CFFreeSwitchXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = ((CFFreeSwitchXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }